VTK  9.1.0
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
40class vtkTimeStamp;
41class vtkCell;
42class vtkKdNode;
43class vtkBSPCuts;
44
45class VTKCOMMONDATAMODEL_EXPORT vtkBSPIntersections : public vtkObject
46{
47public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
52
57 void SetCuts(vtkBSPCuts* cuts);
58 vtkGetObjectMacro(Cuts, vtkBSPCuts);
59
65 int GetBounds(double* bounds);
66
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);
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);
153
154protected:
157
158 vtkGetMacro(RegionListBuildTime, vtkMTimeType);
159
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
173private:
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
199 void operator=(const vtkBSPIntersections&) = delete;
200};
201#endif
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:45
Perform calculations (mostly intersection calculations) on regions of a 3D binary spatial partitionin...
int IntersectsBox(int *ids, int len, double *x)
Compute a list of the Ids of all regions that intersect the specified axis aligned box.
int IntersectsBox(int *ids, int len, double x0, double x1, double y0, double y1, double z0, double z1)
Compute a list of the Ids of all regions that intersect the specified axis aligned box.
int IntersectsBox(int regionId, double *x)
Determine whether a region of the spatial decomposition intersects an axis aligned box.
vtkKdNode ** GetRegionList()
void SetComputeIntersectionsUsingDataBounds(int c)
void SetCuts(vtkBSPCuts *cuts)
Define the binary spatial partitioning.
int GetNumberOfRegions()
The number of regions in the binary spatial partitioning.
int IntersectsSphere2(int regionId, double x, double y, double z, double rSquared)
Determine whether a region of the spatial decomposition intersects a sphere, given the center of the ...
void ComputeIntersectionsUsingDataBoundsOn()
int GetRegionBounds(int regionID, double bounds[6])
Get the spatial bounds of a particular region Return 0 if OK, 1 on error.
int GetRegionDataBounds(int regionID, double bounds[6])
Get the bounds of the data within the k-d tree region, possibly smaller than the bounds of the region...
int IntersectsCell(int regionId, vtkCell *cell, int cellRegion=-1)
Determine whether a region of the spatial decomposition intersects the given cell.
static vtkBSPIntersections * New()
int IntersectsBox(int regionId, double x0, double x1, double y0, double y1, double z0, double z1)
Determine whether a region of the spatial decomposition intersects an axis aligned box.
~vtkBSPIntersections() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetBounds(double *bounds)
Get the bounds of the whole space (xmin, xmax, ymin, ymax, zmin, zmax) Return 0 if OK,...
int IntersectsCell(int *ids, int len, vtkCell *cell, int cellRegion=-1)
Compute a list of the Ids of all regions that intersect the given cell.
int IntersectsSphere2(int *ids, int len, double x, double y, double z, double rSquared)
Compute a list of the Ids of all regions that intersect the specified sphere.
void ComputeIntersectionsUsingDataBoundsOff()
abstract class to specify cell behavior
Definition: vtkCell.h:147
a simple class to control print indentation
Definition: vtkIndent.h:113
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning.
Definition: vtkKdNode.h:43
abstract base class for most VTK objects
Definition: vtkObject.h:82
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define max(a, b)