VTK
dox/Filtering/vtkOctreePointLocatorNode.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOctreePointLocatorNode.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*----------------------------------------------------------------------------
00016  Copyright (c) Sandia Corporation
00017  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00018 ----------------------------------------------------------------------------*/
00019 
00036 #ifndef __vtkOctreePointLocatorNode_h
00037 #define __vtkOctreePointLocatorNode_h
00038 
00039 #include "vtkObject.h"
00040 
00041 class vtkCell;
00042 class vtkPlanesIntersection;
00043 
00044 class VTK_FILTERING_EXPORT vtkOctreePointLocatorNode : public vtkObject
00045 {
00046 public:
00047   vtkTypeMacro(vtkOctreePointLocatorNode, vtkObject);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00050   static vtkOctreePointLocatorNode *New();
00051 
00053 
00054   void SetNumberOfPoints(int numberOfPoints)
00055   {
00056     this->NumberOfPoints = numberOfPoints;
00057   }
00058   vtkGetMacro(NumberOfPoints, int);
00060 
00062 
00064   void SetBounds(double xMin, double xMax, double yMin,
00065                  double yMax, double zMin, double zMax);
00066   void SetBounds(double b[6])
00067     {
00068     this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]);
00069     }
00070   void GetBounds(double *b) const;
00072 
00074 
00077   void SetDataBounds(double xMin, double xMax, double yMin,
00078                      double yMax, double zMin, double zMax);
00079   void GetDataBounds(double *b) const;
00081 
00082 //BTX
00084 
00086   vtkGetMacro(MinBounds, double*);
00087   vtkGetMacro(MaxBounds, double*);
00088 //ETX
00090 
00092 
00093   void SetMinBounds(double minBounds[3])
00094   {
00095     this->MinBounds[0] = minBounds[0];
00096     this->MinBounds[1] = minBounds[1];
00097     this->MinBounds[2] = minBounds[2];
00098   }
00100 
00102 
00103   void SetMaxBounds(double maxBounds[3])
00104   {
00105     this->MaxBounds[0] = maxBounds[0];
00106     this->MaxBounds[1] = maxBounds[1];
00107     this->MaxBounds[2] = maxBounds[2];
00108   }
00110 
00111 //BTX
00113 
00115   vtkGetMacro(MinDataBounds, double*);
00116   vtkGetMacro(MaxDataBounds, double*);
00117 //ETX
00119 
00121 
00123   void SetMinDataBounds(double minDataBounds[3])
00124   {
00125     this->MinDataBounds[0] = minDataBounds[0];
00126     this->MinDataBounds[1] = minDataBounds[1];
00127     this->MinDataBounds[2] = minDataBounds[2];
00128   }
00130 
00132 
00134   void SetMaxDataBounds(double maxDataBounds[3])
00135   {
00136     this->MaxDataBounds[0] = maxDataBounds[0];
00137     this->MaxDataBounds[1] = maxDataBounds[1];
00138     this->MaxDataBounds[2] = maxDataBounds[2];
00139   }
00141 
00143 
00145   vtkGetMacro(ID, int);
00147 
00149 
00153   vtkGetMacro(MinID, int);
00155 
00157   void CreateChildNodes();
00158 
00160   void DeleteChildNodes();
00161 
00163   vtkOctreePointLocatorNode* GetChild(int i);
00164 
00171   int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
00172 
00176   int ContainsPoint(double x, double y, double z, int useDataBounds);
00177 
00179 
00182   double GetDistance2ToBoundary(double x, double y, double z, 
00183                                 vtkOctreePointLocatorNode* top, int useDataBounds);
00185 
00187 
00191   double GetDistance2ToBoundary(double x, double y, double z, 
00192                                 double *boundaryPt, vtkOctreePointLocatorNode* top,
00193                                 int useDataBounds);
00195 
00197 
00201   double GetDistance2ToInnerBoundary(double x, double y, double z,
00202                                      vtkOctreePointLocatorNode* top);
00204 
00210   int GetSubOctantIndex(double* point, int CheckContainment);
00211 
00213 
00216   void ComputeOctreeNodeInformation(vtkOctreePointLocatorNode* Parent, 
00217                                     int& NextLeafId, int & NextMinId,
00218                                     float* coordinates);
00220 
00221 protected:
00222   vtkOctreePointLocatorNode();
00223   ~vtkOctreePointLocatorNode();
00224 
00225 private:
00226 
00227   double _GetDistance2ToBoundary(
00228     double x, double y, double z, double *boundaryPt,
00229     int innerBoundaryOnly, vtkOctreePointLocatorNode* top,
00230     int useDataBounds);
00231 
00233   double MinBounds[3];
00234 
00236   double MaxBounds[3];
00237 
00240   double MinDataBounds[3];   
00241 
00244   double MaxDataBounds[3];
00245 
00249   int NumberOfPoints;
00250   
00252   vtkOctreePointLocatorNode** Children;
00253 
00255   int ID;
00256 
00260   int MinID;
00261 
00262   vtkOctreePointLocatorNode(const vtkOctreePointLocatorNode&); // Not implemented
00263   void operator=(const vtkOctreePointLocatorNode&); // Not implemented
00264 };
00265 
00266 #endif