[vtkusers] vtkDelaunay2D: no constrained triangulation
Miguel Sotaquira
msotaquira at gmail.com
Sat May 18 07:41:41 EDT 2013
Hi everyone,
I have a set of 100 3D points defining a 3D closed contour. I want to
create a 3D surface and the triangulation MUST preserve these edges, so I'm
using vtkDelaunay2D and adding the constrain with the SetSource method.
Here's a snippet of my python code:
(note: points contains the ordered set of 3D contour points)
# The polydata to triangulate
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.Update()
# The polydata (constrain) containing the contour of the surface
npoints = points.GetNumberOfPoints()
polyLine = vtk.vtkPolyLine()
polyLine.GetPointIds().SetNumberOfIds(npoints+1)
for n in range(npoints):
polyLine.GetPointIds().SetId(n,n)
polyLine.GetPointIds().SetId(npoints,0) # To close the boundary
cells = vtk.vtkCellArray()
cells.InsertNextCell(polyLine)
boundary = vtk.vtkPolyData()
boundary.SetPoints(points)
boundary.SetLines(cells)
boundary.Update()
# The constrained triangulation (NOT WORKING)
delny = vtk.vtkDelaunay2D()
delny.SetInput(polydata)
delny.SetSource(boundary)
delny.Update()
My problem is that the obtained triangulation is actually unconstrained.
This is an example of the resulting triangulation (in red the boundary
contour, in blue the unconstrained result of the triangulation):
http://tinypic.com/r/ao3sj5/5.
Anyone knows what I'm doing wrong?
Thanks!
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130518/bfcbbfd5/attachment.htm>
More information about the vtkusers
mailing list