Ejemplo n.º 1
0
        private void CreateQuadFace(List <Edge> existingEdges, Shape subdivided, Face face)
        {
            //                  0 1 2 -> 3
            //for a quad face (a,b,c,d):
            //   (a, edge_pointab, face_pointabcd, edge_pointda)
            //   (b, edge_pointbc, face_pointabcd, edge_pointab)
            //   (c, edge_pointcd, face_pointabcd, edge_pointbc)
            //   (d, edge_pointda, face_pointabcd, edge_pointcd)
            List <Point> points = face.AllPoints;
            Point        a      = points[0].Successor;
            Point        b      = points[1].Successor;
            Point        c      = points[2].Successor;
            Point        d      = points[3].Successor;

            Point facePoint = face.FacePoint;

            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, a, face.Edges[0].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, b, face.Edges[1].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, c, face.Edges[2].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, d, face.Edges[3].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[3].EdgePoint, a));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[0].EdgePoint, b));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[1].EdgePoint, c));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[2].EdgePoint, d));

            SubdivisionUtilities.VerifyThatThereAreNoEdgeDuplicates(existingEdges);
        }
Ejemplo n.º 2
0
        private void CreateTriangleFace(List <Edge> existingEdges, Shape subdivided, Face face)
        {
            List <Point> points = face.AllPoints;
            Point        a      = points[0];
            Point        b      = points[1];
            Point        c      = points[2];

            //for a triangle face (a,b,c):
            //   (a, edge_pointab, face_pointabc, edge_pointca)
            //   (b, edge_pointbc, face_pointabc, edge_pointab)
            //   (c, edge_pointca, face_pointabc, edge_pointbc)
            Point facePoint = face.FacePoint;

            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, a, face.Edges[0].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, b, face.Edges[1].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, c, face.Edges[2].EdgePoint, facePoint));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[2].EdgePoint, a));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[0].EdgePoint, b));
            subdivided.Faces.Add(SubdivisionUtilities.CreateFaceF(existingEdges, facePoint, face.Edges[1].EdgePoint, c));

            SubdivisionUtilities.VerifyThatThereAreNoEdgeDuplicates(existingEdges);
        }