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:
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
221  void ExtractCellIds(const unsigned char *selected, vtkIdList *cellIds,
222  vtkIdType numSelected);
223 
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::BuildUnstructuredHierarchy
void BuildUnstructuredHierarchy(vtkDataSet *input, double *tree)
vtkSphereTree::TreePtr
double * TreePtr
Definition: vtkSphereTree.h:211
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkSphereTree::SelectPoint
const unsigned char * SelectPoint(double point[3], vtkIdType &numSelected)
Methods for cell selection based on a geometric query.
vtkSphereTree::SelectLine
void SelectLine(double origin[3], double ray[3], vtkIdList *cellIds)
vtkSphereTree::BuildTreeHierarchy
void BuildTreeHierarchy(vtkDataSet *input)
vtkSphereTree::Resolution
int Resolution
Definition: vtkSphereTree.h:204
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:64
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkSphereTree::BuildHierarchy
bool BuildHierarchy
Definition: vtkSphereTree.h:207
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkSphereTree::DataSet
vtkDataSet * DataSet
Definition: vtkSphereTree.h:202
vtkSphereTree::GetCellSpheres
const double * GetCellSpheres()
Special methods to retrieve the sphere tree data.
vtkSphereTree::SelectPlane
void SelectPlane(double origin[3], double normal[3], vtkIdList *cellIds)
vtkSphereTree::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSphereTree::vtkSphereTree
vtkSphereTree()
vtkSphereTree::Tree
vtkDoubleArray * Tree
Definition: vtkSphereTree.h:210
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkPlane.h
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkSphereTree::SetDataSet
virtual void SetDataSet(vtkDataSet *)
Specify the dataset from which to build the sphere tree.
vtkSphereTree::New
static vtkSphereTree * New()
Instantiate the sphere tree.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSphereTree::Selected
unsigned char * Selected
Definition: vtkSphereTree.h:203
vtkSphereTree::SelectPlane
const unsigned char * SelectPlane(double origin[3], double normal[3], vtkIdType &numSelected)
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkSphereTree::ExtractCellIds
void ExtractCellIds(const unsigned char *selected, vtkIdList *cellIds, vtkIdType numSelected)
vtkSphereTree::NumberOfLevels
int NumberOfLevels
Definition: vtkSphereTree.h:206
vtkObject.h
vtkSphereTree::BuildStructuredHierarchy
void BuildStructuredHierarchy(vtkStructuredGrid *input, double *tree)
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
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:71
vtkSphereTree::Build
void Build(vtkDataSet *input)
vtkSphereTree::BuildTreeSpheres
void BuildTreeSpheres(vtkDataSet *input)
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:42
vtkSphereTree::Build
void Build()
Build the sphere tree (if necessary) from the data set specified.
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:89
vtkSphereTree::Hierarchy
vtkSphereTreeHierarchy * Hierarchy
Definition: vtkSphereTree.h:212
VTK_MAX_SPHERE_TREE_RESOLUTION
#define VTK_MAX_SPHERE_TREE_RESOLUTION
Definition: vtkSphereTree.h:66
vtkSphereTree::~vtkSphereTree
~vtkSphereTree() override
vtkSphereTree::GetTreeSpheres
const double * GetTreeSpheres(int level, vtkIdType &numSpheres)
vtkSphereTree::SelectLine
const unsigned char * SelectLine(double origin[3], double ray[3], vtkIdType &numSelected)
vtkSphereTree::SelectPoint
void SelectPoint(double point[3], vtkIdList *cellIds)
Methods for cell selection based on a geometric query.