VTK
vtkOctreePointLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOctreePointLocator.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 
39 #ifndef vtkOctreePointLocator_h
40 #define vtkOctreePointLocator_h
41 
42 #include "vtkCommonDataModelModule.h" // For export macro
44 
45 class vtkCellArray;
46 class vtkIdTypeArray;
48 class vtkPoints;
49 class vtkPolyData;
50 
52 {
53 public:
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
58 
60 
61  vtkSetMacro(MaximumPointsPerRegion, int);
62  vtkGetMacro(MaximumPointsPerRegion, int);
64 
66 
67  vtkSetMacro(CreateCubicOctants, int);
68  vtkGetMacro(CreateCubicOctants, int);
70 
72 
76  vtkGetMacro(FudgeFactor, double);
77  vtkSetMacro(FudgeFactor, double);
79 
81 
83  virtual double *GetBounds();
84  virtual void GetBounds(double *bounds);
86 
88 
89  vtkGetMacro(NumberOfLeafNodes, int);
91 
93  void GetRegionBounds(int regionID, double bounds[6]);
94 
96  void GetRegionDataBounds(int leafNodeID, double bounds[6]);
97 
99  int GetRegionContainingPoint(double x, double y, double z);
100 
104  virtual void BuildLocator();
105 
107 
109  virtual vtkIdType FindClosestPoint(const double x[3]);
110  vtkIdType FindClosestPoint(double x, double y, double z, double &dist2);
112 
114 
118  double radius, const double x[3], double& dist2);
120 
122 
125  vtkIdType FindClosestPointInRegion(int regionId, double *x, double &dist2);
126  vtkIdType FindClosestPointInRegion(int regionId, double x, double y,
127  double z, double &dist2);
129 
131 
134  double radius, const double x[3], vtkIdList *result);
136 
143  void FindClosestNPoints(int N, const double x[3], vtkIdList *result);
144 
147 
149  virtual void FreeSearchStructure();
150 
154 
159  void FindPointsInArea(double* area, vtkIdTypeArray* ids, bool clearArray = true);
160 
161 protected:
162 
165 
167  vtkOctreePointLocatorNode **LeafNodeList; // indexed by region/node ID
168 
170 
172 
174  int FindRegion(vtkOctreePointLocatorNode* node, float x, float y, float z);
175  int FindRegion(vtkOctreePointLocatorNode* node, double x, double y, double z);
177 
179 
181 
182 //BTX
184 
187  void FindPointsWithinRadius(vtkOctreePointLocatorNode* node, double radiusSquared,
188  const double x[3], vtkIdList* ids);
190 
191  // Recursive helper for public FindPointsWithinRadius
193 
194  // Recursive helper for public FindPointsInArea
196 
197  // Recursive helper for public FindPointsInArea
199 
200  void DivideRegion(vtkOctreePointLocatorNode *node, int* ordering, int level);
201 
202  int DivideTest(int size, int level);
203 
204 //ETX
205 
207 
209 
211  int _FindClosestPointInRegion(int leafNodeId, double x, double y,
212  double z, double &dist2);
214 
216 
221  int FindClosestPointInSphere(double x, double y, double z, double radius,
222  int skipRegion, double &dist2);
224 
226 
231 
232  double FudgeFactor; // a very small distance, relative to the dataset's size
236 
237  float MaxWidth;
238 
245 
246  vtkOctreePointLocator(const vtkOctreePointLocator&); // Not implemented
247  void operator=(const vtkOctreePointLocator&); // Not implemented
248 };
249 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkOctreePointLocator::GenerateRepresentation
void GenerateRepresentation(int level, vtkPolyData *pd)
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkOctreePointLocator
an octree spatial decomposition of a set of points
Definition: vtkOctreePointLocator.h:52
vtkOctreePointLocator::FindClosestPointInSphere
int FindClosestPointInSphere(double x, double y, double z, double radius, int skipRegion, double &dist2)
vtkOctreePointLocator::FindClosestPoint
vtkIdType FindClosestPoint(double x, double y, double z, double &dist2)
vtkOctreePointLocator::operator=
void operator=(const vtkOctreePointLocator &)
vtkOctreePointLocator::LocatorIds
int * LocatorIds
Definition: vtkOctreePointLocator.h:235
vtkOctreePointLocator::MaxWidth
float MaxWidth
Definition: vtkOctreePointLocator.h:237
vtkOctreePointLocator::FindPointsInArea
void FindPointsInArea(double *area, vtkIdTypeArray *ids, bool clearArray=true)
vtkOctreePointLocator::FindClosestNPoints
void FindClosestNPoints(int N, const double x[3], vtkIdList *result)
vtkAbstractPointLocator.h
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkCommonDataModelModule.h
vtkOctreePointLocator::FudgeFactor
double FudgeFactor
Definition: vtkOctreePointLocator.h:232
vtkOctreePointLocator::AddAllPointsInRegion
void AddAllPointsInRegion(vtkOctreePointLocatorNode *node, vtkIdList *ids)
vtkOctreePointLocator::GetRegionDataBounds
void GetRegionDataBounds(int leafNodeID, double bounds[6])
vtkOctreePointLocator::_FindClosestPointInRegion
int _FindClosestPointInRegion(int leafNodeId, double x, double y, double z, double &dist2)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkOctreePointLocator::NumberOfLocatorPoints
int NumberOfLocatorPoints
Definition: vtkOctreePointLocator.h:233
vtkOctreePointLocator::FindPointsInArea
void FindPointsInArea(vtkOctreePointLocatorNode *node, double *area, vtkIdTypeArray *ids)
vtkOctreePointLocator::NumberOfLeafNodes
int NumberOfLeafNodes
Definition: vtkOctreePointLocator.h:229
vtkOctreePointLocatorNode
Octree node that has 8 children each of equal size.
Definition: vtkOctreePointLocatorNode.h:46
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkOctreePointLocator::FindClosestPointWithinRadius
virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2)
vtkOctreePointLocator::BuildLocator
virtual void BuildLocator()
vtkOctreePointLocator::GetBounds
virtual double * GetBounds()
vtkOctreePointLocator::DivideTest
int DivideTest(int size, int level)
vtkOctreePointLocator::LeafNodeList
vtkOctreePointLocatorNode ** LeafNodeList
Definition: vtkOctreePointLocator.h:167
vtkOctreePointLocator::FindPointsWithinRadius
void FindPointsWithinRadius(vtkOctreePointLocatorNode *node, double radiusSquared, const double x[3], vtkIdList *ids)
vtkOctreePointLocator::New
static vtkOctreePointLocator * New()
vtkOctreePointLocator::Top
vtkOctreePointLocatorNode * Top
Definition: vtkOctreePointLocator.h:166
vtkOctreePointLocator::GetBounds
virtual void GetBounds(double *bounds)
vtkOctreePointLocator::CreateCubicOctants
int CreateCubicOctants
Definition: vtkOctreePointLocator.h:244
vtkOctreePointLocator::DivideRegion
void DivideRegion(vtkOctreePointLocatorNode *node, int *ordering, int level)
vtkOctreePointLocator::SetDataBoundsToSpatialBounds
static void SetDataBoundsToSpatialBounds(vtkOctreePointLocatorNode *node)
vtkOctreePointLocator::~vtkOctreePointLocator
~vtkOctreePointLocator()
vtkgl::ids
GLuint * ids
Definition: vtkgl.h:11831
vtkOctreePointLocator::FindClosestPointInRegion
vtkIdType FindClosestPointInRegion(int regionId, double x, double y, double z, double &dist2)
vtkOctreePointLocator::FindClosestPoint
virtual vtkIdType FindClosestPoint(const double x[3])
vtkOctreePointLocator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkOctreePointLocator::AddAllPointsInRegion
void AddAllPointsInRegion(vtkOctreePointLocatorNode *node, vtkIdTypeArray *ids)
vtkOctreePointLocator::GetRegionBounds
void GetRegionBounds(int regionID, double bounds[6])
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkOctreePointLocator::DeleteAllDescendants
static void DeleteAllDescendants(vtkOctreePointLocatorNode *octant)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkgl::level
GLint level
Definition: vtkgl.h:11316
vtkOctreePointLocator::AddPolys
void AddPolys(vtkOctreePointLocatorNode *node, vtkPoints *pts, vtkCellArray *polys)
vtkOctreePointLocator::GetRegionContainingPoint
int GetRegionContainingPoint(double x, double y, double z)
vtkOctreePointLocator::GetPointsInRegion
vtkIdTypeArray * GetPointsInRegion(int leafNodeId)
vtkOctreePointLocator::LocatorPoints
float * LocatorPoints
Definition: vtkOctreePointLocator.h:234
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:49
vtkOctreePointLocator::FindClosestPointInRegion
vtkIdType FindClosestPointInRegion(int regionId, double *x, double &dist2)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkgl::result
GLuint64EXT * result
Definition: vtkgl.h:18868
vtkOctreePointLocator::vtkOctreePointLocator
vtkOctreePointLocator()
vtkOctreePointLocator::FreeSearchStructure
virtual void FreeSearchStructure()
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkOctreePointLocator::FindRegion
int FindRegion(vtkOctreePointLocatorNode *node, float x, float y, float z)
vtkAbstractPointLocator
abstract class to quickly locate points in 3-space
Definition: vtkAbstractPointLocator.h:38
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15
vtkOctreePointLocator::BuildLeafNodeList
void BuildLeafNodeList(vtkOctreePointLocatorNode *node, int &index)
vtkX3D::radius
@ radius
Definition: vtkX3D.h:252
vtkOctreePointLocator::vtkOctreePointLocator
vtkOctreePointLocator(const vtkOctreePointLocator &)
vtkOctreePointLocator::FindRegion
int FindRegion(vtkOctreePointLocatorNode *node, double x, double y, double z)
vtkOctreePointLocator::MaximumPointsPerRegion
int MaximumPointsPerRegion
Definition: vtkOctreePointLocator.h:228
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843
vtkOctreePointLocator::FindPointsWithinRadius
virtual void FindPointsWithinRadius(double radius, const double x[3], vtkIdList *result)