59 #ifndef vtkIncrementalOctreeNode_h
60 #define vtkIncrementalOctreeNode_h
62 #include "vtkCommonDataModelModule.h"
80 vtkGetMacro( NumberOfPoints,
int );
100 double y2,
double z1,
double z2 );
112 vtkGetVector3Macro( MinBounds,
double );
119 vtkGetVector3Macro( MaxBounds,
double );
127 {
return this->NumberOfPoints ? this->MinDataBounds : this->MinBounds; }
134 {
return this->NumberOfPoints ? this->MaxDataBounds : this->MaxBounds; }
139 int IsLeaf() {
return ( this->Children == NULL ) ? 1 : 0; }
146 int GetChildIndex(
const double point[3] );
158 int ContainsPoint(
const double pnt[3] );
164 int ContainsPointByData(
const double pnt[3] );
180 int maxPts,
vtkIdType * pntId,
int ptMode );
247 double MinDataBounds[3];
254 double MaxDataBounds[3];
280 virtual
void SetPointIdSet(
vtkIdList * );
300 const
double newPnt[3],
vtkIdType * pntIdx,
int maxPts,
int ptMode );
306 void CreatePointIdSet(
int initSize,
int growSize );
311 void DeletePointIdSet();
318 void UpdateCounterAndDataBounds( const
double point[3] );
329 int UpdateCounterAndDataBounds
330 ( const
double point[3],
int nHits,
int updateData );
342 int UpdateCounterAndDataBoundsRecursively( const
double point[3],
int nHits,
351 int ContainsDuplicatePointsOnly( const
double pnt[3] );
366 void SeperateExactlyDuplicatePointsFromNewInsertion(
vtkPoints *
points,
367 vtkIdList * pntIds, const
double newPnt[3],
368 vtkIdType * pntIdx,
int maxPts,
int ptMode );
377 double GetDistance2ToBoundary( const
double point[3],
double closest[3],
389 return int(
point[0] > this->Children[0]->MaxBounds[0] ) +
390 ( (
int(
point[1] > this->Children[0]->MaxBounds[1] ) ) << 1 ) +
391 ( (
int(
point[2] > this->Children[0]->MaxBounds[2] ) ) << 2 );
398 ( this->MinBounds[0] < pnt[0] && pnt[0] <= this->MaxBounds[0] &&
399 this->MinBounds[1] < pnt[1] && pnt[1] <= this->MaxBounds[1] &&
400 this->MinBounds[2] < pnt[2] && pnt[2] <= this->MaxBounds[2]
410 ( this->MinDataBounds[0] <= pnt[0] && pnt[0] <= this->MaxDataBounds[0] &&
411 this->MinDataBounds[1] <= pnt[1] && pnt[1] <= this->MaxDataBounds[1] &&
412 this->MinDataBounds[2] <= pnt[2] && pnt[2] <= this->MaxDataBounds[2]
418 inline int vtkIncrementalOctreeNode::ContainsDuplicatePointsOnly
419 (
const double pnt[3] )
423 ( this->MinDataBounds[0] == pnt[0] && pnt[0] == this->MaxDataBounds[0] &&
424 this->MinDataBounds[1] == pnt[1] && pnt[1] == this->MaxDataBounds[1] &&
425 this->MinDataBounds[2] == pnt[2] && pnt[2] == this->MaxDataBounds[2]
431 inline void vtkIncrementalOctreeNode::UpdateCounterAndDataBounds
432 (
const double point[3] )
434 this->NumberOfPoints ++;
436 this->MinDataBounds[0] = (
point[0] < this->MinDataBounds[0] )
437 ?
point[0] : this->MinDataBounds[0];
438 this->MinDataBounds[1] = (
point[1] < this->MinDataBounds[1] )
439 ?
point[1] : this->MinDataBounds[1];
440 this->MinDataBounds[2] = (
point[2] < this->MinDataBounds[2] )
441 ?
point[2] : this->MinDataBounds[2];
442 this->MaxDataBounds[0] = (
point[0] > this->MaxDataBounds[0] )
443 ?
point[0] : this->MaxDataBounds[0];
444 this->MaxDataBounds[1] = (
point[1] > this->MaxDataBounds[1] )
445 ?
point[1] : this->MaxDataBounds[1];
446 this->MaxDataBounds[2] = (
point[2] > this->MaxDataBounds[2] )
447 ?
point[2] : this->MaxDataBounds[2];
451 inline int vtkIncrementalOctreeNode::UpdateCounterAndDataBoundsRecursively
452 (
const double point[3],
int nHits,
int updateData,
455 int updated = this->UpdateCounterAndDataBounds
456 (
point, nHits, updateData );
458 return ( ( this->Parent == endNode )
460 : this->Parent->UpdateCounterAndDataBoundsRecursively
461 (
point, nHits, updated, endNode )
list of point or cell ids
Octree node constituting incremental octree (in support of both point location and point insertion)
double GetDistance2ToBoundary(const double point[3], double closest[3], vtkIncrementalOctreeNode *rootNode, int checkData)
Compute the minimum squared distance from a point to this node, with all six boundaries considered.
int InsertPoint(vtkPoints *points, const double newPnt[3], int maxPts, vtkIdType *pntId, int ptMode)
This function is called after a successful point-insertion check and only applies to a leaf node.
void GetBounds(double bounds[6]) const
Get the spatial bounding box of the node.
void ExportAllPointIdsByInsertion(vtkIdList *idList)
Export all the indices of the points (contained in or under this node) by inserting them to an alloca...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double GetDistance2ToInnerBoundary(const double point[3], vtkIncrementalOctreeNode *rootNode)
Given a point inside this node, get the minimum squared distance to all inner boundaries.
int ContainsPoint(const double pnt[3])
A point is in a node if and only if MinBounds[i] < p[i] <= MaxBounds[i], which allows a node to be di...
double GetDistance2ToBoundary(const double point[3], vtkIncrementalOctreeNode *rootNode, int checkData)
Compute the minimum squared distance from a point to this node, with all six boundaries considered.
static vtkIncrementalOctreeNode * New()
void DeleteChildNodes()
Delete the eight child nodes.
void SetBounds(double x1, double x2, double y1, double y2, double z1, double z2)
Set the spatial bounding box of the node.
int ContainsPointByData(const double pnt[3])
A point is in a node, in terms of data, if and only if MinDataBounds[i] <= p[i] <= MaxDataBounds[i].
~vtkIncrementalOctreeNode() override
vtkIncrementalOctreeNode * GetChild(int i)
Get quick access to a child of this node.
int IsLeaf()
Determine whether or not this node is a leaf.
double * GetMaxDataBounds()
Get access to MaxDataBounds.
vtkIncrementalOctreeNode()
double * GetMinDataBounds()
Get access to MinDataBounds.
void ExportAllPointIdsByDirectSet(vtkIdType *pntIdx, vtkIdList *idList)
Export all the indices of the points (contained in or under this node) by directly setting them in an...
a simple class to control print indentation
abstract base class for most VTK objects
represent and manipulate 3D points