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:
197  vtkSphereTree();
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
219  void BuildTreeSpheres(vtkDataSet* input);
220  void ExtractCellIds(const unsigned char* selected, vtkIdList* cellIds, vtkIdType numSelected);
221 
222  void BuildTreeHierarchy(vtkDataSet* input);
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 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.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
record modification and/or execution time
Definition: vtkTimeStamp.h:35
int vtkIdType
Definition: vtkType.h:332
dynamic, self-adjusting array of double
vtkSphereTreeHierarchy * Hierarchy
double * TreePtr
vtkDataSet * DataSet
vtkDoubleArray * Tree
unsigned char * Selected
a simple class to control print indentation
Definition: vtkIndent.h:39
list of point or cell ids
Definition: vtkIdList.h:33
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:39
vtkTimeStamp BuildTime
#define VTK_MAX_SPHERE_TREE_LEVELS
Definition: vtkSphereTree.h:69
topologically regular array of data
class to build and traverse sphere trees
Definition: vtkSphereTree.h:72
double AverageRadius
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
#define VTK_MAX_SPHERE_TREE_RESOLUTION
Definition: vtkSphereTree.h:68