VTK
dox/Common/DataModel/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 "vtkCommonDataModelModule.h" // For export macro
00040 #include "vtkObject.h"
00041 
00042 class vtkCell;
00043 class vtkPlanesIntersection;
00044 
00045 class VTKCOMMONDATAMODEL_EXPORT vtkOctreePointLocatorNode : public vtkObject
00046 {
00047 public:
00048   vtkTypeMacro(vtkOctreePointLocatorNode, vtkObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00051   static vtkOctreePointLocatorNode *New();
00052 
00054 
00055   void SetNumberOfPoints(int numberOfPoints)
00056   {
00057     this->NumberOfPoints = numberOfPoints;
00058   }
00059   vtkGetMacro(NumberOfPoints, int);
00061 
00063 
00065   void SetBounds(double xMin, double xMax, double yMin,
00066                  double yMax, double zMin, double zMax);
00067   void SetBounds(double b[6])
00068     {
00069     this->SetBounds(b[0], b[1], b[2], b[3], b[4], b[5]);
00070     }
00071   void GetBounds(double *b) const;
00073 
00075 
00078   void SetDataBounds(double xMin, double xMax, double yMin,
00079                      double yMax, double zMin, double zMax);
00080   void GetDataBounds(double *b) const;
00082 
00083 //BTX
00085 
00087   vtkGetMacro(MinBounds, double*);
00088   vtkGetMacro(MaxBounds, double*);
00089 //ETX
00091 
00093 
00094   void SetMinBounds(double minBounds[3])
00095   {
00096     this->MinBounds[0] = minBounds[0];
00097     this->MinBounds[1] = minBounds[1];
00098     this->MinBounds[2] = minBounds[2];
00099   }
00101 
00103 
00104   void SetMaxBounds(double maxBounds[3])
00105   {
00106     this->MaxBounds[0] = maxBounds[0];
00107     this->MaxBounds[1] = maxBounds[1];
00108     this->MaxBounds[2] = maxBounds[2];
00109   }
00111 
00112 //BTX
00114 
00116   vtkGetMacro(MinDataBounds, double*);
00117   vtkGetMacro(MaxDataBounds, double*);
00118 //ETX
00120 
00122 
00124   void SetMinDataBounds(double minDataBounds[3])
00125   {
00126     this->MinDataBounds[0] = minDataBounds[0];
00127     this->MinDataBounds[1] = minDataBounds[1];
00128     this->MinDataBounds[2] = minDataBounds[2];
00129   }
00131 
00133 
00135   void SetMaxDataBounds(double maxDataBounds[3])
00136   {
00137     this->MaxDataBounds[0] = maxDataBounds[0];
00138     this->MaxDataBounds[1] = maxDataBounds[1];
00139     this->MaxDataBounds[2] = maxDataBounds[2];
00140   }
00142 
00144 
00146   vtkGetMacro(ID, int);
00148 
00150 
00154   vtkGetMacro(MinID, int);
00156 
00158   void CreateChildNodes();
00159 
00161   void DeleteChildNodes();
00162 
00164   vtkOctreePointLocatorNode* GetChild(int i);
00165 
00172   int IntersectsRegion(vtkPlanesIntersection *pi, int useDataBounds);
00173 
00177   int ContainsPoint(double x, double y, double z, int useDataBounds);
00178 
00180 
00183   double GetDistance2ToBoundary(double x, double y, double z,
00184                                 vtkOctreePointLocatorNode* top, int useDataBounds);
00186 
00188 
00192   double GetDistance2ToBoundary(double x, double y, double z,
00193                                 double *boundaryPt, vtkOctreePointLocatorNode* top,
00194                                 int useDataBounds);
00196 
00198 
00202   double GetDistance2ToInnerBoundary(double x, double y, double z,
00203                                      vtkOctreePointLocatorNode* top);
00205 
00211   int GetSubOctantIndex(double* point, int CheckContainment);
00212 
00214 
00217   void ComputeOctreeNodeInformation(vtkOctreePointLocatorNode* Parent,
00218                                     int& NextLeafId, int & NextMinId,
00219                                     float* coordinates);
00221 
00222 protected:
00223   vtkOctreePointLocatorNode();
00224   ~vtkOctreePointLocatorNode();
00225 
00226 private:
00227 
00228   double _GetDistance2ToBoundary(
00229     double x, double y, double z, double *boundaryPt,
00230     int innerBoundaryOnly, vtkOctreePointLocatorNode* top,
00231     int useDataBounds);
00232 
00234   double MinBounds[3];
00235 
00237   double MaxBounds[3];
00238 
00241   double MinDataBounds[3];
00242 
00245   double MaxDataBounds[3];
00246 
00250   int NumberOfPoints;
00251 
00253   vtkOctreePointLocatorNode** Children;
00254 
00256   int ID;
00257 
00261   int MinID;
00262 
00263   vtkOctreePointLocatorNode(const vtkOctreePointLocatorNode&); // Not implemented
00264   void operator=(const vtkOctreePointLocatorNode&); // Not implemented
00265 };
00266 
00267 #endif