VTK  9.1.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkSphereTree Class Reference

class to build and traverse sphere trees More...

#include <vtkSphereTree.h>

Inheritance diagram for vtkSphereTree:
[legend]
Collaboration diagram for vtkSphereTree:
[legend]

Public Member Functions

virtual int GetNumberOfLevels ()
 Get the current depth of the sphere tree.
 
virtual void SetDataSet (vtkDataSet *)
 Specify the dataset from which to build the sphere tree.
 
virtual vtkDataSetGetDataSet ()
 Specify the dataset from which to build the sphere tree.
 
void Build ()
 Build the sphere tree (if necessary) from the data set specified.
 
void Build (vtkDataSet *input)
 Build the sphere tree (if necessary) from the data set specified.
 
virtual void SetBuildHierarchy (bool)
 Control whether the tree hierarchy is built.
 
virtual bool GetBuildHierarchy ()
 Control whether the tree hierarchy is built.
 
virtual void BuildHierarchyOn ()
 Control whether the tree hierarchy is built.
 
virtual void BuildHierarchyOff ()
 Control whether the tree hierarchy is built.
 
const unsigned char * SelectPoint (double point[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.
 
const unsigned char * SelectPlane (double origin[3], double normal[3], vtkIdType &numSelected)
 Methods for cell selection based on a geometric query.
 
void SelectPoint (double point[3], vtkIdList *cellIds)
 Methods for cell selection based on a geometric query.
 
void SelectLine (double origin[3], double ray[3], vtkIdList *cellIds)
 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.
 
virtual void SetResolution (int)
 Sphere tree creation requires gathering spheres into groups.
 
virtual int GetResolution ()
 Sphere tree creation requires gathering spheres into groups.
 
virtual void SetMaxLevel (int)
 Specify the maximum number of levels for the tree.
 
virtual int GetMaxLevel ()
 Specify the maximum number of levels for the tree.
 
const double * GetCellSpheres ()
 Special methods to retrieve the sphere tree data.
 
const double * GetTreeSpheres (int level, vtkIdType &numSpheres)
 Special methods to retrieve the sphere tree data.
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on.
 
virtual void DebugOff ()
 Turn debugging output off.
 
bool GetDebug ()
 Get the value of the debug flag.
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag.
 
virtual void Modified ()
 Update the modification time for this object.
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method.
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
int InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
virtual void Delete ()
 Delete a VTK object.
 
virtual void FastDelete ()
 Delete a reference to this object.
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream.
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
 
int GetReferenceCount ()
 Return the current reference count of this object.
 
void SetReferenceCount (int)
 Sets the reference count.
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 

Static Public Member Functions

static vtkSphereTreeNew ()
 Instantiate the sphere tree.
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes.
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static int GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.
 

Protected Member Functions

 vtkSphereTree ()
 
 ~vtkSphereTree () override
 
void BuildTreeSpheres (vtkDataSet *input)
 
void ExtractCellIds (const unsigned char *selected, vtkIdList *cellIds, vtkIdType numSelected)
 
void BuildTreeHierarchy (vtkDataSet *input)
 
void BuildStructuredHierarchy (vtkStructuredGrid *input, double *tree)
 
void BuildUnstructuredHierarchy (vtkDataSet *input, double *tree)
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events.
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events.
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void RegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

vtkDataSetDataSet
 
unsigned char * Selected
 
int Resolution
 
int MaxLevel
 
int NumberOfLevels
 
bool BuildHierarchy
 
vtkDoubleArrayTree
 
double * TreePtr
 
vtkSphereTreeHierarchy * Hierarchy
 
double AverageRadius
 
double SphereBounds [6]
 
vtkTimeStamp BuildTime
 
int SphereTreeType
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 
typedef vtkObject Superclass
 Standard type related macros and PrintSelf() method.
 
static vtkTypeBool IsTypeOf (const char *type)
 Standard type related macros and PrintSelf() method.
 
static vtkSphereTreeSafeDownCast (vtkObjectBase *o)
 Standard type related macros and PrintSelf() method.
 
virtual vtkTypeBool IsA (const char *type)
 Standard type related macros and PrintSelf() method.
 
vtkSphereTreeNewInstance () const
 Standard type related macros and PrintSelf() method.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Standard type related macros and PrintSelf() method.
 
virtual vtkObjectBaseNewInstanceInternal () const
 Standard type related macros and PrintSelf() method.
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

class to build and traverse sphere trees

vtkSphereTree is a helper class used to build and traverse sphere trees. Various types of trees can be constructed for different VTK dataset types, as well well as different approaches to organize the tree into hierarchies.

Typically building a complete sphere tree consists of two parts: 1) creating spheres for each cell in the dataset, then 2) creating an organizing hierarchy. The structure of the hierarchy varies depending on the topological characteristics of the dataset.

Once the tree is constructed, various geometric operations are available for quickly selecting cells based on sphere tree operations; for example, process all cells intersecting a plane (i.e., use the sphere tree to identify candidate cells for plane intersection).

This class does not necessarily create optimal sphere trees because some of its requirements (fast build time, provide simple reference code, a single bounding sphere per cell, etc.) precludes optimal performance. It is also oriented to computing on cells versus the classic problem of collision detection for polygonal models. For more information you want to read Gareth Bradshaw's PhD thesis "Bounding Volume Hierarchies for Level-of-Detail Collision Handling" which does a nice job of laying out the challenges and important algorithms relative to sphere trees and BVH (bounding volume hierarchies).

See also
vtkSphereTreeFilter vtkPlaneCutter

Definition at line 69 of file vtkSphereTree.h.

Member Typedef Documentation

◆ Superclass

Standard type related macros and PrintSelf() method.

Definition at line 81 of file vtkSphereTree.h.

Constructor & Destructor Documentation

◆ vtkSphereTree()

vtkSphereTree::vtkSphereTree ( )
protected

◆ ~vtkSphereTree()

vtkSphereTree::~vtkSphereTree ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkSphereTree * vtkSphereTree::New ( )
static

Instantiate the sphere tree.

◆ IsTypeOf()

static vtkTypeBool vtkSphereTree::IsTypeOf ( const char *  type)
static

Standard type related macros and PrintSelf() method.

◆ IsA()

virtual vtkTypeBool vtkSphereTree::IsA ( const char *  type)
virtual

Standard type related macros and PrintSelf() method.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkSphereTree * vtkSphereTree::SafeDownCast ( vtkObjectBase o)
static

Standard type related macros and PrintSelf() method.

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkSphereTree::NewInstanceInternal ( ) const
protectedvirtual

Standard type related macros and PrintSelf() method.

◆ NewInstance()

vtkSphereTree * vtkSphereTree::NewInstance ( ) const

Standard type related macros and PrintSelf() method.

◆ PrintSelf()

void vtkSphereTree::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Standard type related macros and PrintSelf() method.

Reimplemented from vtkObject.

◆ SetDataSet()

virtual void vtkSphereTree::SetDataSet ( vtkDataSet )
virtual

Specify the dataset from which to build the sphere tree.

◆ GetDataSet()

virtual vtkDataSet * vtkSphereTree::GetDataSet ( )
virtual

Specify the dataset from which to build the sphere tree.

◆ Build() [1/2]

void vtkSphereTree::Build ( )

Build the sphere tree (if necessary) from the data set specified.

The build time is recorded so the sphere tree will only build if something has changed. An alternative method is available to both set the dataset and then build the sphere tree.

◆ Build() [2/2]

void vtkSphereTree::Build ( vtkDataSet input)

Build the sphere tree (if necessary) from the data set specified.

The build time is recorded so the sphere tree will only build if something has changed. An alternative method is available to both set the dataset and then build the sphere tree.

◆ SetBuildHierarchy()

virtual void vtkSphereTree::SetBuildHierarchy ( bool  )
virtual

Control whether the tree hierarchy is built.

If not, then just cell spheres are created (one for each cell).

◆ GetBuildHierarchy()

virtual bool vtkSphereTree::GetBuildHierarchy ( )
virtual

Control whether the tree hierarchy is built.

If not, then just cell spheres are created (one for each cell).

◆ BuildHierarchyOn()

virtual void vtkSphereTree::BuildHierarchyOn ( )
virtual

Control whether the tree hierarchy is built.

If not, then just cell spheres are created (one for each cell).

◆ BuildHierarchyOff()

virtual void vtkSphereTree::BuildHierarchyOff ( )
virtual

Control whether the tree hierarchy is built.

If not, then just cell spheres are created (one for each cell).

◆ SelectPoint() [1/2]

const unsigned char * vtkSphereTree::SelectPoint ( double  point[3],
vtkIdType numSelected 
)

Methods for cell selection based on a geometric query.

Internally different methods are used depending on the dataset type. The array returned is set to non-zero for each cell that intersects the geometric entity. SelectPoint marks all cells with a non-zero value that may contain a point. SelectLine marks all cells that may intersect an infinite line. SelectPlane marks all cells that may intersect with an infinite plane.

◆ SelectLine() [1/2]

const unsigned char * vtkSphereTree::SelectLine ( double  origin[3],
double  ray[3],
vtkIdType numSelected 
)

Methods for cell selection based on a geometric query.

Internally different methods are used depending on the dataset type. The array returned is set to non-zero for each cell that intersects the geometric entity. SelectPoint marks all cells with a non-zero value that may contain a point. SelectLine marks all cells that may intersect an infinite line. SelectPlane marks all cells that may intersect with an infinite plane.

◆ SelectPlane() [1/2]

const unsigned char * vtkSphereTree::SelectPlane ( double  origin[3],
double  normal[3],
vtkIdType numSelected 
)

Methods for cell selection based on a geometric query.

Internally different methods are used depending on the dataset type. The array returned is set to non-zero for each cell that intersects the geometric entity. SelectPoint marks all cells with a non-zero value that may contain a point. SelectLine marks all cells that may intersect an infinite line. SelectPlane marks all cells that may intersect with an infinite plane.

◆ SelectPoint() [2/2]

void vtkSphereTree::SelectPoint ( double  point[3],
vtkIdList cellIds 
)

Methods for cell selection based on a geometric query.

Internally different methods are used depending on the dataset type. The method pupulates an vtkIdList with cell ids that may satisfy the geometric query (the user must provide a vtkLdList which the methods fill in). SelectPoint lists all cells with a non-zero value that may contain a point. SelectLine lists all cells that may intersect an infinite line. SelectPlane lists all cells that may intersect with an infinite plane.

◆ SelectLine() [2/2]

void vtkSphereTree::SelectLine ( double  origin[3],
double  ray[3],
vtkIdList cellIds 
)

Methods for cell selection based on a geometric query.

Internally different methods are used depending on the dataset type. The method pupulates an vtkIdList with cell ids that may satisfy the geometric query (the user must provide a vtkLdList which the methods fill in). SelectPoint lists all cells with a non-zero value that may contain a point. SelectLine lists all cells that may intersect an infinite line. SelectPlane lists all cells that may intersect with an infinite plane.

◆ SelectPlane() [2/2]

void vtkSphereTree::SelectPlane ( double  origin[3],
double  normal[3],
vtkIdList cellIds 
)

Methods for cell selection based on a geometric query.

Internally different methods are used depending on the dataset type. The method pupulates an vtkIdList with cell ids that may satisfy the geometric query (the user must provide a vtkLdList which the methods fill in). SelectPoint lists all cells with a non-zero value that may contain a point. SelectLine lists all cells that may intersect an infinite line. SelectPlane lists all cells that may intersect with an infinite plane.

◆ SetResolution()

virtual void vtkSphereTree::SetResolution ( int  )
virtual

Sphere tree creation requires gathering spheres into groups.

The Resolution variable is a rough guide to the size of each group (the size different meanings depending on the type of data (structured versus unstructured). For example, in 3D structured data, blocks of resolution Resolution^3 are created. By default the Resolution is three.

◆ GetResolution()

virtual int vtkSphereTree::GetResolution ( )
virtual

Sphere tree creation requires gathering spheres into groups.

The Resolution variable is a rough guide to the size of each group (the size different meanings depending on the type of data (structured versus unstructured). For example, in 3D structured data, blocks of resolution Resolution^3 are created. By default the Resolution is three.

◆ SetMaxLevel()

virtual void vtkSphereTree::SetMaxLevel ( int  )
virtual

Specify the maximum number of levels for the tree.

By default, the number of levels is set to ten. If the number of levels is set to one or less, then no hierarchy is built (i.e., just the spheres for each cell are created). Note that the actual level of the tree may be less than this value depending on the number of cells and Resolution factor.

◆ GetMaxLevel()

virtual int vtkSphereTree::GetMaxLevel ( )
virtual

Specify the maximum number of levels for the tree.

By default, the number of levels is set to ten. If the number of levels is set to one or less, then no hierarchy is built (i.e., just the spheres for each cell are created). Note that the actual level of the tree may be less than this value depending on the number of cells and Resolution factor.

◆ GetNumberOfLevels()

virtual int vtkSphereTree::GetNumberOfLevels ( )
virtual

Get the current depth of the sphere tree.

This value may change each time the sphere tree is built and the branching factor (i.e., resolution) changes. Note that after building the sphere tree there are [0,this->NumberOfLevels) defined levels.

◆ GetCellSpheres()

const double * vtkSphereTree::GetCellSpheres ( )

Special methods to retrieve the sphere tree data.

This is generally used for debugging or with filters like vtkSphereTreeFilter. Both methods return an array of double* where four doubles represent a sphere (center + radius). In the first method a sphere per cell is returned. In the second method the user must also specify a level in the sphere tree (used to retrieve the hierarchy of the tree). Note that null pointers can be returned if the request is not consistent with the state of the sphere tree.

◆ GetTreeSpheres()

const double * vtkSphereTree::GetTreeSpheres ( int  level,
vtkIdType numSpheres 
)

Special methods to retrieve the sphere tree data.

This is generally used for debugging or with filters like vtkSphereTreeFilter. Both methods return an array of double* where four doubles represent a sphere (center + radius). In the first method a sphere per cell is returned. In the second method the user must also specify a level in the sphere tree (used to retrieve the hierarchy of the tree). Note that null pointers can be returned if the request is not consistent with the state of the sphere tree.

◆ BuildTreeSpheres()

void vtkSphereTree::BuildTreeSpheres ( vtkDataSet input)
protected

◆ ExtractCellIds()

void vtkSphereTree::ExtractCellIds ( const unsigned char *  selected,
vtkIdList cellIds,
vtkIdType  numSelected 
)
protected

◆ BuildTreeHierarchy()

void vtkSphereTree::BuildTreeHierarchy ( vtkDataSet input)
protected

◆ BuildStructuredHierarchy()

void vtkSphereTree::BuildStructuredHierarchy ( vtkStructuredGrid input,
double *  tree 
)
protected

◆ BuildUnstructuredHierarchy()

void vtkSphereTree::BuildUnstructuredHierarchy ( vtkDataSet input,
double *  tree 
)
protected

Member Data Documentation

◆ DataSet

vtkDataSet* vtkSphereTree::DataSet
protected

Definition at line 198 of file vtkSphereTree.h.

◆ Selected

unsigned char* vtkSphereTree::Selected
protected

Definition at line 199 of file vtkSphereTree.h.

◆ Resolution

int vtkSphereTree::Resolution
protected

Definition at line 200 of file vtkSphereTree.h.

◆ MaxLevel

int vtkSphereTree::MaxLevel
protected

Definition at line 201 of file vtkSphereTree.h.

◆ NumberOfLevels

int vtkSphereTree::NumberOfLevels
protected

Definition at line 202 of file vtkSphereTree.h.

◆ BuildHierarchy

bool vtkSphereTree::BuildHierarchy
protected

Definition at line 203 of file vtkSphereTree.h.

◆ Tree

vtkDoubleArray* vtkSphereTree::Tree
protected

Definition at line 206 of file vtkSphereTree.h.

◆ TreePtr

double* vtkSphereTree::TreePtr
protected

Definition at line 207 of file vtkSphereTree.h.

◆ Hierarchy

vtkSphereTreeHierarchy* vtkSphereTree::Hierarchy
protected

Definition at line 208 of file vtkSphereTree.h.

◆ AverageRadius

double vtkSphereTree::AverageRadius
protected

Definition at line 211 of file vtkSphereTree.h.

◆ SphereBounds

double vtkSphereTree::SphereBounds[6]
protected

Definition at line 212 of file vtkSphereTree.h.

◆ BuildTime

vtkTimeStamp vtkSphereTree::BuildTime
protected

Definition at line 213 of file vtkSphereTree.h.

◆ SphereTreeType

int vtkSphereTree::SphereTreeType
protected

Definition at line 222 of file vtkSphereTree.h.


The documentation for this class was generated from the following file: