VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Common/DataModel/vtkBSPIntersections.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkBSPIntersections.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 
00033 #ifndef vtkBSPIntersections_h
00034 #define vtkBSPIntersections_h
00035 
00036 #include "vtkCommonDataModelModule.h" // For export macro
00037 #include "vtkObject.h"
00038 
00039 class vtkTimeStamp;
00040 class vtkCell;
00041 class vtkKdNode;
00042 class vtkBSPCuts;
00043 
00044 class VTKCOMMONDATAMODEL_EXPORT vtkBSPIntersections : public vtkObject
00045 {
00046 public:
00047   vtkTypeMacro(vtkBSPIntersections, vtkObject);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00050   static vtkBSPIntersections *New();
00051 
00054   void SetCuts(vtkBSPCuts *cuts);
00055   vtkGetObjectMacro(Cuts, vtkBSPCuts);
00056 
00060   int GetBounds(double *bounds);
00061 
00064   int GetNumberOfRegions();
00065 
00069   int GetRegionBounds(int regionID, double bounds[6]);
00070 
00074   int GetRegionDataBounds(int regionID, double bounds[6]);
00075 
00077 
00079   int IntersectsBox(int regionId, double *x);
00080   int IntersectsBox(int regionId, double xmin, double xmax,
00081                     double ymin, double ymax,
00082                     double zmin, double zmax);
00084 
00086 
00088   int IntersectsBox(int *ids, int len,  double *x);
00089   int IntersectsBox(int *ids, int len,  double x0, double x1,
00090                     double y0, double y1, double z0, double z1);
00092 
00094 
00096   int IntersectsSphere2(int regionId,
00097                         double x, double y, double z, double rSquared);
00099 
00101 
00104   int IntersectsSphere2(int *ids, int len,
00105                         double x, double y, double z, double rSquared);
00107 
00112   int IntersectsCell(int regionId, vtkCell *cell, int cellRegion=-1);
00113 
00118   int IntersectsCell(int *ids, int len, vtkCell *cell, int cellRegion=-1);
00119 
00127   vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
00128   void SetComputeIntersectionsUsingDataBounds(int c);
00129   void ComputeIntersectionsUsingDataBoundsOn();
00130   void ComputeIntersectionsUsingDataBoundsOff();
00131 
00132 protected:
00133 
00134   vtkBSPIntersections();
00135   ~vtkBSPIntersections();
00136 
00137   vtkGetMacro(RegionListBuildTime, unsigned long);
00138 
00139   int BuildRegionList();
00140 
00141   vtkKdNode **GetRegionList(){return this->RegionList;}
00142 
00143   double CellBoundsCache[6];   // to speed cell intersection queries
00144 
00145 //BTX
00146   enum {
00147     XDIM = 0,  // don't change these values
00148     YDIM = 1,
00149     ZDIM = 2
00150   };
00151 //ETX
00152 
00153 private:
00154 
00155   static int NumberOfLeafNodes(vtkKdNode *kd);
00156   static void SetIDRanges(vtkKdNode *kd, int &min, int &max);
00157 
00158   int SelfRegister(vtkKdNode *kd);
00159 
00160   static void SetCellBounds(vtkCell *cell, double *bounds);
00161 
00162   int _IntersectsBox(vtkKdNode *node, int *ids, int len,
00163                      double x0, double x1,
00164                      double y0, double y1,
00165                      double z0, double z1);
00166 
00167   int _IntersectsSphere2(vtkKdNode *node, int *ids, int len,
00168                          double x, double y, double z, double rSquared);
00169 
00170   int _IntersectsCell(vtkKdNode *node, int *ids, int len,
00171                       vtkCell *cell, int cellRegion=-1);
00172 
00173   vtkBSPCuts *Cuts;
00174 
00175   int NumberOfRegions;
00176   vtkKdNode **RegionList;
00177 
00178   vtkTimeStamp RegionListBuildTime;
00179 
00180   int ComputeIntersectionsUsingDataBounds;
00181 
00182   vtkBSPIntersections(const vtkBSPIntersections&); // Not implemented
00183   void operator=(const vtkBSPIntersections&); // Not implemented
00184 };
00185 #endif