59#ifndef vtkIncrementalOctreeNode_h
60#define vtkIncrementalOctreeNode_h
62#include "vtkCommonDataModelModule.h"
81 vtkGetMacro(NumberOfPoints,
int);
100 void SetBounds(
double x1,
double x2,
double y1,
double y2,
double z1,
double z2);
112 vtkGetVector3Macro(MinBounds,
double);
119 vtkGetVector3Macro(MaxBounds,
double);
128 return this->NumberOfPoints ? this->MinDataBounds : this->MinBounds;
137 return this->NumberOfPoints ? this->MaxDataBounds : this->MaxBounds;
143 int IsLeaf() {
return (this->Children ==
nullptr) ? 1 : 0; }
150 int GetChildIndex(
const double point[3]);
168 vtkTypeBool ContainsPointByData(
const double pnt[3]);
192 int ptMode,
int& numberOfNodes);
243 int GetID()
const {
return this->ID; }
271 double MinDataBounds[3];
278 double MaxDataBounds[3];
332 vtkIdType* pntIdx,
int maxPts,
int ptMode,
int& numberOfNodes);
338 void CreatePointIdSet(
int initSize,
int growSize);
343 void DeletePointIdSet();
350 void UpdateCounterAndDataBounds(
const double point[3]);
361 int UpdateCounterAndDataBounds(
const double point[3],
int nHits,
int updateData);
373 int UpdateCounterAndDataBoundsRecursively(
382 int ContainsDuplicatePointsOnly(
const double pnt[3]);
397 void SeperateExactlyDuplicatePointsFromNewInsertion(
vtkPoints* points,
vtkIdList* pntIds,
398 const double newPnt[3],
vtkIdType* pntIdx,
int maxPts,
int ptMode);
418 return int(point[0] > this->Children[0]->MaxBounds[0]) +
419 ((int(point[1] > this->Children[0]->MaxBounds[1])) << 1) +
420 ((
int(point[2] > this->Children[0]->MaxBounds[2])) << 2);
427 (this->MinBounds[0] < pnt[0] && pnt[0] <= this->MaxBounds[0] && this->MinBounds[1] < pnt[1] &&
428 pnt[1] <= this->MaxBounds[1] && this->MinBounds[2] < pnt[2] && pnt[2] <= this->MaxBounds[2])
436 return ((this->MinDataBounds[0] <= pnt[0] && pnt[0] <= this->MaxDataBounds[0] &&
437 this->MinDataBounds[1] <= pnt[1] && pnt[1] <= this->MaxDataBounds[1] &&
438 this->MinDataBounds[2] <= pnt[2] && pnt[2] <= this->MaxDataBounds[2])
444inline int vtkIncrementalOctreeNode::ContainsDuplicatePointsOnly(
const double pnt[3])
446 return ((this->MinDataBounds[0] == pnt[0] && pnt[0] == this->MaxDataBounds[0] &&
447 this->MinDataBounds[1] == pnt[1] && pnt[1] == this->MaxDataBounds[1] &&
448 this->MinDataBounds[2] == pnt[2] && pnt[2] == this->MaxDataBounds[2])
454inline void vtkIncrementalOctreeNode::UpdateCounterAndDataBounds(
const double point[3])
456 this->NumberOfPoints++;
458 this->MinDataBounds[0] = (
point[0] < this->MinDataBounds[0]) ? point[0] : this->MinDataBounds[0];
459 this->MinDataBounds[1] = (
point[1] < this->MinDataBounds[1]) ? point[1] : this->MinDataBounds[1];
460 this->MinDataBounds[2] = (
point[2] < this->MinDataBounds[2]) ? point[2] : this->MinDataBounds[2];
461 this->MaxDataBounds[0] = (
point[0] > this->MaxDataBounds[0]) ? point[0] : this->MaxDataBounds[0];
462 this->MaxDataBounds[1] = (
point[1] > this->MaxDataBounds[1]) ? point[1] : this->MaxDataBounds[1];
463 this->MaxDataBounds[2] = (
point[2] > this->MaxDataBounds[2]) ? point[2] : this->MaxDataBounds[2];
467inline int vtkIncrementalOctreeNode::UpdateCounterAndDataBoundsRecursively(
470 int updated = this->UpdateCounterAndDataBounds(point, nHits, updateData);
472 return ((this->Parent == endNode)
474 : 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)