[vtkusers] vtkTriangleFilter
Snehal Kasodekar
snehal.kasodekar at gmail.com
Tue Nov 10 20:26:00 EST 2009
Hi,
I wanted to generate a triangulates sphere mesh.
I use the following code:
// create sphere geometry
vtkSphereSource *sphere = vtkSphereSource :: New();
sphere->SetCenter(mySphereCenter[0],mySphereCenter[1],mySphereCenter[2]);
sphere->SetRadius( mySphereRadius);
sphere->SetThetaResolution(100);
sphere->SetPhiResolution(100);
sphere->Update();
vtkPolyData* sphereData = sphere->GetOutput();
vtkTriangleFilter *triangleFilter = vtkTriangleFilter::New();
triangleFilter->PassVertsOff();
triangleFilter->PassLinesOff();
triangleFilter->SetInputConnection(sphereData->GetProducerPort());
triangleFilter->Update();
vtkPolyData *triangulation = triangleFilter->GetOutput();
vtkIdType outNumPts = triangulation->GetNumberOfPoints();
vtkIdType outNumCells = triangulation->GetNumberOfCells();
vtkIdType outNumPolys = triangulation->GetNumberOfPolys();
vtkIdType outNumLines = triangulation->GetNumberOfLines();
vtkIdType outNumVerts = triangulation->GetNumberOfVerts();
The output consists of paralel triangular chains with no connections between
them. How can I generate a triangulation that covers the entire object ?
Thanks,
Snehal
PS: This is my first post, so if any more information is needed please let
me know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091110/85679038/attachment.htm>
More information about the vtkusers
mailing list