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 
36 #ifndef vtkKdNode_h
37 #define vtkKdNode_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 class vtkCell;
44 
45 class VTKCOMMONDATAMODEL_EXPORT vtkKdNode : public vtkObject
46 {
47 public:
48  vtkTypeMacro(vtkKdNode, vtkObject);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
51  static vtkKdNode *New();
52 
54 
58  vtkSetMacro(Dim, int);
59  vtkGetMacro(Dim, int);
61 
67  virtual double GetDivisionPosition();
68 
70 
73  vtkSetMacro(NumberOfPoints, int);
74  vtkGetMacro(NumberOfPoints, int);
76 
78 
82  void SetBounds(double x1,double x2,double y1,double y2,double z1,double z2);
83  void SetBounds(const double b[6])
84  {
85  this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]);
86  }
87  void GetBounds(double *b) const;
89 
91 
96  void SetDataBounds(double x1,double x2,double y1,double y2,double z1,double z2);
97  void GetDataBounds(double *b) const;
99 
104  void SetDataBounds(float *v);
105 
110  double *GetMinBounds() VTK_SIZEHINT(3) {return this->Min;}
111  double *GetMaxBounds() VTK_SIZEHINT(3) {return this->Max;}
112 
116  void SetMinBounds(const double *mb);
117 
121  void SetMaxBounds(const double *mb);
122 
127  double *GetMinDataBounds() VTK_SIZEHINT(3) {return this->MinVal;}
128  double *GetMaxDataBounds() VTK_SIZEHINT(3) {return this->MaxVal;}
129 
134  void SetMinDataBounds(const double *mb);
135 
140  void SetMaxDataBounds(const double *mb);
141 
143 
147  vtkSetMacro(ID, int);
148  vtkGetMacro(ID, int);
150 
152 
159  vtkGetMacro(MinID, int);
160  vtkGetMacro(MaxID, int);
161  vtkSetMacro(MinID, int);
162  vtkSetMacro(MaxID, int);
164 
168  void AddChildNodes(vtkKdNode *left, vtkKdNode *right);
169 
173  void DeleteChildNodes();
174 
176 
179  vtkGetObjectMacro(Left, vtkKdNode);
180  void SetLeft(vtkKdNode* left);
182 
184 
187  vtkGetObjectMacro(Right, vtkKdNode);
188  void SetRight(vtkKdNode *right);
190 
192 
195  vtkGetObjectMacro(Up, vtkKdNode);
196  void SetUp(vtkKdNode* up);
198 
204  int IntersectsBox(double x1,double x2,double y1,double y2,double z1,double z2,
205  int useDataBounds);
206 
212  int IntersectsSphere2(double x, double y, double z, double rSquared,
213  int useDataBounds);
214 
223  int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
224 
234  int IntersectsCell(vtkCell *cell, int useDataBounds,
235  int cellRegion=-1, double *cellBounds=nullptr);
236 
242  int ContainsBox(double x1,double x2,double y1,double y2,double z1,double z2,
243  int useDataBounds);
244 
250  vtkTypeBool ContainsPoint(double x, double y, double z, int useDataBounds);
251 
257  double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds);
258 
264  double GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt,
265  int useDataBounds);
266 
273  double GetDistance2ToInnerBoundary(double x, double y, double z);
274 
276 
279  void PrintNode(int depth);
280  void PrintVerboseNode(int depth);
282 
283 protected:
284 
285  vtkKdNode();
286  ~vtkKdNode() override;
287 
288 private:
289 
290  double _GetDistance2ToBoundary(
291  double x, double y, double z, double *boundaryPt,
292  int innerBoundaryOnly, int useDataBounds);
293 
294  double Min[3]; // spatial bounds of node
295  double Max[3]; // spatial bounds of node
296  double MinVal[3]; // spatial bounds of data within node
297  double MaxVal[3]; // spatial bounds of data within node
298  int NumberOfPoints;
299 
300  vtkKdNode *Up;
301 
302  vtkKdNode *Left;
303  vtkKdNode *Right;
304 
305  int Dim;
306 
307  int ID; // region id
308 
309  int MinID;
310  int MaxID;
311 
312  vtkKdNode(const vtkKdNode&) = delete;
313  void operator=(const vtkKdNode&) = delete;
314 };
315 
316 #endif
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:127
double * GetMinBounds()
Get a pointer to the 3 bound minima (xmin, ymin and zmin) or the 3 bound maxima (xmax, ymax, zmax).
Definition: vtkKdNode.h:110
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning...
Definition: vtkKdNode.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
double * GetMaxDataBounds()
Definition: vtkKdNode.h:128
int vtkTypeBool
Definition: vtkABI.h:69
double * GetMaxBounds()
Definition: vtkKdNode.h:111
abstract class to specify cell behavior
Definition: vtkCell.h:59
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_SIZEHINT(...)
void SetBounds(const double b[6])
Set/Get the bounds of the spatial region represented by this node.
Definition: vtkKdNode.h:83
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...