[vtkusers] Building a KD Tree from a vtkDataArray

Kevin H. Hobbs hobbsk at ohio.edu
Tue Apr 19 16:48:05 EDT 2011


On 04/19/2011 11:48 AM, Federico Milano wrote:
> Hi,
> 
> I need to create a vtkKdTreePointLocator from a vtkDaraArray, where I
> have stored points as 3 components tuples. Is there an easy way to
> convert from vtkDataArray to vtkDataSet, so I can initialize the KDTree?
> 
> Thanks in advance,
> 
> Federico

I think you have to do something like :

vtkPoints * points = vtkPoints::New();
points->SetData( your_vtkDataArray );

vtkPointSet * point_set = vtkPointSet::New();
point_set->SetPoints( points );

vtkKdTreePointLocator * locator = vtkKdTreePointLocator::New();
locator->SetDataSet( point_set );



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110419/5dbb090c/attachment.pgp>


More information about the vtkusers mailing list