00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00032 #ifndef __vtkKdNode_h
00033 #define __vtkKdNode_h
00034
00035 #include "vtkObject.h"
00036
00037 class vtkCell;
00038 class vtkPlanesIntersection;
00039
00040 class VTK_GRAPHICS_EXPORT vtkKdNode : public vtkObject
00041 {
00042 public:
00043 vtkTypeRevisionMacro(vtkKdNode, vtkObject);
00044 void PrintSelf(ostream& os, vtkIndent indent);
00045
00046 static vtkKdNode *New();
00047
00051 vtkSetMacro(Dim, int);
00052 vtkGetMacro(Dim, int);
00053
00056 vtkSetMacro(NumberOfPoints, int);
00057 vtkGetMacro(NumberOfPoints, int);
00058
00062 void SetBounds(double x1,double x2,double y1,double y2,double z1,double z2);
00063 void GetBounds(double *b) const;
00064
00069 void SetDataBounds(double x1,double x2,double y1,double y2,double z1,double z2);
00070 void GetDataBounds(double *b) const;
00071
00075 void SetDataBounds(float *v);
00076
00080 double *GetMinBounds() {return this->Min;}
00081 double *GetMaxBounds() {return this->Max;}
00082
00085 void SetMinBounds(double *mb);
00086
00089 void SetMaxBounds(double *mb);
00090
00094 double *GetMinDataBounds() {return this->MinVal;}
00095 double *GetMaxDataBounds() {return this->MaxVal;}
00096
00100 void SetMinDataBounds(double *mb);
00101
00105 void SetMaxDataBounds(double *mb);
00106
00110 vtkSetMacro(ID, int);
00111 vtkGetMacro(ID, int);
00112
00119 vtkGetMacro(MinID, int);
00120 vtkGetMacro(MaxID, int);
00121 vtkSetMacro(MinID, int);
00122 vtkSetMacro(MaxID, int);
00123
00126 void AddChildNodes(vtkKdNode *left, vtkKdNode *right);
00127
00130 void DeleteChildNodes();
00131
00134 vtkGetObjectMacro(Left, vtkKdNode);
00135 void SetLeft(vtkKdNode* left);
00136
00139 vtkGetObjectMacro(Right, vtkKdNode);
00140 void SetRight(vtkKdNode *right);
00141
00144 vtkGetObjectMacro(Up, vtkKdNode);
00145 void SetUp(vtkKdNode* up);
00146
00151 int IntersectsBox(double x1,double x2,double y1,double y2,double z1,double z2,
00152 int useDataBounds);
00153
00158 int IntersectsSphere2(double x, double y, double z, double rSquared,
00159 int useDataBounds);
00160
00168 int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
00169
00178 int IntersectsCell(vtkCell *cell, int useDataBounds,
00179 int cellRegion=-1, double *cellBounds=NULL);
00180
00185 int ContainsBox(double x1,double x2,double y1,double y2,double z1,double z2,
00186 int useDataBounds);
00187
00192 int ContainsPoint(double x, double y, double z, int useDataBounds);
00193
00198 double GetDistance2ToBoundary(double x, double y, double z, int useDataBounds);
00199
00205 double GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt,
00206 int useDataBounds);
00207
00213 double GetDistance2ToInnerBoundary(double x, double y, double z);
00214
00217 void PrintNode(int depth);
00218 void PrintVerboseNode(int depth);
00219
00220 protected:
00221
00222 vtkKdNode();
00223 ~vtkKdNode();
00224
00225 private:
00226
00227 double _GetDistance2ToBoundary(double x, double y, double z, double *boundaryPt,
00228 int innerBoundaryOnly, int useDataBounds);
00229
00230 double Min[3];
00231 double Max[3];
00232 double MinVal[3];
00233 double MaxVal[3];
00234 int NumberOfPoints;
00235
00236 vtkKdNode *Up;
00237
00238 vtkKdNode *Left;
00239 vtkKdNode *Right;
00240
00241 int Dim;
00242
00243 int ID;
00244
00245 int MinID;
00246 int MaxID;
00247
00248 vtkKdNode(const vtkKdNode&);
00249 void operator=(const vtkKdNode&);
00250 };
00251
00252 #endif