VTK  9.3.20240420
vtkBSPIntersections.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3// SPDX-License-Identifier: BSD-3-Clause
4
19#ifndef vtkBSPIntersections_h
20#define vtkBSPIntersections_h
21
22#include "vtkCommonDataModelModule.h" // For export macro
23#include "vtkObject.h"
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkTimeStamp;
27class vtkCell;
28class vtkKdNode;
29class vtkBSPCuts;
30
31class VTKCOMMONDATAMODEL_EXPORT vtkBSPIntersections : public vtkObject
32{
33public:
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
38
43 void SetCuts(vtkBSPCuts* cuts);
44 vtkGetObjectMacro(Cuts, vtkBSPCuts);
45
51 int GetBounds(double* bounds);
52
58
64 int GetRegionBounds(int regionID, double bounds[6]);
65
72 int GetRegionDataBounds(int regionID, double bounds[6]);
73
75
79 int IntersectsBox(int regionId, double* x);
80 int IntersectsBox(int regionId, double x0, double x1, double y0, double y1, double z0, double z1);
82
84
89 int IntersectsBox(int* ids, int len, double* x);
91 int* ids, int len, double x0, double x1, double y0, double y1, double z0, double z1);
93
99 int IntersectsSphere2(int regionId, double x, double y, double z, double rSquared);
100
107 int IntersectsSphere2(int* ids, int len, double x, double y, double z, double rSquared);
108
115 int IntersectsCell(int regionId, vtkCell* cell, int cellRegion = -1);
116
124 int IntersectsCell(int* ids, int len, vtkCell* cell, int cellRegion = -1);
125
135 vtkGetMacro(ComputeIntersectionsUsingDataBounds, int);
139
140protected:
143
144 vtkGetMacro(RegionListBuildTime, vtkMTimeType);
145
147
148 vtkKdNode** GetRegionList() { return this->RegionList; }
149
150 double CellBoundsCache[6]; // to speed cell intersection queries
151
152 enum
153 {
154 XDIM = 0, // don't change these values
155 YDIM = 1,
156 ZDIM = 2
157 };
158
159private:
160 static int NumberOfLeafNodes(vtkKdNode* kd);
161 static void SetIDRanges(vtkKdNode* kd, int& min, int& max);
162
163 int SelfRegister(vtkKdNode* kd);
164
165 static void SetCellBounds(vtkCell* cell, double* bounds);
166
167 int IntersectsBox_(vtkKdNode* node, int* ids, int len, double x0, double x1, double y0, double y1,
168 double z0, double z1);
169
170 int IntersectsSphere2_(
171 vtkKdNode* node, int* ids, int len, double x, double y, double z, double rSquared);
172
173 int IntersectsCell_(vtkKdNode* node, int* ids, int len, vtkCell* cell, int cellRegion = -1);
174
175 vtkBSPCuts* Cuts;
176
177 int NumberOfRegions;
178 vtkKdNode** RegionList;
179
180 vtkTimeStamp RegionListBuildTime;
181
182 int ComputeIntersectionsUsingDataBounds;
183
185 void operator=(const vtkBSPIntersections&) = delete;
186};
187VTK_ABI_NAMESPACE_END
188#endif
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition vtkBSPCuts.h:31
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.
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:130
a simple class to control print indentation
Definition vtkIndent.h:108
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning.
Definition vtkKdNode.h:32
abstract base class for most VTK objects
Definition vtkObject.h:162
record modification and/or execution time
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define max(a, b)