VTK
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 
39 class vtkCell;
41 
42 class VTKCOMMONDATAMODEL_EXPORT vtkKdNode : public vtkObject
43 {
44 public:
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])
81  {
82  this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]);
83  }
84  void GetBounds(double *b) const;
86 
88 
93  void SetDataBounds(double x1,double x2,double y1,double y2,double z1,double z2);
94  void GetDataBounds(double *b) const;
96 
101  void SetDataBounds(float *v);
102 
107  double *GetMinBounds() VTK_SIZEHINT(3) {return this->Min;}
108  double *GetMaxBounds() VTK_SIZEHINT(3) {return this->Max;}
109 
113  void SetMinBounds(const double *mb);
114 
118  void SetMaxBounds(const double *mb);
119 
124  double *GetMinDataBounds() VTK_SIZEHINT(3) {return this->MinVal;}
125  double *GetMaxDataBounds() VTK_SIZEHINT(3) {return this->MaxVal;}
126 
131  void SetMinDataBounds(const double *mb);
132 
137  void SetMaxDataBounds(const double *mb);
138 
140 
144  vtkSetMacro(ID, int);
145  vtkGetMacro(ID, int);
147 
149 
156  vtkGetMacro(MinID, int);
157  vtkGetMacro(MaxID, int);
158  vtkSetMacro(MinID, int);
159  vtkSetMacro(MaxID, int);
161 
165  void AddChildNodes(vtkKdNode *left, vtkKdNode *right);
166 
170  void DeleteChildNodes();
171 
173 
176  vtkGetObjectMacro(Left, vtkKdNode);
177  void SetLeft(vtkKdNode* left);
179 
181 
184  vtkGetObjectMacro(Right, vtkKdNode);
185  void SetRight(vtkKdNode *right);
187 
189 
192  vtkGetObjectMacro(Up, vtkKdNode);
193  void SetUp(vtkKdNode* up);
195 
201  int IntersectsBox(double x1,double x2,double y1,double y2,double z1,double z2,
202  int useDataBounds);
203 
209  int IntersectsSphere2(double x, double y, double z, double rSquared,
210  int useDataBounds);
211 
220  int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
221 
231  int IntersectsCell(vtkCell *cell, int useDataBounds,
232  int cellRegion=-1, double *cellBounds=nullptr);
233 
239  int ContainsBox(double x1,double x2,double y1,double y2,double z1,double z2,
240  int useDataBounds);
241 
247  int ContainsPoint(double x, double y, double z, int useDataBounds);
248 
254  double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds);
255 
261  double GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt,
262  int useDataBounds);
263 
270  double GetDistance2ToInnerBoundary(double x, double y, double z);
271 
273 
276  void PrintNode(int depth);
277  void PrintVerboseNode(int depth);
279 
280 protected:
281 
282  vtkKdNode();
283  ~vtkKdNode() override;
284 
285 private:
286 
287  double _GetDistance2ToBoundary(
288  double x, double y, double z, double *boundaryPt,
289  int innerBoundaryOnly, int useDataBounds);
290 
291  double Min[3]; // spatial bounds of node
292  double Max[3]; // spatial bounds of node
293  double MinVal[3]; // spatial bounds of data within node
294  double MaxVal[3]; // spatial bounds of data within node
295  int NumberOfPoints;
296 
297  vtkKdNode *Up;
298 
299  vtkKdNode *Left;
300  vtkKdNode *Right;
301 
302  int Dim;
303 
304  int ID; // region id
305 
306  int MinID;
307  int MaxID;
308 
309  vtkKdNode(const vtkKdNode&) = delete;
310  void operator=(const vtkKdNode&) = delete;
311 };
312 
313 #endif
vtkKdNode
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning....
Definition: vtkKdNode.h:42
vtkKdNode::GetMaxDataBounds
double * GetMaxDataBounds()
Definition: vtkKdNode.h:125
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkKdNode::GetMinBounds
double * GetMinBounds()
Get a pointer to the 3 bound minima (xmin, ymin and zmin) or the 3 bound maxima (xmax,...
Definition: vtkKdNode.h:107
vtkPlanesIntersection
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
Definition: vtkPlanesIntersection.h:52
vtkKdNode::GetMinDataBounds
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:124
vtkKdNode::SetBounds
void SetBounds(const double b[6])
Definition: vtkKdNode.h:80
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:56
vtkKdNode::GetMaxBounds
double * GetMaxBounds()
Definition: vtkKdNode.h:108
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h