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 
34 #ifndef vtkBSPIntersections_h
35 #define vtkBSPIntersections_h
36 
37 #include "vtkCommonDataModelModule.h" // For export macro
38 #include "vtkObject.h"
39 
40 class vtkTimeStamp;
41 class vtkCell;
42 class vtkKdNode;
43 class vtkBSPCuts;
44 
45 class VTKCOMMONDATAMODEL_EXPORT vtkBSPIntersections : public vtkObject
46 {
47 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
51  static vtkBSPIntersections *New();
52 
57  void SetCuts(vtkBSPCuts *cuts);
58  vtkGetObjectMacro(Cuts, vtkBSPCuts);
59 
65  int GetBounds(double *bounds);
66 
71  int GetNumberOfRegions();
72 
78  int GetRegionBounds(int regionID, double bounds[6]);
79 
86  int GetRegionDataBounds(int regionID, double bounds[6]);
87 
89 
93  int IntersectsBox(int regionId, double *x);
94  int IntersectsBox(int regionId, double xmin, double xmax,
95  double ymin, double ymax,
96  double zmin, double zmax);
98 
100 
105  int IntersectsBox(int *ids, int len, double *x);
106  int IntersectsBox(int *ids, int len, double x0, double x1,
107  double y0, double y1, double z0, double z1);
109 
115  int IntersectsSphere2(int regionId,
116  double x, double y, double z, double rSquared);
117 
124  int IntersectsSphere2(int *ids, int len,
125  double x, double y, double z, double rSquared);
126 
133  int IntersectsCell(int regionId, vtkCell *cell, int cellRegion=-1);
134 
142  int IntersectsCell(int *ids, int len, vtkCell *cell, int cellRegion=-1);
143 
153  vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
154  void SetComputeIntersectionsUsingDataBounds(int c);
155  void ComputeIntersectionsUsingDataBoundsOn();
156  void ComputeIntersectionsUsingDataBoundsOff();
157 
158 protected:
159 
161  ~vtkBSPIntersections() override;
162 
163  vtkGetMacro(RegionListBuildTime, vtkMTimeType);
164 
165  int BuildRegionList();
166 
167  vtkKdNode **GetRegionList(){return this->RegionList;}
168 
169  double CellBoundsCache[6]; // to speed cell intersection queries
170 
171  enum {
172  XDIM = 0, // don't change these values
173  YDIM = 1,
174  ZDIM = 2
175  };
176 
177 private:
178 
179  static int NumberOfLeafNodes(vtkKdNode *kd);
180  static void SetIDRanges(vtkKdNode *kd, int &min, int &max);
181 
182  int SelfRegister(vtkKdNode *kd);
183 
184  static void SetCellBounds(vtkCell *cell, double *bounds);
185 
186  int _IntersectsBox(vtkKdNode *node, int *ids, int len,
187  double x0, double x1,
188  double y0, double y1,
189  double z0, double z1);
190 
191  int _IntersectsSphere2(vtkKdNode *node, int *ids, int len,
192  double x, double y, double z, double rSquared);
193 
194  int _IntersectsCell(vtkKdNode *node, int *ids, int len,
195  vtkCell *cell, int cellRegion=-1);
196 
197  vtkBSPCuts *Cuts;
198 
199  int NumberOfRegions;
200  vtkKdNode **RegionList;
201 
202  vtkTimeStamp RegionListBuildTime;
203 
204  int ComputeIntersectionsUsingDataBounds;
205 
206  vtkBSPIntersections(const vtkBSPIntersections&) = delete;
207  void operator=(const vtkBSPIntersections&) = delete;
208 };
209 #endif
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning...
Definition: vtkKdNode.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Perform calculations (mostly intersection calculations) on regions of a 3D binary spatial partitionin...
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract class to specify cell behavior
Definition: vtkCell.h:59
a simple class to control print indentation
Definition: vtkIndent.h:39
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
#define max(a, b)
vtkKdNode ** GetRegionList()