vtkKdTree Class Reference

#include <vtkKdTree.h>

Inheritance diagram for vtkKdTree:

Inheritance graph
[legend]
Collaboration diagram for vtkKdTree:

Collaboration graph
[legend]
List of all members.

Detailed Description

a Kd-tree spatial decomposition of a set of points

Given one or more vtkDataSets, create a load balancing k-d tree decomposition of the points at the center of the cells. Or, create a k-d tree point locator from a list of points.

This class can also generate a PolyData representation of the boundaries of the spatial regions in the decomposition.

It can sort the regions with respect to a viewing direction, and it can decompose a list of regions into subsets, each of which represent a convex spatial region (since many algorithms require a convex region).

If the points were derived from cells, vtkKdTree can create a list of cell Ids for each region for each data set. Two lists are available - all cells with centroid in the region, and all cells that intersect the region but whose centroid lies in another region.

For the purpose of removing duplicate points quickly from large data sets, or for finding nearby points, we added another mode for building the locator. BuildLocatorFromPoints will build a k-d tree from one or more vtkPoints objects. This can be followed by BuildMapForDuplicatePoints which returns a mapping from the original ids to a subset of the ids that is unique within a supplied tolerance, or you can use FindPoint and FindClosestPoint to locate points in the original set that the tree was built from.

See also:
vtkLocator vtkCellLocator vtkPKdTree
Events:
vtkCommand::ProgressEvent
Tests:
vtkKdTree (Tests)

Definition at line 79 of file vtkKdTree.h.

Public Types

typedef vtkLocator Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual int GetNumberOfRegionsOrLess ()
virtual void SetNumberOfRegionsOrLess (int)
virtual int GetNumberOfRegionsOrMore ()
virtual void SetNumberOfRegionsOrMore (int)
virtual double GetFudgeFactor ()
virtual void SetFudgeFactor (double)
virtual vtkBSPCutsGetCuts ()
void SetCuts (vtkBSPCuts *cuts)
void OmitXPartitioning ()
void OmitYPartitioning ()
void OmitZPartitioning ()
void OmitXYPartitioning ()
void OmitYZPartitioning ()
void OmitZXPartitioning ()
void OmitNoPartitioning ()
virtual void SetDataSet (vtkDataSet *set)
virtual void AddDataSet (vtkDataSet *set)
int GetNumberOfDataSets ()
vtkDataSetGetDataSet (int n)
vtkDataSetGetDataSet ()
int GetDataSetIndex (vtkDataSet *set)
void GetBounds (double *bounds)
void SetNewBounds (double *bounds)
void GetRegionBounds (int regionID, double bounds[6])
void GetRegionDataBounds (int regionID, double bounds[6])
void PrintRegion (int id)
void CreateCellLists (int dataSetIndex, int *regionReqList, int reqListSize)
void CreateCellLists (vtkDataSet *set, int *regionReqList, int reqListSize)
void CreateCellLists (int *regionReqList, int listSize)
void CreateCellLists ()
void DeleteCellLists ()
vtkIdListGetCellList (int regionID)
vtkIdListGetBoundaryCellList (int regionID)
int * AllGetRegionContainingCell ()
int GetRegionContainingPoint (double x, double y, double z)
void BuildLocator ()
int MinimalNumberOfConvexSubRegions (vtkIntArray *regionIdList, double **convexRegionBounds)
int DepthOrderAllRegions (double *dop, vtkIntArray *orderedList)
vtkIdTypeArrayBuildMapForDuplicatePoints (float tolerance)
vtkIdTypeArrayGetPointsInRegion (int regionId)
void FreeSearchStructure ()
void GenerateRepresentation (int level, vtkPolyData *pd)
void GenerateRepresentation (int *regionList, int len, vtkPolyData *pd)
virtual void PrintTiming (ostream &os, vtkIndent indent)
virtual int NewGeometry ()
virtual int NewGeometry (vtkDataSet **sets, int numDataSets)
virtual void InvalidateGeometry ()
void FindPointsInArea (double *area, vtkIdTypeArray *ids, bool clearArray=true)
virtual void TimingOn ()
virtual void TimingOff ()
virtual void SetTiming (int)
virtual int GetTiming ()
virtual void SetMinCells (int)
virtual int GetMinCells ()
virtual void RemoveDataSet (int index)
virtual void RemoveDataSet (vtkDataSet *set)
virtual void RemoveAllDataSets ()
virtual vtkDataSetCollectionGetDataSets ()
virtual int GetNumberOfRegions ()
void PrintTree ()
void PrintVerboseTree ()
virtual void SetIncludeRegionBoundaryCells (int)
virtual int GetIncludeRegionBoundaryCells ()
virtual void IncludeRegionBoundaryCellsOn ()
virtual void IncludeRegionBoundaryCellsOff ()
vtkIdType GetCellLists (vtkIntArray *regions, int set, vtkIdList *inRegionCells, vtkIdList *onBoundaryCells)
vtkIdType GetCellLists (vtkIntArray *regions, vtkDataSet *set, vtkIdList *inRegionCells, vtkIdList *onBoundaryCells)
vtkIdType GetCellLists (vtkIntArray *regions, vtkIdList *inRegionCells, vtkIdList *onBoundaryCells)
int GetRegionContainingCell (vtkDataSet *set, vtkIdType cellID)
int GetRegionContainingCell (int set, vtkIdType cellID)
int GetRegionContainingCell (vtkIdType cellID)
int DepthOrderRegions (vtkIntArray *regionIds, double *dop, vtkIntArray *orderedList)
int ViewOrderAllRegionsInDirection (const double directionOfProjection[3], vtkIntArray *orderedList)
int ViewOrderRegionsInDirection (vtkIntArray *regionIds, const double directionOfProjection[3], vtkIntArray *orderedList)
int ViewOrderAllRegionsFromPosition (const double directionOfProjection[3], vtkIntArray *orderedList)
int ViewOrderRegionsFromPosition (vtkIntArray *regionIds, const double directionOfProjection[3], vtkIntArray *orderedList)
void BuildLocatorFromPoints (vtkPointSet *pointset)
void BuildLocatorFromPoints (vtkPoints *ptArray)
void BuildLocatorFromPoints (vtkPoints **ptArray, int numPtArrays)
vtkIdType FindPoint (double *x)
vtkIdType FindPoint (double x, double y, double z)
vtkIdType FindClosestPoint (double *x, double &dist2)
vtkIdType FindClosestPoint (double x, double y, double z, double &dist2)
vtkIdType FindClosestPointInRegion (int regionId, double *x, double &dist2)
vtkIdType FindClosestPointInRegion (int regionId, double x, double y, double z, double &dist2)
virtual void GenerateRepresentationUsingDataBoundsOn ()
virtual void GenerateRepresentationUsingDataBoundsOff ()
virtual void SetGenerateRepresentationUsingDataBounds (int)
virtual int GetGenerateRepresentationUsingDataBounds ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkKdTreeSafeDownCast (vtkObject *o)
static vtkKdTreeNew ()
static vtkKdNodeCopyTree (vtkKdNode *kd)

Protected Types

 XDIM = 0
 YDIM = 1
 ZDIM = 2
enum  { XDIM = 0, YDIM = 1, ZDIM = 2 }

Protected Member Functions

 vtkKdTree ()
 ~vtkKdTree ()
void SetCalculator (vtkKdNode *kd)
int ProcessUserDefinedCuts (double *bounds)
void SetCuts (vtkBSPCuts *cuts, int userDefined)
void UpdateBuildTime ()
int DivideTest (int numberOfPoints, int level)
void BuildRegionList ()
virtual int SelectCutDirection (vtkKdNode *kd)
void SetActualLevel ()
void GetRegionsAtLevel (int level, vtkKdNode **nodes)
int GetNumberOfCells ()
int GetDataSetsNumberOfCells (int set1, int set2)
void ComputeCellCenter (vtkDataSet *set, int cellId, float *center)
void ComputeCellCenter (vtkDataSet *set, int cellId, double *center)
float * ComputeCellCenters ()
float * ComputeCellCenters (int set)
float * ComputeCellCenters (vtkDataSet *set)
virtual void ReportReferences (vtkGarbageCollector *)
void UpdateProgress (double amount)
void UpdateSubOperationProgress (double amount)
void FindPointsInArea (vtkKdNode *node, double *area, vtkIdTypeArray *ids)
void AddAllPointsInRegion (vtkKdNode *node, vtkIdTypeArray *ids)
int DivideRegion (vtkKdNode *kd, float *c1, int *ids, int nlevels)
void DoMedianFind (vtkKdNode *kd, float *c1, int *ids, int d1, int d2, int d3)
void SelfRegister (vtkKdNode *kd)
void InitializeCellLists ()
vtkIdListGetList (int regionId, vtkIdList **which)
void ComputeCellCenter (vtkCell *cell, double *center, double *weights)
void GenerateRepresentationDataBounds (int level, vtkPolyData *pd)
void _generateRepresentationDataBounds (vtkKdNode *kd, vtkPoints *pts, vtkCellArray *polys, int level)
void GenerateRepresentationWholeSpace (int level, vtkPolyData *pd)
void _generateRepresentationWholeSpace (vtkKdNode *kd, vtkPoints *pts, vtkCellArray *polys, int level)
void AddPolys (vtkKdNode *kd, vtkPoints *pts, vtkCellArray *polys)
void _printTree (int verbose)
int SearchNeighborsForDuplicate (int regionId, float *point, int **pointsSoFar, int *len, float tolerance, float tolerance2)
int SearchRegionForDuplicate (float *point, int *pointsSoFar, int len, float tolerance2)
int _FindClosestPointInRegion (int regionId, double x, double y, double z, double &dist2)
int FindClosestPointInSphere (double x, double y, double z, double radius, int skipRegion, double &dist2)
int _ViewOrderRegionsInDirection (vtkIntArray *IdsOfInterest, const double dop[3], vtkIntArray *orderedList)
int _ViewOrderRegionsFromPosition (vtkIntArray *IdsOfInterest, const double pos[3], vtkIntArray *orderedList)
void NewParitioningRequest (int req)
void SetInputDataInfo (int i, int dims[3], double origin[3], double spacing[3])
int CheckInputDataInfo (int i, int dims[3], double origin[3], double spacing[3])
void ClearLastBuildCache ()
void NewPartitioningRequest (int req)
 vtkKdTree (const vtkKdTree &)
void operator= (const vtkKdTree &)
virtual void SetProgress (double)
virtual double GetProgress ()

Static Protected Member Functions

static void DeleteAllDescendants (vtkKdNode *nd)
static void GetLeafNodeIds (vtkKdNode *node, vtkIntArray *ids)
static void _SetNewBounds (vtkKdNode *kd, double *b, int *fixDim)
static void CopyChildNodes (vtkKdNode *to, vtkKdNode *from)
static void CopyKdNode (vtkKdNode *to, vtkKdNode *from)
static void SetDataBoundsToSpatialBounds (vtkKdNode *kd)
static void ZeroNumberOfPoints (vtkKdNode *kd)
static int __ViewOrderRegionsInDirection (vtkKdNode *node, vtkIntArray *list, vtkIntArray *IdsOfInterest, const double dir[3], int nextId)
static int __ViewOrderRegionsFromPosition (vtkKdNode *node, vtkIntArray *list, vtkIntArray *IdsOfInterest, const double pos[3], int nextId)
static int __ConvexSubRegions (int *ids, int len, vtkKdNode *tree, vtkKdNode **nodes)
static int FoundId (vtkIntArray *idArray, int id)
static void __printTree (vtkKdNode *kd, int depth, int verbose)
static int MidValue (int dim, float *c1, int nvals, double &coord)
static int Select (int dim, float *c1, int *ids, int nvals, double &coord)
static float FindMaxLeftHalf (int dim, float *c1, int K)
static void _Select (int dim, float *X, int *ids, int L, int R, int K)
static int ComputeLevel (vtkKdNode *kd)
static int SelfOrder (int id, vtkKdNode *kd)
static int findRegion (vtkKdNode *node, float x, float y, float z)
static int findRegion (vtkKdNode *node, double x, double y, double z)
static vtkKdNode ** _GetRegionsAtLevel (int level, vtkKdNode **nodes, vtkKdNode *kd)
static void AddNewRegions (vtkKdNode *kd, float *c1, int midpt, int dim, double coord)

Protected Attributes

vtkBSPIntersectionsBSPCalculator
int UserDefinedCuts
int ValidDirections
vtkKdNodeTop
vtkKdNode ** RegionList
vtkTimerLogTimerLog
vtkDataSetCollectionDataSets
double ProgressScale
double ProgressOffset
int NumberOfRegionsOrLess
int NumberOfRegionsOrMore
int IncludeRegionBoundaryCells
double CellBoundsCache [6]
int GenerateRepresentationUsingDataBounds
_cellList CellList
int * CellRegionList
int MinCells
int NumberOfRegions
int Timing
double FudgeFactor
int NumberOfLocatorPoints
float * LocatorPoints
int * LocatorIds
int * LocatorRegionLocation
float MaxWidth
int LastNumDataSets
int LastDataCacheSize
vtkDataSet ** LastInputDataSets
unsigned long * LastDataSetObserverTags
int * LastDataSetType
double * LastInputDataInfo
double * LastBounds
vtkIdTypeLastNumPoints
vtkIdTypeLastNumCells
vtkBSPCutsCuts
double Progress

Classes

struct  _cellList


Member Typedef Documentation

typedef vtkLocator vtkKdTree::Superclass

Reimplemented from vtkLocator.

Reimplemented in vtkPKdTree.

Definition at line 82 of file vtkKdTree.h.


Member Enumeration Documentation

anonymous enum [protected]

Enumerator:
XDIM 
YDIM 
ZDIM 

Definition at line 518 of file vtkKdTree.h.


Constructor & Destructor Documentation

vtkKdTree::vtkKdTree (  )  [protected]

vtkKdTree::~vtkKdTree (  )  [protected]

vtkKdTree::vtkKdTree ( const vtkKdTree  )  [protected]


Member Function Documentation

virtual const char* vtkKdTree::GetClassName (  )  [virtual]

Reimplemented from vtkLocator.

Reimplemented in vtkPKdTree.

static int vtkKdTree::IsTypeOf ( const char *  type  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkLocator.

Reimplemented in vtkPKdTree.

virtual int vtkKdTree::IsA ( const char *  type  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkLocator.

Reimplemented in vtkPKdTree.

static vtkKdTree* vtkKdTree::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkLocator.

Reimplemented in vtkPKdTree.

void vtkKdTree::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkLocator.

Reimplemented in vtkPKdTree.

static vtkKdTree* vtkKdTree::New (  )  [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

Reimplemented in vtkPKdTree.

virtual void vtkKdTree::TimingOn (  )  [virtual]

Turn on timing of the k-d tree build

virtual void vtkKdTree::TimingOff (  )  [virtual]

Turn on timing of the k-d tree build

virtual void vtkKdTree::SetTiming ( int   )  [virtual]

Turn on timing of the k-d tree build

virtual int vtkKdTree::GetTiming (  )  [virtual]

Turn on timing of the k-d tree build

virtual void vtkKdTree::SetMinCells ( int   )  [virtual]

Minimum number of cells per spatial region. Default is 100.

virtual int vtkKdTree::GetMinCells (  )  [virtual]

Minimum number of cells per spatial region. Default is 100.

virtual int vtkKdTree::GetNumberOfRegionsOrLess (  )  [virtual]

Set/Get the number of spatial regions you want to get close to without going over. (The number of spatial regions is normally a power of two.) Call this before BuildLocator(). Default is unset.

virtual void vtkKdTree::SetNumberOfRegionsOrLess ( int   )  [virtual]

virtual int vtkKdTree::GetNumberOfRegionsOrMore (  )  [virtual]

Set/Get the number of spatial regions you want to get close to while having at least this many regions. (The number of spatial regions is normally a power of two.) Default is unset.

virtual void vtkKdTree::SetNumberOfRegionsOrMore ( int   )  [virtual]

virtual double vtkKdTree::GetFudgeFactor (  )  [virtual]

Some algorithms on k-d trees require a value that is a very small distance relative to the diameter of the entire space divided by the k-d tree. This factor is the maximum axis-aligned width of the space multipled by 10e-6.

virtual void vtkKdTree::SetFudgeFactor ( double   )  [virtual]

virtual vtkBSPCuts* vtkKdTree::GetCuts (  )  [virtual]

Get a vtkBSPCuts object, a general object representing an axis- aligned spatial partitioning. Used by vtkBSPIntersections.

void vtkKdTree::SetCuts ( vtkBSPCuts cuts  ) 

Normally the k-d tree is computed from the dataset(s) provided in SetDataSet. Alternatively, you can provide the cuts that will be applied by calling SetCuts.

void vtkKdTree::OmitXPartitioning (  ) 

Omit partitions along the X axis, yielding shafts in the X direction

void vtkKdTree::OmitYPartitioning (  ) 

Omit partitions along the Y axis, yielding shafts in the Y direction

void vtkKdTree::OmitZPartitioning (  ) 

Omit partitions along the Z axis, yielding shafts in the Z direction

void vtkKdTree::OmitXYPartitioning (  ) 

Omit partitions along the X and Y axes, yielding slabs along Z

void vtkKdTree::OmitYZPartitioning (  ) 

Omit partitions along the Y and Z axes, yielding slabs along X

void vtkKdTree::OmitZXPartitioning (  ) 

Omit partitions along the Z and X axes, yielding slabs along Y

void vtkKdTree::OmitNoPartitioning (  ) 

Partition along all three axes - this is the default

virtual void vtkKdTree::SetDataSet ( vtkDataSet set  )  [virtual]

Clear out all data sets and replace with single data set. For backward compatibility with superclass.

Reimplemented from vtkLocator.

virtual void vtkKdTree::AddDataSet ( vtkDataSet set  )  [virtual]

This class can compute a spatial decomposition based on the cells in a list of one or more input data sets. Add them one at a time with this method.

virtual void vtkKdTree::RemoveDataSet ( int  index  )  [virtual]

Remove the given data set.

virtual void vtkKdTree::RemoveDataSet ( vtkDataSet set  )  [virtual]

Remove the given data set.

virtual void vtkKdTree::RemoveAllDataSets (  )  [virtual]

Remove the given data set.

int vtkKdTree::GetNumberOfDataSets (  ) 

Get the number of data sets included in spatial paritioning

vtkDataSet* vtkKdTree::GetDataSet ( int  n  ) 

Return the n'th data set.

vtkDataSet* vtkKdTree::GetDataSet (  )  [inline, virtual]

Return the 0'th data set. For compatability with the superclass' interface.

Reimplemented from vtkLocator.

Definition at line 189 of file vtkKdTree.h.

References vtkLocator::GetDataSet().

virtual vtkDataSetCollection* vtkKdTree::GetDataSets (  )  [virtual]

Return a collection of all the data sets.

int vtkKdTree::GetDataSetIndex ( vtkDataSet set  ) 

Return the index of the given data set. Returns -1 if that data set does not exist.

void vtkKdTree::GetBounds ( double *  bounds  ) 

Get the spatial bounds of the entire k-d tree space. Sets bounds array to xmin, xmax, ymin, ymax, zmin, zmax.

void vtkKdTree::SetNewBounds ( double *  bounds  ) 

There are certain applications where you want the bounds of the k-d tree space to be at least as large as a specified box. If the k-d tree has been built, you can expand it's bounds with this method. If the bounds supplied are smaller than those computed, they will be ignored.

virtual int vtkKdTree::GetNumberOfRegions (  )  [virtual]

The number of leaf nodes of the tree, the spatial regions

void vtkKdTree::GetRegionBounds ( int  regionID,
double  bounds[6] 
)

Get the spatial bounds of k-d tree region

void vtkKdTree::GetRegionDataBounds ( int  regionID,
double  bounds[6] 
)

Get the bounds of the data within the k-d tree region

void vtkKdTree::PrintTree (  ) 

Print out nodes of kd tree

void vtkKdTree::PrintVerboseTree (  ) 

Print out nodes of kd tree

void vtkKdTree::PrintRegion ( int  id  ) 

Print out leaf node data for given id

void vtkKdTree::CreateCellLists ( int  dataSetIndex,
int *  regionReqList,
int  reqListSize 
)

Create a list for each of the requested regions, listing the IDs of all cells whose centroid falls in the region. These lists are obtained with GetCellList(). If no DataSet is specified, the cell list is created for DataSet 0. If no list of requested regions is provided, the cell lists for all regions are created. When CreateCellLists is called again, the lists created on the previous call are deleted.

void vtkKdTree::CreateCellLists ( vtkDataSet set,
int *  regionReqList,
int  reqListSize 
)

void vtkKdTree::CreateCellLists ( int *  regionReqList,
int  listSize 
)

void vtkKdTree::CreateCellLists (  ) 

virtual void vtkKdTree::SetIncludeRegionBoundaryCells ( int   )  [virtual]

If IncludeRegionBoundaryCells is ON, CreateCellLists() will also create a list of cells which intersect a given region, but are not assigned to the region. These lists are obtained with GetBoundaryCellList(). Default is OFF.

virtual int vtkKdTree::GetIncludeRegionBoundaryCells (  )  [virtual]

If IncludeRegionBoundaryCells is ON, CreateCellLists() will also create a list of cells which intersect a given region, but are not assigned to the region. These lists are obtained with GetBoundaryCellList(). Default is OFF.

virtual void vtkKdTree::IncludeRegionBoundaryCellsOn (  )  [virtual]

If IncludeRegionBoundaryCells is ON, CreateCellLists() will also create a list of cells which intersect a given region, but are not assigned to the region. These lists are obtained with GetBoundaryCellList(). Default is OFF.

virtual void vtkKdTree::IncludeRegionBoundaryCellsOff (  )  [virtual]

If IncludeRegionBoundaryCells is ON, CreateCellLists() will also create a list of cells which intersect a given region, but are not assigned to the region. These lists are obtained with GetBoundaryCellList(). Default is OFF.

void vtkKdTree::DeleteCellLists (  ) 

Free the memory used by the cell lists.

vtkIdList* vtkKdTree::GetCellList ( int  regionID  ) 

Get the cell list for a region. This returns a pointer to vtkKdTree's memory, so don't free it.

vtkIdList* vtkKdTree::GetBoundaryCellList ( int  regionID  ) 

The cell list obtained with GetCellList is the list of all cells such that their centroid is contained in the spatial region. It may also be desirable to get a list of all cells intersecting a spatial region, but with centroid in some other region. This is that list. This list is computed in CreateCellLists() if and only if IncludeRegionBoundaryCells is ON. This returns a pointer to KdTree's memory, so don't free it.

vtkIdType vtkKdTree::GetCellLists ( vtkIntArray regions,
int  set,
vtkIdList inRegionCells,
vtkIdList onBoundaryCells 
)

For a list of regions, get two cell lists. The first lists the IDs all cells whose centroids lie in one of the regions. The second lists the IDs of all cells that intersect the regions, but whose centroid lies in a region not on the list. The total number of cell IDs written to both lists is returned. Either list pointer passed in can be NULL, and it will be ignored. If there are multiple data sets, you must specify which data set you wish cell IDs for. The caller should delete these two lists when done. This method uses the cell lists created in CreateCellLists(). If the cell list for any of the requested regions does not exist, then this method will call CreateCellLists() to create cell lists for *every* region of the k-d tree. You must remember to DeleteCellLists() when done with all calls to this method, as cell lists can require a great deal of memory.

vtkIdType vtkKdTree::GetCellLists ( vtkIntArray regions,
vtkDataSet set,
vtkIdList inRegionCells,
vtkIdList onBoundaryCells 
)

For a list of regions, get two cell lists. The first lists the IDs all cells whose centroids lie in one of the regions. The second lists the IDs of all cells that intersect the regions, but whose centroid lies in a region not on the list. The total number of cell IDs written to both lists is returned. Either list pointer passed in can be NULL, and it will be ignored. If there are multiple data sets, you must specify which data set you wish cell IDs for. The caller should delete these two lists when done. This method uses the cell lists created in CreateCellLists(). If the cell list for any of the requested regions does not exist, then this method will call CreateCellLists() to create cell lists for *every* region of the k-d tree. You must remember to DeleteCellLists() when done with all calls to this method, as cell lists can require a great deal of memory.

vtkIdType vtkKdTree::GetCellLists ( vtkIntArray regions,
vtkIdList inRegionCells,
vtkIdList onBoundaryCells 
)

For a list of regions, get two cell lists. The first lists the IDs all cells whose centroids lie in one of the regions. The second lists the IDs of all cells that intersect the regions, but whose centroid lies in a region not on the list. The total number of cell IDs written to both lists is returned. Either list pointer passed in can be NULL, and it will be ignored. If there are multiple data sets, you must specify which data set you wish cell IDs for. The caller should delete these two lists when done. This method uses the cell lists created in CreateCellLists(). If the cell list for any of the requested regions does not exist, then this method will call CreateCellLists() to create cell lists for *every* region of the k-d tree. You must remember to DeleteCellLists() when done with all calls to this method, as cell lists can require a great deal of memory.

int vtkKdTree::GetRegionContainingCell ( vtkDataSet set,
vtkIdType  cellID 
)

Get the id of the region containing the cell centroid. If no DataSet is specified, assume DataSet 0. If you need the region ID for every cell, use AllGetRegionContainingCell instead. It is more efficient.

int vtkKdTree::GetRegionContainingCell ( int  set,
vtkIdType  cellID 
)

Get the id of the region containing the cell centroid. If no DataSet is specified, assume DataSet 0. If you need the region ID for every cell, use AllGetRegionContainingCell instead. It is more efficient.

int vtkKdTree::GetRegionContainingCell ( vtkIdType  cellID  ) 

Get the id of the region containing the cell centroid. If no DataSet is specified, assume DataSet 0. If you need the region ID for every cell, use AllGetRegionContainingCell instead. It is more efficient.

int* vtkKdTree::AllGetRegionContainingCell (  ) 

Get a list (in order by data set by cell id) of the region IDs of the region containing the centroid for each cell. This is faster than calling GetRegionContainingCell for each cell in the DataSet. vtkKdTree uses this list, so don't delete it.

int vtkKdTree::GetRegionContainingPoint ( double  x,
double  y,
double  z 
)

Get the id of the region containing the specified location.

void vtkKdTree::BuildLocator (  )  [virtual]

Create the k-d tree decomposition of the cells of the data set or data sets. Cells are assigned to k-d tree spatial regions based on the location of their centroids.

Implements vtkLocator.

Reimplemented in vtkPKdTree.

int vtkKdTree::MinimalNumberOfConvexSubRegions ( vtkIntArray regionIdList,
double **  convexRegionBounds 
)

Given a list of region IDs, determine the decomposition of these regions into the minimal number of convex subregions. Due to the way the k-d tree is constructed, those convex subregions will be axis-aligned boxes. Return the minimal number of such convex regions that compose the original region list. This call will set convexRegionBounds to point to a list of the bounds of these regions. Caller should free this. There will be six values for each convex subregion (xmin, xmax, ymin, ymax, zmin, zmax). If the regions in the regionIdList form a box already, a "1" is returned and the s