VTK
dox/Filtering/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 "vtkObject.h"
00037 
00038 class vtkTimeStamp;
00039 class vtkCell;
00040 class vtkKdNode;
00041 class vtkBSPCuts;
00042 
00043 class VTK_FILTERING_EXPORT vtkBSPIntersections : public vtkObject
00044 {
00045 public:
00046   vtkTypeMacro(vtkBSPIntersections, vtkObject);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00049   static vtkBSPIntersections *New();
00050 
00053   void SetCuts(vtkBSPCuts *cuts);
00054   vtkGetObjectMacro(Cuts, vtkBSPCuts);
00055 
00059   int GetBounds(double *bounds);
00060 
00063   int GetNumberOfRegions();
00064 
00068   int GetRegionBounds(int regionID, double bounds[6]);
00069 
00073   int GetRegionDataBounds(int regionID, double bounds[6]);
00074 
00076 
00078   int IntersectsBox(int regionId, double *x); 
00079   int IntersectsBox(int regionId, double xmin, double xmax, 
00080                     double ymin, double ymax, 
00081                     double zmin, double zmax); 
00083 
00085 
00087   int IntersectsBox(int *ids, int len,  double *x); 
00088   int IntersectsBox(int *ids, int len,  double x0, double x1, 
00089                     double y0, double y1, double z0, double z1); 
00091 
00093 
00095   int IntersectsSphere2(int regionId, 
00096                         double x, double y, double z, double rSquared);
00098 
00100 
00103   int IntersectsSphere2(int *ids, int len, 
00104                         double x, double y, double z, double rSquared);
00106 
00111   int IntersectsCell(int regionId, vtkCell *cell, int cellRegion=-1);
00112 
00117   int IntersectsCell(int *ids, int len, vtkCell *cell, int cellRegion=-1);
00118 
00126   vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
00127   void SetComputeIntersectionsUsingDataBounds(int c);
00128   void ComputeIntersectionsUsingDataBoundsOn();
00129   void ComputeIntersectionsUsingDataBoundsOff();
00130 
00131 protected:
00132 
00133   vtkBSPIntersections();
00134   ~vtkBSPIntersections();
00135 
00136   vtkGetMacro(RegionListBuildTime, unsigned long);
00137 
00138   int BuildRegionList();
00139 
00140   vtkKdNode **GetRegionList(){return this->RegionList;}
00141 
00142   double CellBoundsCache[6];   // to speed cell intersection queries
00143 
00144 //BTX
00145   enum {
00146     XDIM = 0,  // don't change these values
00147     YDIM = 1,
00148     ZDIM = 2
00149   };
00150 //ETX
00151 
00152 private:
00153 
00154   static int NumberOfLeafNodes(vtkKdNode *kd);
00155   static void SetIDRanges(vtkKdNode *kd, int &min, int &max);
00156 
00157   int SelfRegister(vtkKdNode *kd);
00158 
00159   static void SetCellBounds(vtkCell *cell, double *bounds);
00160 
00161   int _IntersectsBox(vtkKdNode *node, int *ids, int len,
00162                      double x0, double x1,
00163                      double y0, double y1, 
00164                      double z0, double z1);
00165 
00166   int _IntersectsSphere2(vtkKdNode *node, int *ids, int len,
00167                          double x, double y, double z, double rSquared);
00168 
00169   int _IntersectsCell(vtkKdNode *node, int *ids, int len,
00170                       vtkCell *cell, int cellRegion=-1);
00171 
00172   vtkBSPCuts *Cuts;
00173 
00174   int NumberOfRegions;
00175   vtkKdNode **RegionList;
00176 
00177   vtkTimeStamp RegionListBuildTime;
00178 
00179   int ComputeIntersectionsUsingDataBounds;
00180 
00181   vtkBSPIntersections(const vtkBSPIntersections&); // Not implemented
00182   void operator=(const vtkBSPIntersections&); // Not implemented
00183 };
00184 #endif