VTK  9.1.0
vtkKdNode.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkKdNode.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*----------------------------------------------------------------------------
16 Copyright (c) Sandia Corporation
17 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18----------------------------------------------------------------------------*/
19
33#ifndef vtkKdNode_h
34#define vtkKdNode_h
35
36#include "vtkCommonDataModelModule.h" // For export macro
37#include "vtkObject.h"
38
39class vtkCell;
41
42class VTKCOMMONDATAMODEL_EXPORT vtkKdNode : public vtkObject
43{
44public:
45 vtkTypeMacro(vtkKdNode, vtkObject);
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
48 static vtkKdNode* New();
49
51
55 vtkSetMacro(Dim, int);
56 vtkGetMacro(Dim, int);
58
64 virtual double GetDivisionPosition();
65
67
70 vtkSetMacro(NumberOfPoints, int);
71 vtkGetMacro(NumberOfPoints, int);
73
75
79 void SetBounds(double x1, double x2, double y1, double y2, double z1, double z2);
80 void SetBounds(const double b[6]) { this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]); }
81 void GetBounds(double* b) const;
83
85
90 void SetDataBounds(double x1, double x2, double y1, double y2, double z1, double z2);
91 void GetDataBounds(double* b) const;
93
98 void SetDataBounds(float* v);
99
104 double* GetMinBounds() VTK_SIZEHINT(3) { return this->Min; }
105 double* GetMaxBounds() VTK_SIZEHINT(3) { return this->Max; }
106
110 void SetMinBounds(const double* mb);
111
115 void SetMaxBounds(const double* mb);
116
121 double* GetMinDataBounds() VTK_SIZEHINT(3) { return this->MinVal; }
122 double* GetMaxDataBounds() VTK_SIZEHINT(3) { return this->MaxVal; }
123
128 void SetMinDataBounds(const double* mb);
129
134 void SetMaxDataBounds(const double* mb);
135
137
141 vtkSetMacro(ID, int);
142 vtkGetMacro(ID, int);
144
146
153 vtkGetMacro(MinID, int);
154 vtkGetMacro(MaxID, int);
155 vtkSetMacro(MinID, int);
156 vtkSetMacro(MaxID, int);
158
162 void AddChildNodes(vtkKdNode* left, vtkKdNode* right);
163
168
170
173 vtkGetObjectMacro(Left, vtkKdNode);
174 void SetLeft(vtkKdNode* left);
176
178
181 vtkGetObjectMacro(Right, vtkKdNode);
182 void SetRight(vtkKdNode* right);
184
186
189 vtkGetObjectMacro(Up, vtkKdNode);
190 void SetUp(vtkKdNode* up);
192
199 double x1, double x2, double y1, double y2, double z1, double z2, int useDataBounds);
200
206 int IntersectsSphere2(double x, double y, double z, double rSquared, int useDataBounds);
207
216 int IntersectsRegion(vtkPlanesIntersection* pi, int useDataBounds);
217
228 vtkCell* cell, int useDataBounds, int cellRegion = -1, double* cellBounds = nullptr);
229
236 double x1, double x2, double y1, double y2, double z1, double z2, int useDataBounds);
237
243 vtkTypeBool ContainsPoint(double x, double y, double z, int useDataBounds);
244
250 double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds);
251
258 double x, double y, double z, double* boundaryPt, int useDataBounds);
259
266 double GetDistance2ToInnerBoundary(double x, double y, double z);
267
269
272 void PrintNode(int depth);
273 void PrintVerboseNode(int depth);
275
276protected:
278 ~vtkKdNode() override;
279
280private:
281 double _GetDistance2ToBoundary(
282 double x, double y, double z, double* boundaryPt, int innerBoundaryOnly, int useDataBounds);
283
284 double Min[3]; // spatial bounds of node
285 double Max[3]; // spatial bounds of node
286 double MinVal[3]; // spatial bounds of data within node
287 double MaxVal[3]; // spatial bounds of data within node
288 int NumberOfPoints;
289
290 vtkKdNode* Up;
291
292 vtkKdNode* Left;
293 vtkKdNode* Right;
294
295 int Dim;
296
297 int ID; // region id
298
299 int MinID;
300 int MaxID;
301
302 vtkKdNode(const vtkKdNode&) = delete;
303 void operator=(const vtkKdNode&) = delete;
304};
305
306#endif
abstract class to specify cell behavior
Definition: vtkCell.h:147
a simple class to control print indentation
Definition: vtkIndent.h:113
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning.
Definition: vtkKdNode.h:43
double * GetMaxBounds()
Definition: vtkKdNode.h:105
int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds)
A vtkPlanesIntersection object represents a convex 3D region bounded by planes, and it is capable of ...
void SetLeft(vtkKdNode *left)
Set/Get a pointer to the left child of this node.
void SetRight(vtkKdNode *right)
Set/Get a pointer to the right child of this node.
double * GetMinDataBounds()
Get a pointer to the 3 data bound minima (xmin, ymin and zmin) or the 3 data bound maxima (xmax,...
Definition: vtkKdNode.h:121
void PrintVerboseNode(int depth)
For debugging purposes, print out this node.
void SetMinBounds(const double *mb)
Set the xmin, ymin and zmin value of the bounds of this region.
double * GetMinBounds()
Get a pointer to the 3 bound minima (xmin, ymin and zmin) or the 3 bound maxima (xmax,...
Definition: vtkKdNode.h:104
void SetBounds(const double b[6])
Set/Get the bounds of the spatial region represented by this node.
Definition: vtkKdNode.h:80
int IntersectsBox(double x1, double x2, double y1, double y2, double z1, double z2, int useDataBounds)
Return 1 if this spatial region intersects the axis-aligned box given by the bounds passed in.
int ContainsBox(double x1, double x2, double y1, double y2, double z1, double z2, int useDataBounds)
Return 1 if this spatial region entirely contains a box specified by it's bounds.
double * GetMaxDataBounds()
Definition: vtkKdNode.h:122
void SetMinDataBounds(const double *mb)
Set the xmin, ymin and zmin value of the bounds of this data within this region.
void SetDataBounds(double x1, double x2, double y1, double y2, double z1, double z2)
Set/Get the bounds of the points contained in this spatial region.
void SetMaxBounds(const double *mb)
Set the xmax, ymax and zmax value of the bounds of this region.
int IntersectsCell(vtkCell *cell, int useDataBounds, int cellRegion=-1, double *cellBounds=nullptr)
Return 1 if the cell specified intersects this region.
void SetMaxDataBounds(const double *mb)
Set the xmax, ymax and zmax value of the bounds of this data within this region.
double GetDistance2ToInnerBoundary(double x, double y, double z)
Calculate the distance from the specified point (which is required to be inside this spatial region) ...
int IntersectsSphere2(double x, double y, double z, double rSquared, int useDataBounds)
Return 1 if this spatial region intersects a sphere described by it's center and the square of it's r...
void AddChildNodes(vtkKdNode *left, vtkKdNode *right)
Add the left and right children.
void SetUp(vtkKdNode *up)
Set/Get a pointer to the parent of this node.
void GetDataBounds(double *b) const
Set/Get the bounds of the points contained in this spatial region.
void SetDataBounds(float *v)
Given a pointer to NumberOfPoints points, set the DataBounds of this node to the bounds of these poin...
vtkTypeBool ContainsPoint(double x, double y, double z, int useDataBounds)
Return 1 if this spatial region entirely contains the given point.
double GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt, int useDataBounds)
Calculate the distance squared from any point to the boundary of this region.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetBounds(double x1, double x2, double y1, double y2, double z1, double z2)
Set/Get the bounds of the spatial region represented by this node.
void DeleteChildNodes()
Delete the left and right children.
virtual double GetDivisionPosition()
Get the location of the division plane along the axis the region is divided.
void PrintNode(int depth)
For debugging purposes, print out this node.
~vtkKdNode() override
double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds)
Calculate the distance squared from any point to the boundary of this region.
static vtkKdNode * New()
void GetBounds(double *b) const
Set/Get the bounds of the spatial region represented by this node.
abstract base class for most VTK objects
Definition: vtkObject.h:82
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)