VTK
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 =========================================================================*/
50 #ifndef vtkSphereTree_h
51 #define vtkSphereTree_h
52 
53 #include "vtkCommonExecutionModelModule.h" // For export macro
54 #include "vtkPlane.h" // to specify the cutting plane
55 #include "vtkObject.h"
56 
57 class vtkDoubleArray;
58 class vtkDataArray;
59 class vtkIdList;
60 class vtkDataSet;
61 class vtkStructuredGrid;
63 class vtkTimeStamp;
64 struct vtkSphereTreeHierarchy;
65 
66 #define VTK_MAX_SPHERE_TREE_RESOLUTION 10
67 #define VTK_MAX_SPHERE_TREE_LEVELS 20
68 
69 // VTK Class proper
70 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSphereTree : public vtkObject
71 {
72 public:
76  static vtkSphereTree *New();
77 
79 
82  vtkTypeMacro(vtkSphereTree,vtkObject);
83  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
87 
90  virtual void SetDataSet(vtkDataSet*);
91  vtkGetObjectMacro(DataSet,vtkDataSet);
93 
95 
101  void Build();
102  void Build(vtkDataSet *input);
104 
106 
110  vtkSetMacro(BuildHierarchy, bool);
111  vtkGetMacro(BuildHierarchy, bool);
112  vtkBooleanMacro(BuildHierarchy, bool);
114 
116 
125  const unsigned char *SelectPoint(double point[3],
126  vtkIdType &numSelected);
127  const unsigned char *SelectLine(double origin[3], double ray[3],
128  vtkIdType &numSelected);
129  const unsigned char *SelectPlane(double origin[3], double normal[3],
130  vtkIdType &numSelected);
132 
134 
144  void SelectPoint(double point[3], vtkIdList *cellIds);
145  void SelectLine(double origin[3], double ray[3], vtkIdList *cellIds);
146  void SelectPlane(double origin[3], double normal[3], vtkIdList *cellIds);
148 
150 
157  vtkSetClampMacro(Resolution,int,2,VTK_MAX_SPHERE_TREE_RESOLUTION);
158  vtkGetMacro(Resolution,int);
160 
162 
169  vtkSetClampMacro(MaxLevel,int,1,VTK_MAX_SPHERE_TREE_LEVELS);
170  vtkGetMacro(MaxLevel,int);
172 
179  vtkGetMacro(NumberOfLevels,int);
180 
182 
193  const double *GetCellSpheres();
194  const double *GetTreeSpheres(int level, vtkIdType &numSpheres);
196 
197 protected:
198  vtkSphereTree();
199  ~vtkSphereTree() override;
200 
201  // Data members
203  unsigned char *Selected;
205  int MaxLevel;
208 
209  // The tree and its hierarchy
211  double *TreePtr;
212  vtkSphereTreeHierarchy *Hierarchy;
213 
214  // Supporting data members
215  double AverageRadius; //average radius of cell sphere
216  double SphereBounds[6]; //the dataset bounds computed from cell spheres
217  vtkTimeStamp BuildTime; //time at which tree was built
218 
219  // Supporting methods
220  void BuildTreeSpheres(vtkDataSet *input);
221  void ExtractCellIds(const unsigned char *selected, vtkIdList *cellIds,
222  vtkIdType numSelected);
223 
224  void BuildTreeHierarchy(vtkDataSet *input);
225  void BuildStructuredHierarchy(vtkStructuredGrid *input, double *tree);
226  void BuildUnstructuredHierarchy(vtkDataSet *input, double *tree);
227  int SphereTreeType; //keep track of the type of tree hierarchy generated
228 
229 private:
230  vtkSphereTree(const vtkSphereTree&) = delete;
231  void operator=(const vtkSphereTree&) = delete;
232 
233 };
234 
235 #endif
vtkSphereTree::BuildTime
vtkTimeStamp BuildTime
Definition: vtkSphereTree.h:217
vtkSphereTree::AverageRadius
double AverageRadius
Definition: vtkSphereTree.h:215
vtkSphereTree::TreePtr
double * TreePtr
Definition: vtkSphereTree.h:211
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkSphereTree::Resolution
int Resolution
Definition: vtkSphereTree.h:204
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:63
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkSphereTree::BuildHierarchy
bool BuildHierarchy
Definition: vtkSphereTree.h:207
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkSphereTree::DataSet
vtkDataSet * DataSet
Definition: vtkSphereTree.h:202
vtkSphereTree::Tree
vtkDoubleArray * Tree
Definition: vtkSphereTree.h:210
vtkX3D::level
Definition: vtkX3D.h:395
vtkPlane.h
vtkX3D::point
Definition: vtkX3D.h:236
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSphereTree::Selected
unsigned char * Selected
Definition: vtkSphereTree.h:203
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSphereTree::NumberOfLevels
int NumberOfLevels
Definition: vtkSphereTree.h:206
vtkObject.h
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
VTK_MAX_SPHERE_TREE_LEVELS
#define VTK_MAX_SPHERE_TREE_LEVELS
Definition: vtkSphereTree.h:67
vtkSphereTree
class to build and traverse sphere trees
Definition: vtkSphereTree.h:70
vtkSphereTree::SphereTreeType
int SphereTreeType
Definition: vtkSphereTree.h:227
vtkSphereTree::MaxLevel
int MaxLevel
Definition: vtkSphereTree.h:205
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:41
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:87
vtkSphereTree::Hierarchy
vtkSphereTreeHierarchy * Hierarchy
Definition: vtkSphereTree.h:212
VTK_MAX_SPHERE_TREE_RESOLUTION
#define VTK_MAX_SPHERE_TREE_RESOLUTION
Definition: vtkSphereTree.h:66