[vtkusers] Is this a bug?

Max smapersmaper at gmail.com
Mon Sep 9 07:48:51 EDT 2013


My code to solve it:

                //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();

                // filter that computes point normals for a polygonal
mesh(For smothing)
                meshNormals = vtkPolyDataNormals.New();
                meshNormals.SetInputConnection(mesh.GetProducerPort());
                meshNormals.SetFeatureAngle(60);
                meshNormals.Update();

                //sort poly data along camera view direction
                depthSort = vtkDepthSortPolyData.New();
                depthSort.SetInputConnection(meshNormals.GetOutputPort());
                depthSort.SetCamera(windowRenderer.GetActiveCamera());
                depthSort.SetDepthSortModeToParametricCenter();
                depthSort.Update();

                //Map the texture so it takes sphere shape, best suited for
prostate mesh
                mapToSphere = vtkTextureMapToPlane.New();
                mapToSphere.SetInputConnection(depthSort.GetOutputPort());
                
                meshMapper = vtkPolyDataMapper.New();
                meshMapper.SetInputConnection(mapToSphere.GetOutputPort());

                meshActor = vtkActor.New();
                meshActor.PickableOff();
                meshActor.SetMapper(meshMapper);



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



More information about the vtkusers mailing list