<div dir="ltr">Hi everyone,<div><br></div><div style>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:</div>
<div style><br></div><div style>(note: points contains the ordered set of 3D contour points)</div><div style><br></div><div style># The polydata to triangulate</div><div style><div>polydata = vtk.vtkPolyData()</div><div>polydata.SetPoints(points)</div>
<div>polydata.Update()</div><div><br></div><div style># The polydata (constrain) containing the contour of the surface</div><div style><div style>npoints = points.GetNumberOfPoints()</div><div>polyLine = vtk.vtkPolyLine()</div>
<div>polyLine.GetPointIds().SetNumberOfIds(npoints+1)<br></div><div><div>for n in range(npoints):</div><div> polyLine.GetPointIds().SetId(n,n)</div><div>polyLine.GetPointIds().SetId(npoints,0) # To close the boundary<br>
</div></div><div><br></div><div><div>cells = vtk.vtkCellArray()</div><div>cells.InsertNextCell(polyLine)</div><div><br></div><div>boundary = vtk.vtkPolyData()</div><div>boundary.SetPoints(points)</div><div>boundary.SetLines(cells)</div>
<div>boundary.Update()</div></div><div><br></div><div style># The constrained triangulation (NOT WORKING)</div><div style>delny = vtk.vtkDelaunay2D()</div><div>delny.SetInput(polydata)</div><div>delny.SetSource(boundary)</div>
<div>delny.Update()<br></div><div><br></div><div style>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): <a href="http://tinypic.com/r/ao3sj5/5">http://tinypic.com/r/ao3sj5/5</a>.</div>
<div style><br></div><div style>Anyone knows what I'm doing wrong?</div><div style><br></div><div style>Thanks!</div><div style>Miguel </div></div></div></div>