[vtkusers] vtk's Trees

Hila Hiler hilahiler at gmail.com
Sun May 6 03:16:11 EDT 2012


Hi all

please help me to figure up the simplest manipulation that trees should do
to polyData:
Division of vtkPolyData to regions and returning the arrays of the
vtkIdType in each region.
for example: I have a poly of x points (vtkIdType) and I want that the tree
will divide it to 8 regions such that each region will contain x/8 points
based on their spacial location.

I tried to do that in the following way but the array is empty (not because
the poly is Null) ...


    vtkSmartPointer<vtkKdTree> kDtree = vtkSmartPointer<vtkKdTree>::New();
    kDtree->SetDataSet(polyData);
    kDtree->SetNumberOfRegionsOrLess(numOfRegions); //  numOfRegions is the
number of regions that I'd like the poly to be divided
    kDtree->BuildLocator();


    for(int i=1; i< numOfRegions; i++)
    {
        vtkIdTypeArray* points = kDtree->GetPointsInRegion(i);
        for(vtkIdType idx=1; idx< points->GetSize(); idx++) // GetSize
returns an error because points is empty...
        {
            ...


Please help me to understand this, *any help would be useful* ...

Hila
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120506/a94af0ca/attachment.htm>


More information about the vtkusers mailing list