[vtkusers] How to fix PointData correspondence when point ids change?

David Doria daviddoria+vtk at gmail.com
Thu Apr 22 10:51:57 EDT 2010


On Thu, Apr 22, 2010 at 10:42 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> As David Gobbi explained a few days ago, some filters traverse the
> cells (e.g. vtkExtractEdges) and hence change the point ids. If I have
> an array (say a vtkFloatArray of the point normals) in the PointData
> and the point ids get changed, the normals no longer correspond to the
> correct point. How is this typically dealt with?
>
> I started to write a filter called vtkRestorePolyDataPointIds that
> would take 2 inputs, an object with the original ids (the target ids)
> and an object with the changed ids. It would then use a kdTree to find
> the closest point in the target data set to each point in the changed
> data set, and then rebuild the polydata using that point id
> correspondence. Although this seems like it would work, it seems like
> an outrageous thing to do haha.
>
> Is there a better way?
>
> Thanks,
>
> David
>

I guess you could also run vtkIdFilter BEFORE running vtkExtractEdges
and then the mapping would already be known, but you'd still have to
rebuild the polydata (i.e. change the point ids and change the ids of
the points that each cell uses).

Thanks,

David



More information about the vtkusers mailing list