62#ifndef vtkIncrementalOctreeNode_h
63#define vtkIncrementalOctreeNode_h
65#include "vtkCommonDataModelModule.h"
84 vtkGetMacro(NumberOfPoints,
int);
103 void SetBounds(
double x1,
double x2,
double y1,
double y2,
double z1,
double z2);
115 vtkGetVector3Macro(MinBounds,
double);
122 vtkGetVector3Macro(MaxBounds,
double);
131 return this->NumberOfPoints ? this->MinDataBounds : this->MinBounds;
140 return this->NumberOfPoints ? this->MaxDataBounds : this->MaxBounds;
146 int IsLeaf() {
return (this->Children ==
nullptr) ? 1 : 0; }
153 int GetChildIndex(
const double point[3]);
171 vtkTypeBool ContainsPointByData(
const double pnt[3]);
195 int ptMode,
int& numberOfNodes);
246 int GetID()
const {
return this->ID; }
274 double MinDataBounds[3];
281 double MaxDataBounds[3];
335 vtkIdType* pntIdx,
int maxPts,
int ptMode,
int& numberOfNodes);
341 void CreatePointIdSet(
int initSize,
int growSize);
346 void DeletePointIdSet();
353 void UpdateCounterAndDataBounds(
const double point[3]);
364 int UpdateCounterAndDataBounds(
const double point[3],
int nHits,
int updateData);
376 int UpdateCounterAndDataBoundsRecursively(
385 int ContainsDuplicatePointsOnly(
const double pnt[3]);
400 void SeperateExactlyDuplicatePointsFromNewInsertion(
vtkPoints* points,
vtkIdList* pntIds,
401 const double newPnt[3],
vtkIdType* pntIdx,
int maxPts,
int ptMode);
421 return int(point[0] > this->Children[0]->MaxBounds[0]) +
422 ((int(point[1] > this->Children[0]->MaxBounds[1])) << 1) +
423 ((
int(point[2] > this->Children[0]->MaxBounds[2])) << 2);
430 (this->MinBounds[0] < pnt[0] && pnt[0] <= this->MaxBounds[0] && this->MinBounds[1] < pnt[1] &&
431 pnt[1] <= this->MaxBounds[1] && this->MinBounds[2] < pnt[2] && pnt[2] <= this->MaxBounds[2])
439 return ((this->MinDataBounds[0] <= pnt[0] && pnt[0] <= this->MaxDataBounds[0] &&
440 this->MinDataBounds[1] <= pnt[1] && pnt[1] <= this->MaxDataBounds[1] &&
441 this->MinDataBounds[2] <= pnt[2] && pnt[2] <= this->MaxDataBounds[2])
447inline int vtkIncrementalOctreeNode::ContainsDuplicatePointsOnly(
const double pnt[3])
449 return ((this->MinDataBounds[0] == pnt[0] && pnt[0] == this->MaxDataBounds[0] &&
450 this->MinDataBounds[1] == pnt[1] && pnt[1] == this->MaxDataBounds[1] &&
451 this->MinDataBounds[2] == pnt[2] && pnt[2] == this->MaxDataBounds[2])
457inline void vtkIncrementalOctreeNode::UpdateCounterAndDataBounds(
const double point[3])
459 this->NumberOfPoints++;
461 this->MinDataBounds[0] = (
point[0] < this->MinDataBounds[0]) ? point[0] : this->MinDataBounds[0];
462 this->MinDataBounds[1] = (
point[1] < this->MinDataBounds[1]) ? point[1] : this->MinDataBounds[1];
463 this->MinDataBounds[2] = (
point[2] < this->MinDataBounds[2]) ? point[2] : this->MinDataBounds[2];
464 this->MaxDataBounds[0] = (
point[0] > this->MaxDataBounds[0]) ? point[0] : this->MaxDataBounds[0];
465 this->MaxDataBounds[1] = (
point[1] > this->MaxDataBounds[1]) ? point[1] : this->MaxDataBounds[1];
466 this->MaxDataBounds[2] = (
point[2] > this->MaxDataBounds[2]) ? point[2] : this->MaxDataBounds[2];
470inline int vtkIncrementalOctreeNode::UpdateCounterAndDataBoundsRecursively(
473 int updated = this->UpdateCounterAndDataBounds(point, nHits, updateData);
475 return ((this->Parent == endNode)
477 : this->Parent->UpdateCounterAndDataBoundsRecursively(point, nHits, updated, endNode));
list of point or cell ids
Octree node constituting incremental octree (in support of both point location and point insertion)
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.
int GetNumberOfLevels() const
Computes and returns the maximum level of the tree.
vtkIdList * GetPointIds() const
int GetID() const
Returns the ID of this node which is the index of the node in the octree.
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 * GetMaxDataBounds()
Get access to MaxDataBounds.
vtkIncrementalOctreeNode * GetChild(int i)
Get quick access to a child of this node.
double GetDistance2ToInnerBoundary(const double point[3], vtkIncrementalOctreeNode *rootNode)
Given a point inside this node, get the minimum squared distance to all inner boundaries.
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.
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.
~vtkIncrementalOctreeNode() override
double * GetMinDataBounds()
Get access to MinDataBounds.
vtkTypeBool 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].
int GetChildIndex(const double point[3])
Determine which specific child / octant contains a given point.
int IsLeaf()
Determine whether or not this node is a leaf.
static vtkIncrementalOctreeNode * New()
vtkTypeBool 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...
vtkIncrementalOctreeNode()
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
represent and manipulate 3D points
#define VTK_DEPRECATED_IN_9_1_0(reason)