VTK  9.1.0
vtkKdTree.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkKdTree.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*----------------------------------------------------------------------------
16 Copyright (c) Sandia Corporation
17 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18----------------------------------------------------------------------------*/
19
65#ifndef vtkKdTree_h
66#define vtkKdTree_h
67
68#include "vtkCommonDataModelModule.h" // For export macro
69#include "vtkLocator.h"
70
71class vtkTimerLog;
72class vtkIdList;
73class vtkIdTypeArray;
74class vtkIntArray;
75class vtkPointSet;
76class vtkPoints;
77class vtkCellArray;
78class vtkCell;
79class vtkKdNode;
80class vtkBSPCuts;
83
84class VTKCOMMONDATAMODEL_EXPORT vtkKdTree : public vtkLocator
85{
86public:
87 vtkTypeMacro(vtkKdTree, vtkLocator);
88 void PrintSelf(ostream& os, vtkIndent indent) override;
89
90 static vtkKdTree* New();
91
93
96 vtkBooleanMacro(Timing, vtkTypeBool);
97 vtkSetMacro(Timing, vtkTypeBool);
98 vtkGetMacro(Timing, vtkTypeBool);
100
102
105 vtkSetMacro(MinCells, int);
106 vtkGetMacro(MinCells, int);
108
116 vtkGetMacro(NumberOfRegionsOrLess, int);
117 vtkSetMacro(NumberOfRegionsOrLess, int);
118
126 vtkGetMacro(NumberOfRegionsOrMore, int);
127 vtkSetMacro(NumberOfRegionsOrMore, int);
128
136 vtkGetMacro(FudgeFactor, double);
137 vtkSetMacro(FudgeFactor, double);
138
144 vtkGetObjectMacro(Cuts, vtkBSPCuts);
145
152 void SetCuts(vtkBSPCuts* cuts);
153
158
163
168
173
178
183
188
203 void SetDataSet(vtkDataSet* set) override;
204
209 virtual void AddDataSet(vtkDataSet* set);
210
212
215 virtual void RemoveDataSet(int index);
216 virtual void RemoveDataSet(vtkDataSet* set);
217 virtual void RemoveAllDataSets();
219
224
235
240 vtkDataSet* GetDataSet() override { return this->GetDataSet(0); }
241
243
246 vtkGetObjectMacro(DataSets, vtkDataSetCollection);
248
254
259 void GetBounds(double* bounds);
260
269 void SetNewBounds(double* bounds);
270
272
275 vtkGetMacro(NumberOfRegions, int);
277
281 void GetRegionBounds(int regionID, double bounds[6]);
282
286 void GetRegionDataBounds(int regionID, double bounds[6]);
287
289
292 void PrintTree();
295
299 void PrintRegion(int id);
300
313 void CreateCellLists(int dataSetIndex, int* regionReqList, int reqListSize);
314 void CreateCellLists(vtkDataSet* set, int* regionReqList, int reqListSize);
315 void CreateCellLists(int* regionReqList, int listSize);
317
319
326 vtkSetMacro(IncludeRegionBoundaryCells, vtkTypeBool);
327 vtkGetMacro(IncludeRegionBoundaryCells, vtkTypeBool);
328 vtkBooleanMacro(IncludeRegionBoundaryCells, vtkTypeBool);
330
335
340 vtkIdList* GetCellList(int regionID);
341
353
355
376 vtkIntArray* regions, int set, vtkIdList* inRegionCells, vtkIdList* onBoundaryCells);
378 vtkIntArray* regions, vtkDataSet* set, vtkIdList* inRegionCells, vtkIdList* onBoundaryCells);
380 vtkIntArray* regions, vtkIdList* inRegionCells, vtkIdList* onBoundaryCells);
382
384
391 int GetRegionContainingCell(int set, vtkIdType cellID);
394
404
408 int GetRegionContainingPoint(double x, double y, double z);
409
415 void BuildLocator() override;
416
431 int MinimalNumberOfConvexSubRegions(vtkIntArray* regionIdList, double** convexRegionBounds);
432
441 const double directionOfProjection[3], vtkIntArray* orderedList);
442
451 vtkIntArray* regionIds, const double directionOfProjection[3], vtkIntArray* orderedList);
452
461 const double directionOfProjection[3], vtkIntArray* orderedList);
462
471 vtkIntArray* regionIds, const double directionOfProjection[3], vtkIntArray* orderedList);
472
474
489 void BuildLocatorFromPoints(vtkPoints** ptArray, int numPtArrays);
491
507
509
515 vtkIdType FindPoint(double x, double y, double z);
517
519
524 vtkIdType FindClosestPoint(double* x, double& dist2);
525 vtkIdType FindClosestPoint(double x, double y, double z, double& dist2);
527
533 vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double& dist2);
534
536
541 vtkIdType FindClosestPointInRegion(int regionId, double* x, double& dist2);
542 vtkIdType FindClosestPointInRegion(int regionId, double x, double y, double z, double& dist2);
544
551 void FindPointsWithinRadius(double R, const double x[3], vtkIdList* result);
552
561 void FindClosestNPoints(int N, const double x[3], vtkIdList* result);
562
568
573 void FreeSearchStructure() override;
574
580 void GenerateRepresentation(int level, vtkPolyData* pd) override;
581
586 void GenerateRepresentation(int* regionList, int len, vtkPolyData* pd);
587
589
595 vtkBooleanMacro(GenerateRepresentationUsingDataBounds, vtkTypeBool);
596 vtkSetMacro(GenerateRepresentationUsingDataBounds, vtkTypeBool);
597 vtkGetMacro(GenerateRepresentationUsingDataBounds, vtkTypeBool);
599
603 virtual void PrintTiming(ostream& os, vtkIndent indent);
604
609 virtual int NewGeometry();
610
616 virtual int NewGeometry(vtkDataSet** sets, int numDataSets);
617
623 virtual void InvalidateGeometry();
624
631
638 void FindPointsInArea(double* area, vtkIdTypeArray* ids, bool clearArray = true);
639
640protected:
642 ~vtkKdTree() override;
643
646
648
649 int ProcessUserDefinedCuts(double* bounds);
650
651 void SetCuts(vtkBSPCuts* cuts, int userDefined);
652
659
667 int DivideTest(int numberOfPoints, int level);
668
669 enum
670 {
671 XDIM = 0, // don't change these values
672 YDIM = 1,
673 ZDIM = 2
674 };
675
677
679 vtkKdNode** RegionList; // indexed by region ID
680
682
684
687 void SetActualLevel() { this->Level = vtkKdTree::ComputeLevel(this->Top); }
688
695
701 static void GetLeafNodeIds(vtkKdNode* node, vtkIntArray* ids);
702
708
714 int GetDataSetsNumberOfCells(int set1, int set2);
715
722 void ComputeCellCenter(vtkDataSet* set, int cellId, float* center);
723 void ComputeCellCenter(vtkDataSet* set, int cellId, double* center);
724
735 float* ComputeCellCenters(int set);
737
739
745 void UpdateProgress(double amount);
746
748
751 vtkSetClampMacro(Progress, double, 0.0, 1.0);
752 vtkGetMacro(Progress, double);
754
755protected:
756 // So that each suboperation can report progress
757 // in [0,1], yet we will be able to report a global
758 // progress. Sub-operations must use UpdateSubOperationProgress()
759 // for this to work.
762
763 // Update progress for a sub-operation. \c amount goes from 0.0 to 1.0.
764 // Actual progress is given by
765 // (this->ProgressOffset + this->ProgressScale* amount).
766 void UpdateSubOperationProgress(double amount);
767
768 static void _SetNewBounds(vtkKdNode* kd, double* b, int* fixDim);
769 static void CopyChildNodes(vtkKdNode* to, vtkKdNode* from);
770 static void CopyKdNode(vtkKdNode* to, vtkKdNode* from);
773
774 // Recursive helper for public FindPointsWithinRadius
775 void FindPointsWithinRadius(vtkKdNode* node, double R2, const double x[3], vtkIdList* ids);
776
777 // Recursive helper for public FindPointsWithinRadius
779
780 // Recursive helper for public FindPointsInArea
781 void FindPointsInArea(vtkKdNode* node, double* area, vtkIdTypeArray* ids);
782
783 // Recursive helper for public FindPointsInArea
785
786 int DivideRegion(vtkKdNode* kd, float* c1, int* ids, int nlevels);
787
788 void DoMedianFind(vtkKdNode* kd, float* c1, int* ids, int d1, int d2, int d3);
789
791
793 {
794 vtkDataSet* dataSet; // cell lists for which data set
795 int* regionIds; // nullptr if listing all regions
800 };
801
803 vtkIdList* GetList(int regionId, vtkIdList** which);
804
805 void ComputeCellCenter(vtkCell* cell, double* center, double* weights);
806
809 vtkKdNode* kd, vtkPoints* pts, vtkCellArray* polys, int level);
810
813 vtkKdNode* kd, vtkPoints* pts, vtkCellArray* polys, int level);
814
815 void AddPolys(vtkKdNode* kd, vtkPoints* pts, vtkCellArray* polys);
816
817 void _printTree(int verbose);
818
820 int regionId, float* point, int** pointsSoFar, int* len, float tolerance, float tolerance2);
821
822 int SearchRegionForDuplicate(float* point, int* pointsSoFar, int len, float tolerance2);
823
824 int _FindClosestPointInRegion(int regionId, double x, double y, double z, double& dist2);
825
827 double x, double y, double z, double radius, int skipRegion, double& dist2);
828
830 vtkIntArray* IdsOfInterest, const double dop[3], vtkIntArray* orderedList);
831
833 vtkIntArray* IdsOfInterest, const double dir[3], int nextId);
834
836 vtkIntArray* IdsOfInterest, const double pos[3], vtkIntArray* orderedList);
837
839 vtkIntArray* IdsOfInterest, const double pos[3], int nextId);
840
841 static int __ConvexSubRegions(int* ids, int len, vtkKdNode* tree, vtkKdNode** nodes);
842 static int FoundId(vtkIntArray* idArray, int id);
843
844 void SetInputDataInfo(int i, int dims[3], double origin[3], double spacing[3]);
845 int CheckInputDataInfo(int i, int dims[3], double origin[3], double spacing[3]);
847
848 static void __printTree(vtkKdNode* kd, int depth, int verbose);
849
850 static int MidValue(int dim, float* c1, int nvals, double& coord);
851
852 static int Select(int dim, float* c1, int* ids, int nvals, double& coord);
853 static float FindMaxLeftHalf(int dim, float* c1, int K);
854 static void _Select(int dim, float* X, int* ids, int L, int R, int K);
855
856 static int ComputeLevel(vtkKdNode* kd);
857 static int SelfOrder(int id, vtkKdNode* kd);
858 static int findRegion(vtkKdNode* node, float x, float y, float z);
859 static int findRegion(vtkKdNode* node, double x, double y, double z);
860
862
863 static void AddNewRegions(vtkKdNode* kd, float* c1, int midpt, int dim, double coord);
864
866
869
871 double CellBoundsCache[6]; // to optimize IntersectsCell()
872
874
875 struct _cellList CellList;
876
877 // Region Ids, by data set by cell id - this list is large (one
878 // int per cell) but accelerates creation of cell lists
879
881
883 int NumberOfRegions; // number of leaf nodes
884
886 double FudgeFactor; // a very small distance, relative to the dataset's size
887
888 // These instance variables are used by the special locator created
889 // to find duplicate points. (BuildLocatorFromPoints)
890
895
896 float MaxWidth;
897
898 // These Last* values are here to save state so we can
899 // determine later if k-d tree must be rebuilt.
900
907 double* LastBounds;
910
912 double Progress;
913
914 vtkKdTree(const vtkKdTree&) = delete;
915 void operator=(const vtkKdTree&) = delete;
916};
917#endif
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:45
Perform calculations (mostly intersection calculations) on regions of a 3D binary spatial partitionin...
object to represent cell connectivity
Definition: vtkCellArray.h:190
abstract class to specify cell behavior
Definition: vtkCell.h:67
maintain an unordered list of dataset objects
abstract class to specify dataset behavior
Definition: vtkDataSet.h:66
list of point or cell ids
Definition: vtkIdList.h:40
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:43
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning.
Definition: vtkKdNode.h:43
a Kd-tree spatial decomposition of a set of points
Definition: vtkKdTree.h:85
void SelfRegister(vtkKdNode *kd)
vtkIdList * GetBoundaryCellList(int regionID)
The cell list obtained with GetCellList is the list of all cells such that their centroid is containe...
void NewPartitioningRequest(int req)
void SetInputDataInfo(int i, int dims[3], double origin[3], double spacing[3])
virtual void RemoveAllDataSets()
Remove the given data set.
static void __printTree(vtkKdNode *kd, int depth, int verbose)
int * LastDataSetType
Definition: vtkKdTree.h:905
vtkTypeBool Timing
Definition: vtkKdTree.h:885
vtkIdTypeArray * GetPointsInRegion(int regionId)
Get a list of the original IDs of all points in a region.
int DivideRegion(vtkKdNode *kd, float *c1, int *ids, int nlevels)
static void CopyKdNode(vtkKdNode *to, vtkKdNode *from)
static void _SetNewBounds(vtkKdNode *kd, double *b, int *fixDim)
int MinimalNumberOfConvexSubRegions(vtkIntArray *regionIdList, double **convexRegionBounds)
Given a list of region IDs, determine the decomposition of these regions into the minimal number of c...
vtkDataSetCollection * DataSets
Definition: vtkKdTree.h:738
static vtkKdNode ** _GetRegionsAtLevel(int level, vtkKdNode **nodes, vtkKdNode *kd)
void CreateCellLists(int *regionReqList, int listSize)
int ValidDirections
Definition: vtkKdTree.h:676
vtkIdType FindPoint(double x, double y, double z)
Find the Id of the point that was previously supplied to BuildLocatorFromPoints().
int NumberOfRegions
Definition: vtkKdTree.h:883
int GetRegionContainingCell(vtkIdType cellID)
Get the id of the region containing the cell centroid.
void GetRegionDataBounds(int regionID, double bounds[6])
Get the bounds of the data within the k-d tree region.
void InitializeCellLists()
virtual void InvalidateGeometry()
Forget about the last geometry used.
void OmitYZPartitioning()
Omit partitions along the Y and Z axes, yielding slabs along X.
vtkTypeBool IncludeRegionBoundaryCells
Definition: vtkKdTree.h:870
static int SelfOrder(int id, vtkKdNode *kd)
void OmitZXPartitioning()
Omit partitions along the Z and X axes, yielding slabs along Y.
vtkIdType GetCellLists(vtkIntArray *regions, vtkDataSet *set, vtkIdList *inRegionCells, vtkIdList *onBoundaryCells)
For a list of regions, get two cell lists.
int LastDataCacheSize
Definition: vtkKdTree.h:902
float MaxWidth
Definition: vtkKdTree.h:896
vtkIdType GetCellLists(vtkIntArray *regions, int set, vtkIdList *inRegionCells, vtkIdList *onBoundaryCells)
For a list of regions, get two cell lists.
void BuildRegionList()
int _ViewOrderRegionsInDirection(vtkIntArray *IdsOfInterest, const double dop[3], vtkIntArray *orderedList)
void OmitNoPartitioning()
Partition along all three axes - this is the default.
void _printTree(int verbose)
int GetNumberOfCells()
Returns the total number of cells in all the data sets.
void GenerateRepresentationDataBounds(int level, vtkPolyData *pd)
vtkDataSet * GetDataSet(int n)
Get the nth defined data set in the spatial partitioning.
float * ComputeCellCenters(int set)
vtkIdTypeArray * BuildMapForDuplicatePoints(float tolerance)
This call returns a mapping from the original point IDs supplied to BuildLocatorFromPoints to a subse...
void SetDataSet(vtkDataSet *set) override
This class can compute a spatial decomposition based on the cells in a list of one or more input data...
int NumberOfRegionsOrLess
Definition: vtkKdTree.h:867
static int Select(int dim, float *c1, int *ids, int nvals, double &coord)
void UpdateSubOperationProgress(double amount)
void CreateCellLists()
vtkDataSet ** LastInputDataSets
Definition: vtkKdTree.h:903
void ComputeCellCenter(vtkCell *cell, double *center, double *weights)
double * LastInputDataInfo
Definition: vtkKdTree.h:906
static vtkKdNode * CopyTree(vtkKdNode *kd)
Create a copy of the binary tree representation of the k-d tree spatial partitioning provided.
vtkBSPCuts * Cuts
Definition: vtkKdTree.h:911
vtkBSPIntersections * BSPCalculator
Definition: vtkKdTree.h:644
void SetCuts(vtkBSPCuts *cuts, int userDefined)
vtkKdNode ** RegionList
Definition: vtkKdTree.h:679
int SearchNeighborsForDuplicate(int regionId, float *point, int **pointsSoFar, int *len, float tolerance, float tolerance2)
void GenerateRepresentation(int level, vtkPolyData *pd) override
Create a polydata representation of the boundaries of the k-d tree regions.
void AddAllPointsInRegion(vtkKdNode *node, vtkIdList *ids)
int LastNumDataSets
Definition: vtkKdTree.h:901
static float FindMaxLeftHalf(int dim, float *c1, int K)
int * LocatorRegionLocation
Definition: vtkKdTree.h:894
void 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...
void PrintTree()
Print out nodes of kd tree.
void FreeSearchStructure() override
Delete the k-d tree data structure.
virtual void RemoveDataSet(vtkDataSet *set)
Remove the given data set.
int CheckInputDataInfo(int i, int dims[3], double origin[3], double spacing[3])
virtual int NewGeometry(vtkDataSet **sets, int numDataSets)
Return 1 if the geometry of these data sets differs for the geometry of the last data sets used to bu...
static int findRegion(vtkKdNode *node, float x, float y, float z)
void DeleteCellLists()
Free the memory used by the cell lists.
vtkIdType * LastNumPoints
Definition: vtkKdTree.h:908
void _generateRepresentationWholeSpace(vtkKdNode *kd, vtkPoints *pts, vtkCellArray *polys, int level)
void ClearLastBuildCache()
vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2)
Given a position x and a radius r, return the id of the point closest to the point in that radius.
void OmitYPartitioning()
Omit partitions along the Y axis, yielding shafts in the Y direction.
void GetBounds(double *bounds)
Get the spatial bounds of the entire k-d tree space.
int NumberOfLocatorPoints
Definition: vtkKdTree.h:891
static void SetDataBoundsToSpatialBounds(vtkKdNode *kd)
static void CopyChildNodes(vtkKdNode *to, vtkKdNode *from)
static void _Select(int dim, float *X, int *ids, int L, int R, int K)
float * ComputeCellCenters(vtkDataSet *set)
double * LastBounds
Definition: vtkKdTree.h:907
int GetNumberOfDataSets()
Get the number of data sets included in spatial partitioning.
static int ComputeLevel(vtkKdNode *kd)
int GetRegionContainingCell(int set, vtkIdType cellID)
Get the id of the region containing the cell centroid.
static vtkKdTree * New()
static int findRegion(vtkKdNode *node, double x, double y, double z)
void UpdateProgress(double amount)
Modelled on vtkAlgorithm::UpdateProgress().
void FindPointsWithinRadius(double R, const double x[3], vtkIdList *result)
Find all points within a specified radius R of position x.
vtkDataSet * GetDataSet() override
Return the 0'th data set.
Definition: vtkKdTree.h:240
int NumberOfRegionsOrMore
Definition: vtkKdTree.h:868
void SetNewBounds(double *bounds)
There are certain applications where you want the bounds of the k-d tree space to be at least as larg...
int ProcessUserDefinedCuts(double *bounds)
static void AddNewRegions(vtkKdNode *kd, float *c1, int midpt, int dim, double coord)
static int __ViewOrderRegionsInDirection(vtkKdNode *node, vtkIntArray *list, vtkIntArray *IdsOfInterest, const double dir[3], int nextId)
static int FoundId(vtkIntArray *idArray, int id)
double ProgressScale
Definition: vtkKdTree.h:760
void OmitZPartitioning()
Omit partitions along the Z axis, yielding shafts in the Z direction.
void AddAllPointsInRegion(vtkKdNode *node, vtkIdTypeArray *ids)
void GenerateRepresentation(int *regionList, int len, vtkPolyData *pd)
Generate a polygonal representation of a list of regions.
int * LocatorIds
Definition: vtkKdTree.h:893
int ViewOrderRegionsInDirection(vtkIntArray *regionIds, const double directionOfProjection[3], vtkIntArray *orderedList)
Given a direction of projection and a list of k-d tree region IDs, this method, creates a list of the...
void FindPointsWithinRadius(vtkKdNode *node, double R2, const double x[3], vtkIdList *ids)
double ProgressOffset
Definition: vtkKdTree.h:761
void ComputeCellCenter(vtkDataSet *set, int cellId, double *center)
void BuildLocatorFromPoints(vtkPoints **ptArray, int numPtArrays)
This is a special purpose locator that builds a k-d tree to find duplicate and near-by points.
void operator=(const vtkKdTree &)=delete
void BuildLocator() override
Create the k-d tree decomposition of the cells of the data set or data sets.
int _ViewOrderRegionsFromPosition(vtkIntArray *IdsOfInterest, const double pos[3], vtkIntArray *orderedList)
void SetActualLevel()
Definition: vtkKdTree.h:687
void _generateRepresentationDataBounds(vtkKdNode *kd, vtkPoints *pts, vtkCellArray *polys, int level)
void BuildLocatorFromPoints(vtkPointSet *pointset)
This is a special purpose locator that builds a k-d tree to find duplicate and near-by points.
void PrintVerboseTree()
Print out nodes of kd tree.
vtkIdType FindClosestPointInRegion(int regionId, double *x, double &dist2)
Find the Id of the point in the given region which is closest to the given point.
vtkIdType FindClosestPoint(double *x, double &dist2)
Find the Id of the point that was previously supplied to BuildLocatorFromPoints() which is closest to...
double Progress
Definition: vtkKdTree.h:912
static int MidValue(int dim, float *c1, int nvals, double &coord)
int UserDefinedCuts
Definition: vtkKdTree.h:645
virtual int SelectCutDirection(vtkKdNode *kd)
~vtkKdTree() override
vtkIdType FindClosestPoint(double x, double y, double z, double &dist2)
Find the Id of the point that was previously supplied to BuildLocatorFromPoints() which is closest to...
vtkTypeBool GenerateRepresentationUsingDataBounds
Definition: vtkKdTree.h:873
static int __ViewOrderRegionsFromPosition(vtkKdNode *node, vtkIntArray *list, vtkIntArray *IdsOfInterest, const double pos[3], int nextId)
int MinCells
Definition: vtkKdTree.h:882
virtual void AddDataSet(vtkDataSet *set)
This class can compute a spatial decomposition based on the cells in a list of one or more input data...
int ViewOrderRegionsFromPosition(vtkIntArray *regionIds, const double directionOfProjection[3], vtkIntArray *orderedList)
Given a camera position and a list of k-d tree region IDs, this method, creates a list of the k-d tre...
double FudgeFactor
Definition: vtkKdTree.h:886
void ComputeCellCenter(vtkDataSet *set, int cellId, float *center)
Get or compute the center of one cell.
void CreateCellLists(vtkDataSet *set, int *regionReqList, int reqListSize)
virtual void PrintTiming(ostream &os, vtkIndent indent)
Print timing of k-d tree build.
void FindPointsInArea(vtkKdNode *node, double *area, vtkIdTypeArray *ids)
void UpdateBuildTime()
Save enough state so NewGeometry() can work, and update the BuildTime time stamp.
virtual int NewGeometry()
Return 1 if the geometry of the input data sets has changed since the last time the k-d tree was buil...
int FindClosestPointInSphere(double x, double y, double z, double radius, int skipRegion, double &dist2)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetCalculator(vtkKdNode *kd)
vtkKdTree(const vtkKdTree &)=delete
int GetRegionContainingCell(vtkDataSet *set, vtkIdType cellID)
Get the id of the region containing the cell centroid.
int ViewOrderAllRegionsFromPosition(const double directionOfProjection[3], vtkIntArray *orderedList)
Given a camera position (typically obtained with vtkCamera::GetPosition()), this method,...
vtkTimerLog * TimerLog
Definition: vtkKdTree.h:681
vtkIdList * GetCellList(int regionID)
Get the cell list for a region.
void GetRegionsAtLevel(int level, vtkKdNode **nodes)
Get back a list of the nodes at a specified level, nodes must be preallocated to hold 2^^(level) node...
unsigned long * LastDataSetObserverTags
Definition: vtkKdTree.h:904
void OmitXPartitioning()
Omit partitions along the X axis, yielding shafts in the X direction.
int * AllGetRegionContainingCell()
Get a list (in order by data set by cell id) of the region IDs of the region containing the centroid ...
static void GetLeafNodeIds(vtkKdNode *node, vtkIntArray *ids)
Adds to the vtkIntArray the list of region IDs of all leaf nodes in the given node.
int * CellRegionList
Definition: vtkKdTree.h:880
int ViewOrderAllRegionsInDirection(const double directionOfProjection[3], vtkIntArray *orderedList)
Given a direction of projection (typically obtained with vtkCamera::GetDirectionOfProjection()),...
static int __ConvexSubRegions(int *ids, int len, vtkKdNode *tree, vtkKdNode **nodes)
int _FindClosestPointInRegion(int regionId, double x, double y, double z, double &dist2)
void DoMedianFind(vtkKdNode *kd, float *c1, int *ids, int d1, int d2, int d3)
void PrintRegion(int id)
Print out leaf node data for given id.
vtkIdType FindClosestPointInRegion(int regionId, double x, double y, double z, double &dist2)
Find the Id of the point in the given region which is closest to the given point.
int DivideTest(int numberOfPoints, int level)
Prior to dividing a region at level "level", of size "numberOfPoints", apply the tests implied by Min...
virtual void RemoveDataSet(int index)
Remove the given data set.
void OmitXYPartitioning()
Omit partitions along the X and Y axes, yielding slabs along Z.
void BuildLocatorFromPoints(vtkPoints *ptArray)
This is a special purpose locator that builds a k-d tree to find duplicate and near-by points.
void GenerateRepresentationWholeSpace(int level, vtkPolyData *pd)
vtkIdList * GetList(int regionId, vtkIdList **which)
int SearchRegionForDuplicate(float *point, int *pointsSoFar, int len, float tolerance2)
static void DeleteAllDescendants(vtkKdNode *nd)
void AddPolys(vtkKdNode *kd, vtkPoints *pts, vtkCellArray *polys)
vtkIdType FindPoint(double *x)
Find the Id of the point that was previously supplied to BuildLocatorFromPoints().
vtkIdType GetCellLists(vtkIntArray *regions, vtkIdList *inRegionCells, vtkIdList *onBoundaryCells)
For a list of regions, get two cell lists.
vtkIdType * LastNumCells
Definition: vtkKdTree.h:909
void GetRegionBounds(int regionID, double bounds[6])
Get the spatial bounds of k-d tree region.
int GetRegionContainingPoint(double x, double y, double z)
Get the id of the region containing the specified location.
int GetDataSetsNumberOfCells(int set1, int set2)
Returns the total number of cells in data set 1 through data set 2.
void SetCuts(vtkBSPCuts *cuts)
Normally the k-d tree is computed from the dataset(s) provided in SetDataSet.
void FindPointsInArea(double *area, vtkIdTypeArray *ids, bool clearArray=true)
Fill ids with points found in area.
void FindClosestNPoints(int N, const double x[3], vtkIdList *result)
Find the closest N points to a position.
static void ZeroNumberOfPoints(vtkKdNode *kd)
float * ComputeCellCenters()
Compute and return a pointer to a list of all cell centers, in order by data set by cell Id.
vtkKdNode * Top
Definition: vtkKdTree.h:678
int GetDataSetIndex(vtkDataSet *set)
Return the index of the given data set.
float * LocatorPoints
Definition: vtkKdTree.h:892
abstract base class for objects that accelerate spatial searches
Definition: vtkLocator.h:79
concrete class for storing a set of points
Definition: vtkPointSet.h:76
represent and manipulate 3D points
Definition: vtkPoints.h:43
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
Timer support and logging.
Definition: vtkTimerLog.h:99
@ point
Definition: vtkX3D.h:242
@ level
Definition: vtkX3D.h:401
@ dir
Definition: vtkX3D.h:330
@ center
Definition: vtkX3D.h:236
@ spacing
Definition: vtkX3D.h:487
@ radius
Definition: vtkX3D.h:258
@ index
Definition: vtkX3D.h:252
vtkIdList ** boundaryCells
Definition: vtkKdTree.h:798
vtkIdList * emptyList
Definition: vtkKdTree.h:799
vtkIdList ** cells
Definition: vtkKdTree.h:797
vtkDataSet * dataSet
Definition: vtkKdTree.h:794
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332