VTK  9.3.20241004
vtkSphereTree.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
40#ifndef vtkSphereTree_h
41#define vtkSphereTree_h
42
43#include "vtkCommonExecutionModelModule.h" // For export macro
44#include "vtkObject.h"
45#include "vtkPlane.h" // to specify the cutting plane
46
47VTK_ABI_NAMESPACE_BEGIN
48class vtkDoubleArray;
49class vtkDataArray;
50class vtkIdList;
51class vtkDataSet;
54class vtkTimeStamp;
55struct vtkSphereTreeHierarchy;
56
57#define VTK_MAX_SPHERE_TREE_RESOLUTION 10
58#define VTK_MAX_SPHERE_TREE_LEVELS 20
59
60// VTK Class proper
61class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSphereTree : public vtkObject
62{
63public:
67 static vtkSphereTree* New();
68
70
73 vtkTypeMacro(vtkSphereTree, vtkObject);
74 void PrintSelf(ostream& os, vtkIndent indent) override;
76
78
81 virtual void SetDataSet(vtkDataSet*);
82 vtkGetObjectMacro(DataSet, vtkDataSet);
84
86
92 void Build();
93 void Build(vtkDataSet* input);
95
97
101 vtkSetMacro(BuildHierarchy, bool);
102 vtkGetMacro(BuildHierarchy, bool);
103 vtkBooleanMacro(BuildHierarchy, bool);
105
107
116 const unsigned char* SelectPoint(double point[3], vtkIdType& numSelected);
117 const unsigned char* SelectLine(double origin[3], double ray[3], vtkIdType& numSelected);
118 const unsigned char* SelectPlane(double origin[3], double normal[3], vtkIdType& numSelected);
120
122
132 void SelectPoint(double point[3], vtkIdList* cellIds);
133 void SelectLine(double origin[3], double ray[3], vtkIdList* cellIds);
134 void SelectPlane(double origin[3], double normal[3], vtkIdList* cellIds);
136
138
145 vtkSetClampMacro(Resolution, int, 2, VTK_MAX_SPHERE_TREE_RESOLUTION);
146 vtkGetMacro(Resolution, int);
148
150
157 vtkSetClampMacro(MaxLevel, int, 1, VTK_MAX_SPHERE_TREE_LEVELS);
158 vtkGetMacro(MaxLevel, int);
160
167 vtkGetMacro(NumberOfLevels, int);
168
170
181 const double* GetCellSpheres();
182 const double* GetTreeSpheres(int level, vtkIdType& numSpheres);
184
186
189 bool UsesGarbageCollector() const override { return true; }
191
192protected:
194 ~vtkSphereTree() override;
195
196 // Data members
198 unsigned char* Selected;
203
204 // The tree and its hierarchy
206 double* TreePtr;
207 vtkSphereTreeHierarchy* Hierarchy;
208
209 // Supporting data members
210 double AverageRadius; // average radius of cell sphere
211 double SphereBounds[6]; // the dataset bounds computed from cell spheres
212 vtkTimeStamp BuildTime; // time at which tree was built
213
214 // Supporting methods
216 void ExtractCellIds(const unsigned char* selected, vtkIdList* cellIds, vtkIdType numSelected);
217
219 void BuildStructuredHierarchy(vtkStructuredGrid* input, double* tree);
220 void BuildUnstructuredHierarchy(vtkDataSet* input, double* tree);
221 int SphereTreeType; // keep track of the type of tree hierarchy generated
222
224
225private:
226 vtkSphereTree(const vtkSphereTree&) = delete;
227 void operator=(const vtkSphereTree&) = delete;
228};
229
230VTK_ABI_NAMESPACE_END
231#endif
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
dynamic, self-adjusting array of double
Detect and break reference loops.
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
class to build and traverse sphere trees
virtual void SetDataSet(vtkDataSet *)
Specify the dataset from which to build the sphere tree.
~vtkSphereTree() override
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type related macros and PrintSelf() method.
const unsigned char * SelectPlane(double origin[3], double normal[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
const unsigned char * SelectLine(double origin[3], double ray[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
void SelectPlane(double origin[3], double normal[3], vtkIdList *cellIds)
Methods for cell selection based on a geometric query.
void BuildStructuredHierarchy(vtkStructuredGrid *input, double *tree)
void BuildTreeSpheres(vtkDataSet *input)
void SelectLine(double origin[3], double ray[3], vtkIdList *cellIds)
Methods for cell selection based on a geometric query.
vtkTimeStamp BuildTime
void SelectPoint(double point[3], vtkIdList *cellIds)
Methods for cell selection based on a geometric query.
const unsigned char * SelectPoint(double point[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
const double * GetCellSpheres()
Special methods to retrieve the sphere tree data.
vtkDataSet * DataSet
unsigned char * Selected
void ExtractCellIds(const unsigned char *selected, vtkIdList *cellIds, vtkIdType numSelected)
void Build()
Build the sphere tree (if necessary) from the data set specified.
vtkSphereTreeHierarchy * Hierarchy
void ReportReferences(vtkGarbageCollector *) override
vtkDoubleArray * Tree
void Build(vtkDataSet *input)
Build the sphere tree (if necessary) from the data set specified.
void BuildUnstructuredHierarchy(vtkDataSet *input, double *tree)
void BuildTreeHierarchy(vtkDataSet *input)
static vtkSphereTree * New()
Instantiate the sphere tree.
const double * GetTreeSpheres(int level, vtkIdType &numSpheres)
Special methods to retrieve the sphere tree data.
bool UsesGarbageCollector() const override
Participate in garbage collection via ReportReferences.
topologically regular array of data
record modification and/or execution time
dataset represents arbitrary combinations of all possible cell types
#define VTK_MAX_SPHERE_TREE_RESOLUTION
#define VTK_MAX_SPHERE_TREE_LEVELS
int vtkIdType
Definition vtkType.h:315