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 "vtkObject.h"
39 
40 class vtkCell;
41 class vtkPlanesIntersection;
42 
44 {
45 public:
46  vtkTypeMacro(vtkKdNode, vtkObject);
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
49  static vtkKdNode *New();
50 
52 
54  vtkSetMacro(Dim, int);
55  vtkGetMacro(Dim, int);
57 
61  virtual double GetDivisionPosition();
62 
64 
65  vtkSetMacro(NumberOfPoints, int);
66  vtkGetMacro(NumberOfPoints, int);
68 
70 
72  void SetBounds(double x1,double x2,double y1,double y2,double z1,double z2);
73  void SetBounds(double b[6])
74  {
75  this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]);
76  }
77  void GetBounds(double *b) const;
79 
81 
84  void SetDataBounds(double x1,double x2,double y1,double y2,double z1,double z2);
85  void GetDataBounds(double *b) const;
87 
90  void SetDataBounds(float *v);
91 
93 
95  double *GetMinBounds() {return this->Min;}
96  double *GetMaxBounds() {return this->Max;}
98 
100  void SetMinBounds(double *mb);
101 
103  void SetMaxBounds(double *mb);
104 
106 
108  double *GetMinDataBounds() {return this->MinVal;}
109  double *GetMaxDataBounds() {return this->MaxVal;}
111 
114  void SetMinDataBounds(double *mb);
115 
118  void SetMaxDataBounds(double *mb);
119 
121 
123  vtkSetMacro(ID, int);
124  vtkGetMacro(ID, int);
126 
128 
133  vtkGetMacro(MinID, int);
134  vtkGetMacro(MaxID, int);
135  vtkSetMacro(MinID, int);
136  vtkSetMacro(MaxID, int);
138 
140  void AddChildNodes(vtkKdNode *left, vtkKdNode *right);
141 
143  void DeleteChildNodes();
144 
146 
147  vtkGetObjectMacro(Left, vtkKdNode);
148  void SetLeft(vtkKdNode* left);
150 
152 
153  vtkGetObjectMacro(Right, vtkKdNode);
154  void SetRight(vtkKdNode *right);
156 
158 
159  vtkGetObjectMacro(Up, vtkKdNode);
160  void SetUp(vtkKdNode* up);
162 
164 
167  int IntersectsBox(double x1,double x2,double y1,double y2,double z1,double z2,
168  int useDataBounds);
170 
172 
175  int IntersectsSphere2(double x, double y, double z, double rSquared,
176  int useDataBounds);
178 
185  int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
186 
188 
195  int IntersectsCell(vtkCell *cell, int useDataBounds,
196  int cellRegion=-1, double *cellBounds=NULL);
198 
200 
203  int ContainsBox(double x1,double x2,double y1,double y2,double z1,double z2,
204  int useDataBounds);
206 
210  int ContainsPoint(double x, double y, double z, int useDataBounds);
211 
215  double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds);
216 
218 
222  double GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt,
223  int useDataBounds);
225 
230  double GetDistance2ToInnerBoundary(double x, double y, double z);
231 
233 
234  void PrintNode(int depth);
235  void PrintVerboseNode(int depth);
237 
238 protected:
239 
240  vtkKdNode();
241  ~vtkKdNode();
242 
243 private:
244 
245  double _GetDistance2ToBoundary(
246  double x, double y, double z, double *boundaryPt,
247  int innerBoundaryOnly, int useDataBounds);
248 
249  double Min[3]; // spatial bounds of node
250  double Max[3]; // spatial bounds of node
251  double MinVal[3]; // spatial bounds of data within node
252  double MaxVal[3]; // spatial bounds of data within node
253  int NumberOfPoints;
254 
255  vtkKdNode *Up;
256 
257  vtkKdNode *Left;
258  vtkKdNode *Right;
259 
260  int Dim;
261 
262  int ID; // region id
263 
264  int MinID;
265  int MaxID;
266 
267  vtkKdNode(const vtkKdNode&); // Not implemented
268  void operator=(const vtkKdNode&); // Not implemented
269 };
270 
271 #endif
double * GetMinDataBounds()
Definition: vtkKdNode.h:108
double * GetMinBounds()
Definition: vtkKdNode.h:95
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning...
Definition: vtkKdNode.h:43
abstract base class for most VTK objects
Definition: vtkObject.h:60
#define VTK_FILTERING_EXPORT
double * GetMaxDataBounds()
Definition: vtkKdNode.h:109
double * GetMaxBounds()
Definition: vtkKdNode.h:96
void SetBounds(double b[6])
Definition: vtkKdNode.h:73
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:37
static vtkObject * New()