[vtkusers] Update vtkDelaunay2d object
David Doria
daviddoria+vtk at gmail.com
Mon Feb 22 21:59:39 EST 2010
2010/2/22 Jordi Gutiérrez Hermoso <jordigh at gmail.com>
> I have code like this in a class:
>
> //add the grid points to the polydata object
> vtkSmartPointer<vtkPolyData> polydata = vtkPolyData::New();
> polydata->SetPoints(points);
> polydata->GetPointData() -> SetScalars(scalars);
>
> //triangulate the grid points
> vtkSmartPointer<vtkDelaunay2D> delaunay = vtkDelaunay2D::New();
> delaunay->SetInput(polydata);
> delaunay->Update();
>
> And later this goes through the pipeline until I generate a plot.
>
> I want to plot a moving surface, so that the polydata object needs to
> be updated but only the z-coordinates, so that the actual Delaunay
> triangulation shouldn't have to be computed again.
>
> How can I update the polydata object with new points and scalars
> without recomputing a Delaunay triangulation?
>
> Thanks,
> - Jordi G. H.
>
>
First, this:
vtkSmartPointer<vtkPolyData> polydata = vtkPolyData::New();
is very bad. You must use
vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
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:
vtkPolyData* output = delaunay->GetOutput();
output->SetPoints(newPoints);
output->GetPointData()->SetScalars(newScalars);
Maybe I misunderstood your question?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100222/d2bf196c/attachment.htm>
More information about the vtkusers
mailing list