VTK  9.2.6
vtkSphereTree.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSphereTree.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 =========================================================================*/
52 #ifndef vtkSphereTree_h
53 #define vtkSphereTree_h
54 
55 #include "vtkCommonExecutionModelModule.h" // For export macro
56 #include "vtkObject.h"
57 #include "vtkPlane.h" // to specify the cutting plane
58 
59 class vtkDoubleArray;
60 class vtkDataArray;
61 class vtkIdList;
62 class vtkDataSet;
63 class vtkStructuredGrid;
65 class vtkTimeStamp;
66 struct vtkSphereTreeHierarchy;
67 
68 #define VTK_MAX_SPHERE_TREE_RESOLUTION 10
69 #define VTK_MAX_SPHERE_TREE_LEVELS 20
70 
71 // VTK Class proper
72 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSphereTree : public vtkObject
73 {
74 public:
78  static vtkSphereTree* New();
79 
81 
84  vtkTypeMacro(vtkSphereTree, vtkObject);
85  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
89 
92  virtual void SetDataSet(vtkDataSet*);
93  vtkGetObjectMacro(DataSet, vtkDataSet);
95 
97 
103  void Build();
104  void Build(vtkDataSet* input);
106 
108 
112  vtkSetMacro(BuildHierarchy, bool);
113  vtkGetMacro(BuildHierarchy, bool);
114  vtkBooleanMacro(BuildHierarchy, bool);
116 
118 
127  const unsigned char* SelectPoint(double point[3], vtkIdType& numSelected);
128  const unsigned char* SelectLine(double origin[3], double ray[3], vtkIdType& numSelected);
129  const unsigned char* SelectPlane(double origin[3], double normal[3], vtkIdType& numSelected);
131 
133 
143  void SelectPoint(double point[3], vtkIdList* cellIds);
144  void SelectLine(double origin[3], double ray[3], vtkIdList* cellIds);
145  void SelectPlane(double origin[3], double normal[3], vtkIdList* cellIds);
147 
149 
156  vtkSetClampMacro(Resolution, int, 2, VTK_MAX_SPHERE_TREE_RESOLUTION);
157  vtkGetMacro(Resolution, int);
159 
161 
168  vtkSetClampMacro(MaxLevel, int, 1, VTK_MAX_SPHERE_TREE_LEVELS);
169  vtkGetMacro(MaxLevel, int);
171 
178  vtkGetMacro(NumberOfLevels, int);
179 
181 
192  const double* GetCellSpheres();
193  const double* GetTreeSpheres(int level, vtkIdType& numSpheres);
195 
196 protected:
198  ~vtkSphereTree() override;
199 
200  // Data members
202  unsigned char* Selected;
204  int MaxLevel;
207 
208  // The tree and its hierarchy
210  double* TreePtr;
211  vtkSphereTreeHierarchy* Hierarchy;
212 
213  // Supporting data members
214  double AverageRadius; // average radius of cell sphere
215  double SphereBounds[6]; // the dataset bounds computed from cell spheres
216  vtkTimeStamp BuildTime; // time at which tree was built
217 
218  // Supporting methods
220  void ExtractCellIds(const unsigned char* selected, vtkIdList* cellIds, vtkIdType numSelected);
221 
223  void BuildStructuredHierarchy(vtkStructuredGrid* input, double* tree);
224  void BuildUnstructuredHierarchy(vtkDataSet* input, double* tree);
225  int SphereTreeType; // keep track of the type of tree hierarchy generated
226 
227 private:
228  vtkSphereTree(const vtkSphereTree&) = delete;
229  void operator=(const vtkSphereTree&) = delete;
230 };
231 
232 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
dynamic, self-adjusting array of double
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
class to build and traverse sphere trees
Definition: vtkSphereTree.h:73
const unsigned char * SelectPoint(double point[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
virtual void SetDataSet(vtkDataSet *)
Specify the dataset from which to build the sphere tree.
~vtkSphereTree() override
const double * GetCellSpheres()
Special methods to retrieve the sphere tree data.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type related macros and PrintSelf() method.
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.
double * TreePtr
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
const unsigned char * SelectLine(double origin[3], double ray[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
const double * GetTreeSpheres(int level, vtkIdType &numSpheres)
Special methods to retrieve the sphere tree data.
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)
const unsigned char * SelectPlane(double origin[3], double normal[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
double AverageRadius
static vtkSphereTree * New()
Instantiate the sphere tree.
topologically regular array of data
record modification and/or execution time
Definition: vtkTimeStamp.h:55
dataset represents arbitrary combinations of all possible cell types
@ point
Definition: vtkX3D.h:242
@ level
Definition: vtkX3D.h:401
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:39
#define VTK_MAX_SPHERE_TREE_RESOLUTION
Definition: vtkSphereTree.h:68
#define VTK_MAX_SPHERE_TREE_LEVELS
Definition: vtkSphereTree.h:69
int vtkIdType
Definition: vtkType.h:332