VTK
vtkIncrementalOctreePointLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkIncrementalOctreePointLocator.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 =========================================================================*/
50 #ifndef vtkIncrementalOctreePointLocator_h
51 #define vtkIncrementalOctreePointLocator_h
52 
53 #include "vtkCommonDataModelModule.h" // For export macro
55 
56 class vtkPoints;
57 class vtkIdList;
58 class vtkPolyData;
59 class vtkCellArray;
61 
63 {
64 public:
65 
67  void PrintSelf( ostream & os, vtkIndent indent );
68 
70 
72 
80  vtkSetClampMacro( MaxPointsPerLeaf, int, 16, 256 );
81  vtkGetMacro( MaxPointsPerLeaf, int );
83 
85 
86  vtkSetMacro( BuildCubicOctree, int );
87  vtkGetMacro( BuildCubicOctree, int );
88  vtkBooleanMacro( BuildCubicOctree, int );
90 
92 
94  vtkGetObjectMacro( LocatorPoints, vtkPoints );
96 
98  virtual void Initialize() { this->FreeSearchStructure(); }
99 
101  virtual void FreeSearchStructure();
102 
104  virtual void GetBounds( double * bounds );
105 
107 
108  virtual double * GetBounds()
109  { this->GetBounds( this->Bounds ); return this->Bounds; }
111 
113  int GetNumberOfPoints();
114 
121  virtual vtkIdType FindClosestInsertedPoint( const double x[3] );
122 
125  virtual void GenerateRepresentation( int nodeLevel, vtkPolyData * polysData );
126 
127  // -------------------------------------------------------------------------
128  // ---------------------------- Point Location ----------------------------
129  // -------------------------------------------------------------------------
130 
134  virtual void BuildLocator();
135 
140  virtual vtkIdType FindClosestPoint( const double x[3] );
141 
146  virtual vtkIdType FindClosestPoint( double x, double y, double z );
147 
153  virtual vtkIdType FindClosestPoint( const double x[3], double * miniDist2 );
154 
160  virtual vtkIdType FindClosestPoint( double x, double y, double z, double * miniDist2 );
161 
163 
170  ( double radius, const double x[3], double & dist2 );
172 
174 
180  vtkIdType FindClosestPointWithinSquaredRadius
181  ( double radius2, const double x[3], double & dist2 );
183 
185 
190  virtual void FindPointsWithinRadius
191  ( double R, const double x[3], vtkIdList * result );
193 
195 
200  void FindPointsWithinSquaredRadius
201  ( double R2, const double x[3], vtkIdList * result );
203 
205 
210  virtual void FindClosestNPoints
211  ( int N, const double x[3], vtkIdList * result );
213 
214  // -------------------------------------------------------------------------
215  // ---------------------------- Point Insertion ----------------------------
216  // -------------------------------------------------------------------------
217 
225  virtual int InitPointInsertion( vtkPoints * points, const double bounds[6] );
226 
228 
236  virtual int InitPointInsertion( vtkPoints * points, const double bounds[6],
237  vtkIdType estSize );
239 
244  virtual vtkIdType IsInsertedPoint( const double x[3] );
245 
250  virtual vtkIdType IsInsertedPoint( double x, double y, double z );
251 
259  virtual int InsertUniquePoint( const double point[3], vtkIdType & pntId );
260 
268  virtual void InsertPoint( vtkIdType ptId, const double x[3] );
269 
277  virtual vtkIdType InsertNextPoint( const double x[3] );
278 
280 
287  void InsertPointWithoutChecking
288  ( const double point[3], vtkIdType & pntId, int insert );
290 
291 //BTX
292 protected:
293 
296 
297 private:
298 
299  int BuildCubicOctree;
300  int MaxPointsPerLeaf;
301  double InsertTolerance2;
302  double OctreeMaxDimSize;
303  double FudgeFactor;
304  vtkPoints * LocatorPoints;
305  vtkIncrementalOctreeNode * OctreeRootNode;
306 
308  static void DeleteAllDescendants( vtkIncrementalOctreeNode * node );
309 
311 
313  static void AddPolys( vtkIncrementalOctreeNode * node,
314  vtkPoints * points, vtkCellArray * polygs );
316 
318 
321  vtkIncrementalOctreeNode * GetLeafContainer( vtkIncrementalOctreeNode * node,
322  const double pnt[3] );
324 
326 
332  vtkIdType FindClosestPointInLeafNode( vtkIncrementalOctreeNode * leafNode,
333  const double point[3], double * dist2 );
335 
337 
348  vtkIdType FindClosestPointInSphere
349  ( const double point[3], double radius2, vtkIncrementalOctreeNode * maskNode,
350  double * minDist2, const double * refDist2 );
352 
353 
354  // -------------------------------------------------------------------------
355  // ---------------------------- Point Location ----------------------------
356  // -------------------------------------------------------------------------
357 
359 
368  vtkIdType FindClosestPointInSphereWithoutTolerance( const double point[3],
369  double radius2, vtkIncrementalOctreeNode * maskNode, double * minDist2 );
371 
373 
377  void FindPointsWithinSquaredRadius( vtkIncrementalOctreeNode * node,
378  double radius2, const double point[3], vtkIdList * idList );
380 
381  // -------------------------------------------------------------------------
382  // ---------------------------- Point Insertion ----------------------------
383  // -------------------------------------------------------------------------
384 
386 
396  vtkIdType FindClosestPointInSphereWithTolerance( const double point[3],
397  double radius2, vtkIncrementalOctreeNode * maskNode, double * minDist2 );
399 
401 
409  vtkIdType IsInsertedPoint( const double x[3],
410  vtkIncrementalOctreeNode ** leafContainer );
412 
414 
421  vtkIdType IsInsertedPointForZeroTolerance
422  ( const double x[3], vtkIncrementalOctreeNode ** leafContainer );
424 
426 
434  vtkIdType IsInsertedPointForNonZeroTolerance
435  ( const double x[3], vtkIncrementalOctreeNode ** leafContainer );
437 
439 
444  vtkIdType FindDuplicatePointInLeafNode( vtkIncrementalOctreeNode * leafNode,
445  const double point[3] );
447 
449 
455  vtkIdType FindDuplicateFloatTypePointInVisitedLeafNode
456  ( vtkIncrementalOctreeNode * leafNode, const double point[3] );
458 
460 
466  vtkIdType FindDuplicateDoubleTypePointInVisitedLeafNode
467  ( vtkIncrementalOctreeNode * leafNode, const double point[3] );
469 
471  ( const vtkIncrementalOctreePointLocator & ); // Not implemented
472  void operator = ( const vtkIncrementalOctreePointLocator & );// Not implemented
473 //ETX
474 };
475 #endif
virtual void FreeSearchStructure()=0
virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2)=0
virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId)=0
virtual vtkIdType IsInsertedPoint(double x, double y, double z)=0
Abstract class in support of both point location and point insertion.
void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:247
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6])=0
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
Octree node constituting incremental octree (in support of both point location and point insertion) ...
virtual void FindPointsWithinRadius(double R, const double x[3], vtkIdList *result)=0
virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result)=0
object to represent cell connectivity
Definition: vtkCellArray.h:49
virtual vtkIdType InsertNextPoint(const double x[3])=0
virtual vtkIdType FindClosestInsertedPoint(const double x[3])=0
virtual vtkIdType FindClosestPoint(const double x[3])=0
virtual void BuildLocator()=0
static vtkObject * New()
virtual void InsertPoint(vtkIdType ptId, const double x[3])=0
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
#define VTKCOMMONDATAMODEL_EXPORT
represent and manipulate 3D points
Definition: vtkPoints.h:38
Incremental octree in support of both point location and point insertion.