50#ifndef vtkIncrementalOctreeNode_h
51#define vtkIncrementalOctreeNode_h
53#include "vtkCommonDataModelModule.h"
56VTK_ABI_NAMESPACE_BEGIN
72 vtkGetMacro(NumberOfPoints,
int);
91 void SetBounds(
double x1,
double x2,
double y1,
double y2,
double z1,
double z2);
103 vtkGetVector3Macro(MinBounds,
double);
110 vtkGetVector3Macro(MaxBounds,
double);
119 return this->NumberOfPoints ? this->MinDataBounds : this->MinBounds;
128 return this->NumberOfPoints ? this->MaxDataBounds : this->MaxBounds;
134 int IsLeaf() {
return (this->Children ==
nullptr) ? 1 : 0; }
141 int GetChildIndex(
const double point[3]);
159 vtkTypeBool ContainsPointByData(
const double pnt[3]);
180 int ptMode,
int& numberOfNodes);
231 int GetID()
const {
return this->ID; }
259 double MinDataBounds[3];
266 double MaxDataBounds[3];
320 vtkIdType* pntIdx,
int maxPts,
int ptMode,
int& numberOfNodes);
326 void CreatePointIdSet(
int initSize,
int growSize);
331 void DeletePointIdSet();
338 void UpdateCounterAndDataBounds(
const double point[3]);
349 int UpdateCounterAndDataBounds(
const double point[3],
int nHits,
int updateData);
361 int UpdateCounterAndDataBoundsRecursively(
370 int ContainsDuplicatePointsOnly(
const double pnt[3]);
385 void SeperateExactlyDuplicatePointsFromNewInsertion(
vtkPoints* points,
vtkIdList* pntIds,
386 const double newPnt[3],
vtkIdType* pntIdx,
int maxPts,
int ptMode);
395 double GetDistance2ToBoundary(
const double point[3],
double closest[3],
int innerOnly,
406 return int(point[0] > this->Children[0]->MaxBounds[0]) +
407 ((int(point[1] > this->Children[0]->MaxBounds[1])) << 1) +
408 ((int(point[2] > this->Children[0]->MaxBounds[2])) << 2);
415 (this->MinBounds[0] < pnt[0] && pnt[0] <= this->MaxBounds[0] && this->MinBounds[1] < pnt[1] &&
416 pnt[1] <= this->MaxBounds[1] && this->MinBounds[2] < pnt[2] && pnt[2] <= this->MaxBounds[2])
424 return ((this->MinDataBounds[0] <= pnt[0] && pnt[0] <= this->MaxDataBounds[0] &&
425 this->MinDataBounds[1] <= pnt[1] && pnt[1] <= this->MaxDataBounds[1] &&
426 this->MinDataBounds[2] <= pnt[2] && pnt[2] <= this->MaxDataBounds[2])
432inline int vtkIncrementalOctreeNode::ContainsDuplicatePointsOnly(
const double pnt[3])
434 return ((this->MinDataBounds[0] == pnt[0] && pnt[0] == this->MaxDataBounds[0] &&
435 this->MinDataBounds[1] == pnt[1] && pnt[1] == this->MaxDataBounds[1] &&
436 this->MinDataBounds[2] == pnt[2] && pnt[2] == this->MaxDataBounds[2])
442inline void vtkIncrementalOctreeNode::UpdateCounterAndDataBounds(
const double point[3])
444 this->NumberOfPoints++;
446 this->MinDataBounds[0] = (
point[0] < this->MinDataBounds[0]) ? point[0] : this->MinDataBounds[0];
447 this->MinDataBounds[1] = (
point[1] < this->MinDataBounds[1]) ? point[1] : this->MinDataBounds[1];
448 this->MinDataBounds[2] = (
point[2] < this->MinDataBounds[2]) ? point[2] : this->MinDataBounds[2];
449 this->MaxDataBounds[0] = (
point[0] > this->MaxDataBounds[0]) ? point[0] : this->MaxDataBounds[0];
450 this->MaxDataBounds[1] = (
point[1] > this->MaxDataBounds[1]) ? point[1] : this->MaxDataBounds[1];
451 this->MaxDataBounds[2] = (
point[2] > this->MaxDataBounds[2]) ? point[2] : this->MaxDataBounds[2];
455inline int vtkIncrementalOctreeNode::UpdateCounterAndDataBoundsRecursively(
458 int updated = this->UpdateCounterAndDataBounds(point, nHits, updateData);
460 return ((this->Parent == endNode)
462 : 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)
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.
void GetBounds(double bounds[6]) const
Get the spatial bounding box of the node.
int InsertPoint(vtkPoints *points, const double newPnt[3], int maxPts, vtkIdType *pntId, int ptMode, int &numberOfNodes)
This function is called after a successful point-insertion check and only applies to a leaf 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
abstract base class for most VTK objects
represent and manipulate 3D points