#include <vtkIncrementalOctreeNode.h>
Octree nodes serve as spatial sub-division primitives to build the search structure of an incremental octree in a recursive top-down manner. The hierarchy takes the form of a tree-like representation by which a parent node contains eight mutually non-overlapping child nodes. Each child is assigned with an axis-aligned rectangular volume (Spatial Bounding Box) and the eight children together cover exactly the same region as governed by their parent. The eight child nodes / octants are ordered as
{ (xBBoxMin, xBBoxMid] & (yBBoxMin, yBBoxMid] & (zBBoxMin, zBBoxMid] }, { (xBBoxMid, xBBoxMax] & (yBBoxMin, yBBoxMid] & (zBBoxMin, zBBoxMid] }, { (xBBoxMin, xBBoxMid] & (yBBoxMid, yBBoxMax] & (zBBoxMin, zBBoxMid] }, { (xBBoxMid, xBBoxMax] & (yBBoxMid, yBBoxMax] & (zBBoxMin, zBBoxMid] }, { (xBBoxMin, xBBoxMid] & (yBBoxMin, yBBoxMid] & (zBBoxMid, zBBoxMax] }, { (xBBoxMid, xBBoxMax] & (yBBoxMin, yBBoxMid] & (zBBoxMid, zBBoxMax] }, { (xBBoxMin, xBBoxMid] & (yBBoxMid, yBBoxMax] & (zBBoxMid, zBBoxMax] }, { (xBBoxMid, xBBoxMax] & (yBBoxMid, yBBoxMax] & (zBBoxMid, zBBoxMax] },
where { xrange & yRange & zRange } defines the region of each 3D octant. In addition, the points falling within and registered, by means of point indices, in the parent node are distributed to the child nodes for delegated maintenance. In fact, only leaf nodes, i.e., those without any descendants, actually store point indices while each node, regardless of a leaf or non- leaf node, keeps a dynamically updated Data Bounding Box of the inhabitant points, if any. Given a maximum number of points per leaf node, an octree is initialized with an empty leaf node that is then recursively sub-divided, but only on demand as points are incrementally inserted, to construct a populated tree.
Please note that this octree node class is able to handle a large number of EXACTLY duplicate points that is greater than the specified maximum number of points per leaf node. In other words, as an exception, a leaf node may maintain an arbitrary number of exactly duplicate points to deal with possible extreme cases.
Definition at line 66 of file vtkIncrementalOctreeNode.h.
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
void | DeleteChildNodes () |
void | GetBounds (double bounds[6]) const |
int | IsLeaf () |
int | GetChildIndex (const double point[3]) |
vtkIncrementalOctreeNode * | GetChild (int i) |
int | ContainsPoint (const double pnt[3]) |
int | ContainsPointByData (const double pnt[3]) |
void | ExportAllPointIdsByInsertion (vtkIdList *idList) |
void | ExportAllPointIdsByDirectSet (vtkIdType *pntIdx, vtkIdList *idList) |
virtual int | GetNumberOfPoints () |
virtual vtkIdList * | GetPointIdSet () |
void | SetBounds (double x1, double x2, double y1, double y2, double z1, double z2) |
virtual double * | GetMinBounds () |
virtual void | GetMinBounds (double &, double &, double &) |
virtual void | GetMinBounds (double[3]) |
virtual double * | GetMaxBounds () |
virtual void | GetMaxBounds (double &, double &, double &) |
virtual void | GetMaxBounds (double[3]) |
double * | GetMinDataBounds () |
double * | GetMaxDataBounds () |
int | InsertPoint (vtkPoints *points, const double newPnt[3], int maxPts, vtkIdType *pntId, int ptMode) |
double | GetDistance2ToInnerBoundary (const double point[3], vtkIncrementalOctreeNode *rootNode) |
double | GetDistance2ToBoundary (const double point[3], vtkIncrementalOctreeNode *rootNode, int checkData) |
double | GetDistance2ToBoundary (const double point[3], double closest[3], vtkIncrementalOctreeNode *rootNode, int checkData) |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkIncrementalOctreeNode * | SafeDownCast (vtkObject *o) |
static vtkIncrementalOctreeNode * | New () |
Protected Member Functions | |
vtkIncrementalOctreeNode () | |
~vtkIncrementalOctreeNode () |
vtkIncrementalOctreeNode::vtkIncrementalOctreeNode | ( | ) | [protected] |
vtkIncrementalOctreeNode::~vtkIncrementalOctreeNode | ( | ) | [protected] |
virtual const char* vtkIncrementalOctreeNode::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkObject.
static int vtkIncrementalOctreeNode::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
virtual int vtkIncrementalOctreeNode::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
static vtkIncrementalOctreeNode* vtkIncrementalOctreeNode::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkObject.
void vtkIncrementalOctreeNode::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
static vtkIncrementalOctreeNode* vtkIncrementalOctreeNode::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
virtual int vtkIncrementalOctreeNode::GetNumberOfPoints | ( | ) | [virtual] |
Get the number of points inside or under this node.
virtual vtkIdList* vtkIncrementalOctreeNode::GetPointIdSet | ( | ) | [virtual] |
Get the list of point indices, NULL for a non-leaf node.
void vtkIncrementalOctreeNode::DeleteChildNodes | ( | ) |
Delete the eight child nodes.
void vtkIncrementalOctreeNode::SetBounds | ( | double | x1, | |
double | x2, | |||
double | y1, | |||
double | y2, | |||
double | z1, | |||
double | z2 | |||
) |
Set the spatial bounding box of the node. This function sets a default data bounding box.
void vtkIncrementalOctreeNode::GetBounds | ( | double | bounds[6] | ) | const |
Get the spatial bounding box of the node. The values are returned via an array in order of: x_min, x_max, y_min, y_max, z_min, z_max.
virtual double* vtkIncrementalOctreeNode::GetMinBounds | ( | ) | [virtual] |
Get access to MinBounds. Do not free this pointer.
virtual void vtkIncrementalOctreeNode::GetMinBounds | ( | double & | , | |
double & | , | |||
double & | ||||
) | [virtual] |
Get access to MinBounds. Do not free this pointer.
virtual void vtkIncrementalOctreeNode::GetMinBounds | ( | double | [3] | ) | [virtual] |
Get access to MinBounds. Do not free this pointer.
virtual double* vtkIncrementalOctreeNode::GetMaxBounds | ( | ) | [virtual] |
Get access to MaxBounds. Do not free this pointer.
virtual void vtkIncrementalOctreeNode::GetMaxBounds | ( | double & | , | |
double & | , | |||
double & | ||||
) | [virtual] |
Get access to MaxBounds. Do not free this pointer.
virtual void vtkIncrementalOctreeNode::GetMaxBounds | ( | double | [3] | ) | [virtual] |
Get access to MaxBounds. Do not free this pointer.
double* vtkIncrementalOctreeNode::GetMinDataBounds | ( | ) | [inline] |
Get access to MinDataBounds. Note that MinDataBounds is not valid until point insertion.
Definition at line 111 of file vtkIncrementalOctreeNode.h.
double* vtkIncrementalOctreeNode::GetMaxDataBounds | ( | ) | [inline] |
Get access to MaxDataBounds. Note that MaxDataBounds is not valid until point insertion.
Definition at line 118 of file vtkIncrementalOctreeNode.h.
int vtkIncrementalOctreeNode::IsLeaf | ( | ) | [inline] |
Determine whether or not this node is a leaf.
Definition at line 123 of file vtkIncrementalOctreeNode.h.
int vtkIncrementalOctreeNode::GetChildIndex | ( | const double | point[3] | ) | [inline] |
Determine which specific child / octant contains a given point. Note that the point is assumed to be inside this node and no checking is performed on the inside issue.
Definition at line 343 of file vtkIncrementalOctreeNode.h.
vtkIncrementalOctreeNode* vtkIncrementalOctreeNode::GetChild | ( | int | i | ) | [inline] |
Get quick access to a child of this node. Note that this node is assumed to be a non-leaf one and no checking is performed on the node type.
Definition at line 133 of file vtkIncrementalOctreeNode.h.
int vtkIncrementalOctreeNode::ContainsPoint | ( | const double | pnt[3] | ) | [inline] |
A point is in a node if and only if MinBounds[i] < p[i] <= MaxBounds[i], which allows a node to be divided into eight non-overlapping children.
Definition at line 352 of file vtkIncrementalOctreeNode.h.
int vtkIncrementalOctreeNode::ContainsPointByData | ( | const double | pnt[3] | ) | [inline] |
A point is in a node, in terms of data, if and only if MinDataBounds[i] <= p[i] <= MaxDataBounds[i].
Definition at line 363 of file vtkIncrementalOctreeNode.h.
int vtkIncrementalOctreeNode::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. Prior to a call to this function, the octree should have been retrieved top-down to find the specific leaf node in which this new point (newPt) will be inserted. The actual index of the new point (to be inserted to points) is stored in pntId. Argument ptMode specifies whether the point is not inserted at all but instead only the point index is provided upon 0, the point is inserted via vtkPoints:: InsertPoint() upon 1, or it is inserted via vtkPoints::InsertNextPoint() upon 2. For case 0, pntId needs to be specified. For cases 1 and 2, the actual point index is returned via pntId. Note that this function always returns 1 to indicate the success of point insertion.
double vtkIncrementalOctreeNode::GetDistance2ToInnerBoundary | ( | const double | point[3], | |
vtkIncrementalOctreeNode * | rootNode | |||
) |
Given a point inside this node, get the minimum squared distance to all inner boundaries. An inner boundary is a node's face that is shared by another non-root node.
double vtkIncrementalOctreeNode::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. The data bounding box is checked if checkData is non-zero.
double vtkIncrementalOctreeNode::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. The data bounding box is checked if checkData is non-zero. The closest on-boundary point is returned via closest.
void vtkIncrementalOctreeNode::ExportAllPointIdsByInsertion | ( | vtkIdList * | idList | ) |
Export all the indices of the points (contained in or under this node) by inserting them to an allocated vtkIdList via vtkIdList::InsertNextId().
void vtkIncrementalOctreeNode::ExportAllPointIdsByDirectSet | ( | vtkIdType * | pntIdx, | |
vtkIdList * | idList | |||
) |
Export all the indices of the points (contained in or under this node) by directly setting them in an allocated vtkIdList object. pntIdx indicates the starting location (in terms of vtkIdList) from which new point indices are added to vtkIdList by vtkIdList::SetId().