VTK
vtkBSPIntersections.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBSPIntersections.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
33 #ifndef vtkBSPIntersections_h
34 #define vtkBSPIntersections_h
35 
36 #include "vtkCommonDataModelModule.h" // For export macro
37 #include "vtkObject.h"
38 
39 class vtkTimeStamp;
40 class vtkCell;
41 class vtkKdNode;
42 class vtkBSPCuts;
43 
45 {
46 public:
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
50  static vtkBSPIntersections *New();
51 
54  void SetCuts(vtkBSPCuts *cuts);
55  vtkGetObjectMacro(Cuts, vtkBSPCuts);
56 
60  int GetBounds(double *bounds);
61 
64  int GetNumberOfRegions();
65 
69  int GetRegionBounds(int regionID, double bounds[6]);
70 
74  int GetRegionDataBounds(int regionID, double bounds[6]);
75 
77 
79  int IntersectsBox(int regionId, double *x);
80  int IntersectsBox(int regionId, double xmin, double xmax,
81  double ymin, double ymax,
82  double zmin, double zmax);
84 
86 
88  int IntersectsBox(int *ids, int len, double *x);
89  int IntersectsBox(int *ids, int len, double x0, double x1,
90  double y0, double y1, double z0, double z1);
92 
94 
96  int IntersectsSphere2(int regionId,
97  double x, double y, double z, double rSquared);
99 
101 
104  int IntersectsSphere2(int *ids, int len,
105  double x, double y, double z, double rSquared);
107 
112  int IntersectsCell(int regionId, vtkCell *cell, int cellRegion=-1);
113 
118  int IntersectsCell(int *ids, int len, vtkCell *cell, int cellRegion=-1);
119 
127  vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
128  void SetComputeIntersectionsUsingDataBounds(int c);
129  void ComputeIntersectionsUsingDataBoundsOn();
130  void ComputeIntersectionsUsingDataBoundsOff();
131 
132 protected:
133 
136 
137  vtkGetMacro(RegionListBuildTime, unsigned long);
138 
139  int BuildRegionList();
140 
141  vtkKdNode **GetRegionList(){return this->RegionList;}
142 
143  double CellBoundsCache[6]; // to speed cell intersection queries
144 
145 //BTX
146  enum {
147  XDIM = 0, // don't change these values
148  YDIM = 1,
149  ZDIM = 2
150  };
151 //ETX
152 
153 private:
154 
155  static int NumberOfLeafNodes(vtkKdNode *kd);
156  static void SetIDRanges(vtkKdNode *kd, int &min, int &max);
157 
158  int SelfRegister(vtkKdNode *kd);
159 
160  static void SetCellBounds(vtkCell *cell, double *bounds);
161 
162  int _IntersectsBox(vtkKdNode *node, int *ids, int len,
163  double x0, double x1,
164  double y0, double y1,
165  double z0, double z1);
166 
167  int _IntersectsSphere2(vtkKdNode *node, int *ids, int len,
168  double x, double y, double z, double rSquared);
169 
170  int _IntersectsCell(vtkKdNode *node, int *ids, int len,
171  vtkCell *cell, int cellRegion=-1);
172 
173  vtkBSPCuts *Cuts;
174 
175  int NumberOfRegions;
176  vtkKdNode **RegionList;
177 
178  vtkTimeStamp RegionListBuildTime;
179 
180  int ComputeIntersectionsUsingDataBounds;
181 
182  vtkBSPIntersections(const vtkBSPIntersections&); // Not implemented
183  void operator=(const vtkBSPIntersections&); // Not implemented
184 };
185 #endif
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning...
Definition: vtkKdNode.h:44
abstract base class for most VTK objects
Definition: vtkObject.h:61
Perform calculations (mostly intersection calculations) on regions of a 3D binary spatial partitionin...
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:43
record modification and/or execution time
Definition: vtkTimeStamp.h:34
abstract class to specify cell behavior
Definition: vtkCell.h:58
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
static vtkObject * New()
#define VTKCOMMONDATAMODEL_EXPORT
#define max(a, b)
vtkKdNode ** GetRegionList()