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(
95  int regionId, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
97 
99 
104  int IntersectsBox(int* ids, int len, double* x);
105  int IntersectsBox(
106  int* ids, int len, double x0, double x1, double y0, double y1, double z0, double z1);
108 
114  int IntersectsSphere2(int regionId, double x, double y, double z, double rSquared);
115 
122  int IntersectsSphere2(int* ids, int len, double x, double y, double z, double rSquared);
123 
130  int IntersectsCell(int regionId, vtkCell* cell, int cellRegion = -1);
131 
139  int IntersectsCell(int* ids, int len, vtkCell* cell, int cellRegion = -1);
140 
150  vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
151  void SetComputeIntersectionsUsingDataBounds(int c);
152  void ComputeIntersectionsUsingDataBoundsOn();
153  void ComputeIntersectionsUsingDataBoundsOff();
154 
155 protected:
157  ~vtkBSPIntersections() override;
158 
159  vtkGetMacro(RegionListBuildTime, vtkMTimeType);
160 
161  int BuildRegionList();
162 
163  vtkKdNode** GetRegionList() { return this->RegionList; }
164 
165  double CellBoundsCache[6]; // to speed cell intersection queries
166 
167  enum
168  {
169  XDIM = 0, // don't change these values
170  YDIM = 1,
171  ZDIM = 2
172  };
173 
174 private:
175  static int NumberOfLeafNodes(vtkKdNode* kd);
176  static void SetIDRanges(vtkKdNode* kd, int& min, int& max);
177 
178  int SelfRegister(vtkKdNode* kd);
179 
180  static void SetCellBounds(vtkCell* cell, double* bounds);
181 
182  int _IntersectsBox(vtkKdNode* node, int* ids, int len, double x0, double x1, double y0, double y1,
183  double z0, double z1);
184 
185  int _IntersectsSphere2(
186  vtkKdNode* node, int* ids, int len, double x, double y, double z, double rSquared);
187 
188  int _IntersectsCell(vtkKdNode* node, int* ids, int len, vtkCell* cell, int cellRegion = -1);
189 
190  vtkBSPCuts* Cuts;
191 
192  int NumberOfRegions;
193  vtkKdNode** RegionList;
194 
195  vtkTimeStamp RegionListBuildTime;
196 
197  int ComputeIntersectionsUsingDataBounds;
198 
199  vtkBSPIntersections(const vtkBSPIntersections&) = delete;
200  void operator=(const vtkBSPIntersections&) = delete;
201 };
202 #endif
vtkKdNode
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning....
Definition: vtkKdNode.h:42
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkBSPIntersections
Perform calculations (mostly intersection calculations) on regions of a 3D binary spatial partitionin...
Definition: vtkBSPIntersections.h:45
vtkBSPIntersections::GetRegionList
vtkKdNode ** GetRegionList()
Definition: vtkBSPIntersections.h:163
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkBSPCuts
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:44
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:298