[vtkusers] 3d points to triangle coordinates - vtkDelaunay3D
Pierre Starkov
starkovpierre at yahoo.com
Fri May 2 11:33:32 EDT 2014
Hello,
I have a question on how to perform a triangulation of 3d points with VTK.
So I'd like to create a function which you give 3D points and that returns you triangle coordinates from these points. (a list of sublists, each
list has 3 points (triangle coordiates)). -> function([...]) -> [[ , , ]....[ , , ]]
To test the way to do so, i create points this way :
vtkSmartPointer< vtkPoints > points =
vtkSmartPointer< vtkPoints > :: New();
points->InsertNextPoint(0, 0, 0);
points->InsertNextPoint(1, 0, 0);
points->InsertNextPoint(1, 1, 0);
points->InsertNextPoint(0, 1, 1);
points->InsertNextPoint(5, 5, 5);
points->InsertNextPoint(6, 5, 5);
points->InsertNextPoint(6, 6, 5);
points->InsertNextPoint(5, 6, 6);
vtkSmartPointer< vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::
New();
polydata->SetPoints(points);
To create triangulation, I use this code :
vtkSmartPointer<vtkDelaunay3D> delaunay3D =
vtkSmartPointer<vtkDelaunay3D>
::New();
delaunay3D->SetInput(polydata);
delaunay3D->SetAlpha(0.2);
delaunay3D->Update();
From here, I'm lost. I do this, but it doesn't work :
vtkSmartPointer<
vtkTriangleFilter> triangleFilter =
vtkSmartPointer<vtkTriangleFilter>::New();
triangleFilter->
SetInputConnection(delaunay3D->GetOutputPort());
triangleFilter->Update();
Anybody has an idea of what is wrong in my code? Where is the mistake?
Hope you can help me!
Best regards,
Pierre Starkov,
Computer Science & Medical School Student,
Geneva, Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140502/1e60c3e4/attachment.html>
More information about the vtkusers
mailing list