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 
54 
55 class vtkPoints;
56 class vtkIdList;
57 class vtkPolyData;
58 class vtkCellArray;
59 class vtkIncrementalOctreeNode;
60 
62 {
63 public:
64 
66  void PrintSelf( ostream & os, vtkIndent indent );
67 
69 
71 
79  vtkSetClampMacro( MaxPointsPerLeaf, int, 16, 256 );
80  vtkGetMacro( MaxPointsPerLeaf, int );
82 
84 
85  vtkSetMacro( BuildCubicOctree, int );
86  vtkGetMacro( BuildCubicOctree, int );
87  vtkBooleanMacro( BuildCubicOctree, int );
89 
91 
93  vtkGetObjectMacro( LocatorPoints, vtkPoints );
95 
97  virtual void Initialize() { this->FreeSearchStructure(); }
98 
100  virtual void FreeSearchStructure();
101 
103  virtual void GetBounds( double * bounds );
104 
106 
107  virtual double * GetBounds()
108  { this->GetBounds( this->Bounds ); return this->Bounds; }
110 
112  int GetNumberOfPoints();
113 
120  virtual vtkIdType FindClosestInsertedPoint( const double x[3] );
121 
124  virtual void GenerateRepresentation( int nodeLevel, vtkPolyData * polysData );
125 
126  // -------------------------------------------------------------------------
127  // ---------------------------- Point Location ----------------------------
128  // -------------------------------------------------------------------------
129 
133  virtual void BuildLocator();
134 
139  virtual vtkIdType FindClosestPoint( const double x[3] );
140 
145  virtual vtkIdType FindClosestPoint( double x, double y, double z );
146 
152  virtual vtkIdType FindClosestPoint( const double x[3], double * miniDist2 );
153 
159  virtual vtkIdType FindClosestPoint( double x, double y, double z, double * miniDist2 );
160 
162 
169  ( double radius, const double x[3], double & dist2 );
171 
173 
179  vtkIdType FindClosestPointWithinSquaredRadius
180  ( double radius2, const double x[3], double & dist2 );
182 
184 
189  virtual void FindPointsWithinRadius
190  ( double R, const double x[3], vtkIdList * result );
192 
194 
199  void FindPointsWithinSquaredRadius
200  ( double R2, const double x[3], vtkIdList * result );
202 
204 
209  virtual void FindClosestNPoints
210  ( int N, const double x[3], vtkIdList * result );
212 
213  // -------------------------------------------------------------------------
214  // ---------------------------- Point Insertion ----------------------------
215  // -------------------------------------------------------------------------
216 
224  virtual int InitPointInsertion( vtkPoints * points, const double bounds[6] );
225 
227 
235  virtual int InitPointInsertion( vtkPoints * points, const double bounds[6],
236  vtkIdType estSize );
238 
243  virtual vtkIdType IsInsertedPoint( const double x[3] );
244 
249  virtual vtkIdType IsInsertedPoint( double x, double y, double z );
250 
258  virtual int InsertUniquePoint( const double point[3], vtkIdType & pntId );
259 
267  virtual void InsertPoint( vtkIdType ptId, const double x[3] );
268 
276  virtual vtkIdType InsertNextPoint( const double x[3] );
277 
279 
286  void InsertPointWithoutChecking
287  ( const double point[3], vtkIdType & pntId, int insert );
289 
290 //BTX
291 protected:
292 
295 
296 private:
297 
298  int BuildCubicOctree;
299  int MaxPointsPerLeaf;
300  double InsertTolerance2;
301  double OctreeMaxDimSize;
302  double FudgeFactor;
303  vtkPoints * LocatorPoints;
304  vtkIncrementalOctreeNode * OctreeRootNode;
305 
307  static void DeleteAllDescendants( vtkIncrementalOctreeNode * node );
308 
310 
312  static void AddPolys( vtkIncrementalOctreeNode * node,
313  vtkPoints * points, vtkCellArray * polygs );
315 
317 
320  vtkIncrementalOctreeNode * GetLeafContainer( vtkIncrementalOctreeNode * node,
321  const double pnt[3] );
323 
325 
331  vtkIdType FindClosestPointInLeafNode( vtkIncrementalOctreeNode * leafNode,
332  const double point[3], double * dist2 );
334 
336 
347  vtkIdType FindClosestPointInSphere
348  ( const double point[3], double radius2, vtkIncrementalOctreeNode * maskNode,
349  double * minDist2, const double * refDist2 );
351 
352 
353  // -------------------------------------------------------------------------
354  // ---------------------------- Point Location ----------------------------
355  // -------------------------------------------------------------------------
356 
358 
367  vtkIdType FindClosestPointInSphereWithoutTolerance( const double point[3],
368  double radius2, vtkIncrementalOctreeNode * maskNode, double * minDist2 );
370 
372 
376  void FindPointsWithinSquaredRadius( vtkIncrementalOctreeNode * node,
377  double radius2, const double point[3], vtkIdList * idList );
379 
380  // -------------------------------------------------------------------------
381  // ---------------------------- Point Insertion ----------------------------
382  // -------------------------------------------------------------------------
383 
385 
395  vtkIdType FindClosestPointInSphereWithTolerance( const double point[3],
396  double radius2, vtkIncrementalOctreeNode * maskNode, double * minDist2 );
398 
400 
408  vtkIdType IsInsertedPoint( const double x[3],
409  vtkIncrementalOctreeNode ** leafContainer );
411 
413 
420  vtkIdType IsInsertedPointForZeroTolerance
421  ( const double x[3], vtkIncrementalOctreeNode ** leafContainer );
423 
425 
433  vtkIdType IsInsertedPointForNonZeroTolerance
434  ( const double x[3], vtkIncrementalOctreeNode ** leafContainer );
436 
438 
443  vtkIdType FindDuplicatePointInLeafNode( vtkIncrementalOctreeNode * leafNode,
444  const double point[3] );
446 
448 
454  vtkIdType FindDuplicateFloatTypePointInVisitedLeafNode
455  ( vtkIncrementalOctreeNode * leafNode, const double point[3] );
457 
459 
465  vtkIdType FindDuplicateDoubleTypePointInVisitedLeafNode
466  ( vtkIncrementalOctreeNode * leafNode, const double point[3] );
468 
470  ( const vtkIncrementalOctreePointLocator & ); // Not implemented
471  void operator = ( const vtkIncrementalOctreePointLocator & );// Not implemented
472 //ETX
473 };
474 #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
#define VTK_FILTERING_EXPORT
Abstract class in support of both point location and point insertion.
void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:255
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6])=0
a simple class to control print indentation
Definition: vtkIndent.h:37
list of point or cell ids
Definition: vtkIdList.h:34
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:48
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
represent and manipulate 3D points
Definition: vtkPoints.h:38
Incremental octree in support of both point location and point insertion.