コード例 #1
0
ファイル: Manipulator.cs プロジェクト: JanikScholl/myRepos
        //Check all facesB in our floor
        //Check the faces edges if they are parallel or orthogonal to the moveVector of faceA

        //if orthogonal
        //check if faceA has an edge with contains the orthogonal Edge of faceB
        //if so, add faceB´s orthogonal edge to the verticesToMoveList and start with the next face
        //check if faceA only shares one vertex with B

        //If parallel
        //check if faceA shares an edge with faceB
        //if so, then add all edges of faceA to the verticesToMove list and rerun the whole process with faceA=faceB
        //continue untill all parallel edges are added, then start with next face
        private void AddAttachedToMove(Face movingFace, Vector2 moveVector, List <Face> checkedFaces, ref List <Vertex> verticesToMove)
        {
            foreach (Face face in currentFloor.GetFaces())
            {
                if (!movingFace.Equals(face) && !checkedFaces.Contains(face) && face.GetType().ToString() != "wunderZone")
                {
                    foreach (Edge edge in face.GetEdges())
                    {
                        if (Angle(moveVector, edge.GetEdgeVector()) != 0)
                        {
                        }

                        if (Angle(moveVector, edge.GetEdgeVector()) == 0)
                        {
                            if (FaceEdgeEuqlasEdge(movingFace, edge)) //this works!
                            {
                                AddEdgeToMove(face.GetEdges(), ref verticesToMove);
                                checkedFaces.Add(face);
                                Console.WriteLine("Entering addAttacehdFace for face" + face.GetFaceName());
                                AddAttachedToMove(face, moveVector, checkedFaces, ref verticesToMove);
                            }

                            if (VerticesToMoveContains(verticesToMove, edge))
                            {
                                AddEdgeToMove(edge, ref verticesToMove);
                            }
                        }
                    }
                }
            }
        }