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 
35 #ifndef vtkKdNode_h
36 #define vtkKdNode_h
37 
38 #include "vtkCommonDataModelModule.h" // For export macro
39 #include "vtkObject.h"
40 
41 class vtkCell;
43 
45 {
46 public:
47  vtkTypeMacro(vtkKdNode, vtkObject);
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
50  static vtkKdNode *New();
51 
53 
55  vtkSetMacro(Dim, int);
56  vtkGetMacro(Dim, int);
58 
62  virtual double GetDivisionPosition();
63 
65 
66  vtkSetMacro(NumberOfPoints, int);
67  vtkGetMacro(NumberOfPoints, int);
69 
71 
73  void SetBounds(double x1,double x2,double y1,double y2,double z1,double z2);
74  void SetBounds(const double b[6])
75  {
76  this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]);
77  }
78  void GetBounds(double *b) const;
80 
82 
85  void SetDataBounds(double x1,double x2,double y1,double y2,double z1,double z2);
86  void GetDataBounds(double *b) const;
88 
91  void SetDataBounds(float *v);
92 
94 
96  double *GetMinBounds() {return this->Min;}
97  double *GetMaxBounds() {return this->Max;}
99 
101  void SetMinBounds(const double *mb);
102 
104  void SetMaxBounds(const double *mb);
105 
107 
109  double *GetMinDataBounds() {return this->MinVal;}
110  double *GetMaxDataBounds() {return this->MaxVal;}
112 
115  void SetMinDataBounds(const double *mb);
116 
119  void SetMaxDataBounds(const double *mb);
120 
122 
124  vtkSetMacro(ID, int);
125  vtkGetMacro(ID, int);
127 
129 
134  vtkGetMacro(MinID, int);
135  vtkGetMacro(MaxID, int);
136  vtkSetMacro(MinID, int);
137  vtkSetMacro(MaxID, int);
139 
141  void AddChildNodes(vtkKdNode *left, vtkKdNode *right);
142 
144  void DeleteChildNodes();
145 
147 
148  vtkGetObjectMacro(Left, vtkKdNode);
149  void SetLeft(vtkKdNode* left);
151 
153 
154  vtkGetObjectMacro(Right, vtkKdNode);
155  void SetRight(vtkKdNode *right);
157 
159 
160  vtkGetObjectMacro(Up, vtkKdNode);
161  void SetUp(vtkKdNode* up);
163 
165 
168  int IntersectsBox(double x1,double x2,double y1,double y2,double z1,double z2,
169  int useDataBounds);
171 
173 
176  int IntersectsSphere2(double x, double y, double z, double rSquared,
177  int useDataBounds);
179 
186  int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
187 
189 
196  int IntersectsCell(vtkCell *cell, int useDataBounds,
197  int cellRegion=-1, double *cellBounds=NULL);
199 
201 
204  int ContainsBox(double x1,double x2,double y1,double y2,double z1,double z2,
205  int useDataBounds);
207 
211  int ContainsPoint(double x, double y, double z, int useDataBounds);
212 
216  double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds);
217 
219 
223  double GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt,
224  int useDataBounds);
226 
231  double GetDistance2ToInnerBoundary(double x, double y, double z);
232 
234 
235  void PrintNode(int depth);
236  void PrintVerboseNode(int depth);
238 
239 protected:
240 
241  vtkKdNode();
242  ~vtkKdNode();
243 
244 private:
245 
246  double _GetDistance2ToBoundary(
247  double x, double y, double z, double *boundaryPt,
248  int innerBoundaryOnly, int useDataBounds);
249 
250  double Min[3]; // spatial bounds of node
251  double Max[3]; // spatial bounds of node
252  double MinVal[3]; // spatial bounds of data within node
253  double MaxVal[3]; // spatial bounds of data within node
254  int NumberOfPoints;
255 
256  vtkKdNode *Up;
257 
258  vtkKdNode *Left;
259  vtkKdNode *Right;
260 
261  int Dim;
262 
263  int ID; // region id
264 
265  int MinID;
266  int MaxID;
267 
268  vtkKdNode(const vtkKdNode&); // Not implemented
269  void operator=(const vtkKdNode&); // Not implemented
270 };
271 
272 #endif
double * GetMinDataBounds()
Definition: vtkKdNode.h:109
double * GetMinBounds()
Definition: vtkKdNode.h:96
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning...
Definition: vtkKdNode.h:44
abstract base class for most VTK objects
Definition: vtkObject.h:61
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
double * GetMaxDataBounds()
Definition: vtkKdNode.h:110
double * GetMaxBounds()
Definition: vtkKdNode.h:97
abstract class to specify cell behavior
Definition: vtkCell.h:58
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetBounds(const double b[6])
Definition: vtkKdNode.h:74
static vtkObject * New()
#define VTKCOMMONDATAMODEL_EXPORT