private static void CreateMesh <MESH>(IMeshConstructor <MESH> constructor, MeshDescriptor des) { constructor.PushTriangleMesh(des.Vertices, des.Faces); for (int i = 0; i < des.Vertices; i++) { constructor.AddVertex(CGAL_GetPoint2f(i)); } for (int i = 0; i < des.Faces; i++) { TriangleIndex triangle = CGAL_GetTriangle(i); constructor.AddFace(triangle); } for (int i = 0; i < des.Faces; i++) { TriangleIndex triangle = CGAL_GetNeighbor(i); constructor.AddFaceConnection(i, triangle); } }
private static void CreateLine <MESH>(IMeshConstructor <MESH> constructor, MeshDescriptor des) { constructor.PushEdgeMesh(des.Vertices, des.Edges); for (int i = 0; i < des.Vertices; i++) { Vector2f v = CGAL_GetSkeletonPoint(i); constructor.AddVertex(v); } for (int i = 0; i < des.Edges; i++) { EdgeIndex edge = CGAL_GetSkeletonEdge(i); constructor.AddEdge(edge); } int numConnections = CGAL_NumEdgeConnection(); for (int i = 0; i < numConnections; i++) { EdgeConnection con = CGAL_GetEdgeConnection(i); constructor.AddEdgeConnection(con); } }
private static void CreateMesh <MESH>(IMeshConstructor <MESH> constructor, MeshDescriptor des) { constructor.PushTriangleMesh(des.Vertices, des.Faces); for (int i = 0; i < des.Vertices; i++) { constructor.AddVertex(CGAL_GetPoint2f(i)); } for (int i = 0; i < des.Faces; i++) { TriangleIndex triangle = CGAL_GetTriangle(i); Vector2f a = CGAL_GetPoint2f(triangle.i0); Vector2f b = CGAL_GetPoint2f(triangle.i1); Vector2f c = CGAL_GetPoint2f(triangle.i2); Vector2f p = (a + b + c) / 3.0f; if (PolygonIntersection2.ContainsPoint(p)) { constructor.AddFace(triangle); } } }