58 #ifndef __vtkIncrementalOctreeNode_h
59 #define __vtkIncrementalOctreeNode_h
76 vtkGetMacro( NumberOfPoints,
int );
81 vtkGetObjectMacro( PointIdSet,
vtkIdList );
85 void DeleteChildNodes();
90 void SetBounds(
double x1,
double x2,
double y1,
91 double y2,
double z1,
double z2 );
96 void GetBounds(
double bounds[6] )
const;
100 vtkGetVector3Macro( MinBounds,
double );
105 vtkGetVector3Macro( MaxBounds,
double );
112 {
return this->NumberOfPoints ? this->MinDataBounds : this->MinBounds; }
119 {
return this->NumberOfPoints ? this->MaxDataBounds : this->MaxBounds; }
123 int IsLeaf() {
return ( this->Children == NULL ) ? 1 : 0; }
128 int GetChildIndex(
const double point[3] );
138 int ContainsPoint(
const double pnt[3] );
142 int ContainsPointByData(
const double pnt[3] );
157 int InsertPoint(
vtkPoints * points,
const double newPnt[3],
158 int maxPts,
vtkIdType * pntId,
int ptMode );
165 double GetDistance2ToInnerBoundary(
const double point[3],
173 double GetDistance2ToBoundary(
const double point[3],
182 double GetDistance2ToBoundary(
const double point[3],
double closest[3],
189 void ExportAllPointIdsByInsertion(
vtkIdList * idList );
218 double MinDataBounds[3];
224 double MaxDataBounds[3];
240 virtual void SetPointIdSet(
vtkIdList * );
261 const double newPnt[3],
vtkIdType * pntIdx,
int maxPts,
int ptMode );
266 void CreatePointIdSet(
int initSize,
int growSize );
269 void DeletePointIdSet();
274 void UpdateCounterAndDataBounds(
const double point[3] );
285 int UpdateCounterAndDataBounds
286 (
const double point[3],
int nHits,
int updateData );
299 int UpdateCounterAndDataBoundsRecursively(
const double point[3],
int nHits,
307 int ContainsDuplicatePointsOnly(
const double pnt[3] );
322 void SeperateExactlyDuplicatePointsFromNewInsertion(
vtkPoints * points,
323 vtkIdList * pntIds,
const double newPnt[3],
324 vtkIdType * pntIdx,
int maxPts,
int ptMode );
333 double GetDistance2ToBoundary(
const double point[3],
double closest[3],
346 return int( point[0] > this->Children[0]->MaxBounds[0] ) +
347 ( ( int( point[1] > this->Children[0]->MaxBounds[1] ) ) << 1 ) +
348 ( ( int( point[2] > this->Children[0]->MaxBounds[2] ) ) << 2 );
355 ( this->MinBounds[0] < pnt[0] && pnt[0] <= this->MaxBounds[0] &&
356 this->MinBounds[1] < pnt[1] && pnt[1] <= this->MaxBounds[1] &&
357 this->MinBounds[2] < pnt[2] && pnt[2] <= this->MaxBounds[2]
367 ( this->MinDataBounds[0] <= pnt[0] && pnt[0] <= this->MaxDataBounds[0] &&
368 this->MinDataBounds[1] <= pnt[1] && pnt[1] <= this->MaxDataBounds[1] &&
369 this->MinDataBounds[2] <= pnt[2] && pnt[2] <= this->MaxDataBounds[2]
375 inline int vtkIncrementalOctreeNode::ContainsDuplicatePointsOnly
376 (
const double pnt[3] )
380 ( this->MinDataBounds[0] == pnt[0] && pnt[0] == this->MaxDataBounds[0] &&
381 this->MinDataBounds[1] == pnt[1] && pnt[1] == this->MaxDataBounds[1] &&
382 this->MinDataBounds[2] == pnt[2] && pnt[2] == this->MaxDataBounds[2]
388 inline void vtkIncrementalOctreeNode::UpdateCounterAndDataBounds
389 (
const double point[3] )
391 this->NumberOfPoints ++;
393 this->MinDataBounds[0] = ( point[0] < this->MinDataBounds[0] )
394 ? point[0] : this->MinDataBounds[0];
395 this->MinDataBounds[1] = ( point[1] < this->MinDataBounds[1] )
396 ? point[1] : this->MinDataBounds[1];
397 this->MinDataBounds[2] = ( point[2] < this->MinDataBounds[2] )
398 ? point[2] : this->MinDataBounds[2];
399 this->MaxDataBounds[0] = ( point[0] > this->MaxDataBounds[0] )
400 ? point[0] : this->MaxDataBounds[0];
401 this->MaxDataBounds[1] = ( point[1] > this->MaxDataBounds[1] )
402 ? point[1] : this->MaxDataBounds[1];
403 this->MaxDataBounds[2] = ( point[2] > this->MaxDataBounds[2] )
404 ? point[2] : this->MaxDataBounds[2];
408 inline int vtkIncrementalOctreeNode::UpdateCounterAndDataBoundsRecursively
409 (
const double point[3],
int nHits,
int updateData,
412 int updated = this->UpdateCounterAndDataBounds
413 ( point, nHits, updateData );
415 return ( ( this->Parent == endNode )
417 : this->Parent->UpdateCounterAndDataBoundsRecursively
418 ( point, nHits, updated, endNode )
double * GetMaxDataBounds()
abstract base class for most VTK objects
int ContainsPoint(const double pnt[3])
int ContainsPointByData(const double pnt[3])
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
list of point or cell ids
Octree node constituting incremental octree (in support of both point location and point insertion) ...
vtkIncrementalOctreeNode * GetChild(int i)
double * GetMinDataBounds()
int GetChildIndex(const double point[3])
represent and manipulate 3D points