[vtkusers] Insert unique points into vtkPoints

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Jan 20 19:34:26 EST 2005

John Platt wrote:
> Hi All,
> Has anyone found an ‘easy’ way to insert unique points into a vtkPoints 
> object? The bounds are not known in advance. I’ve looked at 
> vtkMergePoints but at a glance can’t see how to get the points out.

You should be able to use vtkPointLocator::InitPointInsertion pass in 
the vtkPoints you want to manipulate later:

newPts = vtkPoints::New();
locator->InitPointInsertion (newPts, bounds);

// add point to the locator
locator->InsertUniquePoint(x, ptId);

// newPts is up to date (internal representation behind a locator).
//it contains the point x at position pdId

For the bounds can't you give a wrong max  (over estimated) ?

BTW vtkMergePoints is much faster.

More information about the vtkusers mailing list