<div class="gmail_quote">2010/2/22 Jordi GutiƩrrez Hermoso <span dir="ltr"><<a href="mailto:jordigh@gmail.com">jordigh@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I have code like this in a class:<br>
<br>
//add the grid points to the polydata object<br>
vtkSmartPointer<vtkPolyData> polydata = vtkPolyData::New();<br>
polydata->SetPoints(points);<br>
polydata->GetPointData() -> SetScalars(scalars);<br>
<br>
//triangulate the grid points<br>
vtkSmartPointer<vtkDelaunay2D> delaunay = vtkDelaunay2D::New();<br>
delaunay->SetInput(polydata);<br>
delaunay->Update();<br>
<br>
And later this goes through the pipeline until I generate a plot.<br>
<br>
I want to plot a moving surface, so that the polydata object needs to<br>
be updated but only the z-coordinates, so that the actual Delaunay<br>
triangulation shouldn't have to be computed again.<br>
<br>
How can I update the polydata object with new points and scalars<br>
without recomputing a Delaunay triangulation?<br>
<br>
Thanks,<br>
- Jordi G. H.<br><br></blockquote><div class="gmail_quote"><br></div><div class="gmail_quote">First, this:</div><div class="gmail_quote"> vtkSmartPointer<vtkPolyData> polydata = vtkPolyData::New();</div><div class="gmail_quote">
<br></div><div class="gmail_quote">is very bad. You must use</div> vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();<br clear="all"><br></div><div class="gmail_quote">It shouldn't be a problem to do what you are asking, I think you can just get the output of the Delaunay filter and update its points:</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">vtkPolyData* output = delaunay->GetOutput();</div><div class="gmail_quote">output->SetPoints(newPoints);</div><div class="gmail_quote">output->GetPointData()->SetScalars(newScalars);</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Maybe I misunderstood your question?</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks,<br><br><div>David </div></div>