VTK  9.2.6
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 x0, double x1, double y0, double y1, double z0, double z1);
96 
98 
103  int IntersectsBox(int* ids, int len, double* x);
104  int IntersectsBox(
105  int* ids, int len, double x0, double x1, double y0, double y1, double z0, double z1);
107 
113  int IntersectsSphere2(int regionId, double x, double y, double z, double rSquared);
114 
121  int IntersectsSphere2(int* ids, int len, double x, double y, double z, double rSquared);
122 
129  int IntersectsCell(int regionId, vtkCell* cell, int cellRegion = -1);
130 
138  int IntersectsCell(int* ids, int len, vtkCell* cell, int cellRegion = -1);
139 
149  vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
150  void SetComputeIntersectionsUsingDataBounds(int c);
151  void ComputeIntersectionsUsingDataBoundsOn();
152  void ComputeIntersectionsUsingDataBoundsOff();
153 
154 protected:
156  ~vtkBSPIntersections() override;
157 
158  vtkGetMacro(RegionListBuildTime, vtkMTimeType);
159 
160  int BuildRegionList();
161 
162  vtkKdNode** GetRegionList() { return this->RegionList; }
163 
164  double CellBoundsCache[6]; // to speed cell intersection queries
165 
166  enum
167  {
168  XDIM = 0, // don't change these values
169  YDIM = 1,
170  ZDIM = 2
171  };
172 
173 private:
174  static int NumberOfLeafNodes(vtkKdNode* kd);
175  static void SetIDRanges(vtkKdNode* kd, int& min, int& max);
176 
177  int SelfRegister(vtkKdNode* kd);
178 
179  static void SetCellBounds(vtkCell* cell, double* bounds);
180 
181  int IntersectsBox_(vtkKdNode* node, int* ids, int len, double x0, double x1, double y0, double y1,
182  double z0, double z1);
183 
184  int IntersectsSphere2_(
185  vtkKdNode* node, int* ids, int len, double x, double y, double z, double rSquared);
186 
187  int IntersectsCell_(vtkKdNode* node, int* ids, int len, vtkCell* cell, int cellRegion = -1);
188 
189  vtkBSPCuts* Cuts;
190 
191  int NumberOfRegions;
192  vtkKdNode** RegionList;
193 
194  vtkTimeStamp RegionListBuildTime;
195 
196  int ComputeIntersectionsUsingDataBounds;
197 
198  vtkBSPIntersections(const vtkBSPIntersections&) = delete;
199  void operator=(const vtkBSPIntersections&) = delete;
200 };
201 #endif
void GetBounds(T a, double bds[6])
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:62
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:287
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:60
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()