[vtkusers] mesh

Max smapersmaper at gmail.com
Tue Sep 3 09:05:33 EDT 2013


Hi dhekra,
You need list of vertices and faces(edges) to build a mesh.
Partial code:

                //object to represent cell connectivity.
                triangles = vtkCellArray.New();

                //represent and manipulate 3D points
                points = vtkPoints.New();

                // Add vertices
                foreach (Point3D vertex in vmMesh.ShapePointsList)
                {
                    points.InsertNextPoint(vertex.X, vertex.Y, vertex.Z);
                }

                // Add faces
                foreach (MeshFace face in vmMesh.ShapeTriangles)
                {
                    vtkTriangle triangle = vtkTriangle.New();
                    triangle.GetPointIds().SetId(0, face.N1);
                    triangle.GetPointIds().SetId(1, face.N2);
                    triangle.GetPointIds().SetId(2, face.N3);
                    triangles.InsertNextCell(triangle);
                }

                //represents a geometric structure consisting of vertices,
lines, polygons, and triangle strips
                mesh = vtkPolyData.New();
                mesh.SetPoints(points);
                mesh.SetPolys(triangles);
                mesh.Update();




--
View this message in context: http://vtk.1045678.n5.nabble.com/mesh-tp5723202p5723222.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list