RobWorkProject  23.9.11-
Classes | Public Member Functions | Static Public Member Functions | List of all members
BVTreeFactory Class Reference

factory for creating bounding volume trees. More...

#include <BVTreeFactory.hpp>

Classes

struct  BVShellSplitterStrategy
 Interface for bounding volume splitting strategy for objects with analytical surfaces. More...
 
struct  BVSplitterStrategy
 interface of bounding volume splitting strategy More...
 
class  OBVMeanSplitter
 Spatial Median splitting strategy. The median of the bounding volume projection extends are used as splitting point. More...
 
struct  OBVMedianSplitter
 Object median splitting strategy using axis of largest variance. Splits the mesh in the median on the axis with largest variance. More...
 
struct  OBVShellMedianSplitter
 Spatial Median splitting strategy for shell of analytical surfaces. More...
 
struct  OBVSpatialMedianSplitter
 Spatial Median splitting strategy. The median of the bounding volume projection extends are used as splitting point. More...
 
struct  ShellAccessor
 Access GenericFace primitive of Shell. More...
 
struct  TriMeshAccessor
 

Public Member Functions

template<class OBV >
rw::core::Ptr< BVSplitterStrategy< OBV > > makeOBVMedianSplitter ()
 creates a splitter strategy for OBB tree construction using an object median splitting strategy. More...
 
template<class OBV >
rw::core::Ptr< BVShellSplitterStrategy< OBV > > makeOBVShellMedianSplitter ()
 Creates a splitter strategy for OBB tree construction using an object median splitting strategy. More...
 
template<class OBV >
rw::core::Ptr< BVSplitterStrategy< OBV > > makeOBVSpatialMedianSplitter ()
 creates a splitter strategy for OBB tree construction using a spatial median splitting strategy. More...
 
template<class OBV >
rw::core::Ptr< BVTreeFactory::BVSplitterStrategy< OBV > > makeOBVMeanSplitter ()
 creates a splitter strategy for obb tree construction using mean splitting strategy. More...
 
template<class T >
rw::core::Ptr< geometry::BVFactory< rw::geometry::OBB< T > > > makeOBBCovarFactory ()
 creates an OBB factory that fits obb's to triangle meshes by calculating the covariance of the triangle mesh and use the eigen vectors of the covariance as the axes of the OBB. More...
 
template<class BVTREE >
BVTREE * makeTopDownOBBTreeCovarMedian (rw::geometry::TriMesh::Ptr mesh, int maxTrisInLeaf=1)
 creates an OBB tree using a covariance OBB factory and a object median splitting strategy. More...
 
template<class BVTREE >
BVTREE * makeTopDownOBBTreeMedian (rw::geometry::Shell::CPtr shell, int maxTrisInLeaf=1)
 Creates an OBB tree using a object median splitting strategy. More...
 
template<class BVTREE >
BVTREE * makeTopDownOBBTreeCovarSpatialMedian (rw::geometry::TriMesh::Ptr mesh, int maxTrisInLeaf=1)
 
template<class BVTREE >
BVTREE * makeTopDownOBBTreeCovarMean (rw::geometry::TriMesh::Ptr mesh, int maxTrisInLeaf=1)
 
template<class BVTREE >
BVTREE * makeTopDownOBBIdxTreeCovarMedian (rw::geometry::TriMesh::Ptr mesh, int maxTrisInLeaf=1)
 

Static Public Member Functions

template<class BVTREE >
static BVTREE * makeTopDownTree (rw::geometry::TriMesh::Ptr mesh, geometry::BVFactory< typename Traits< BVTREE >::BVType > &bvFactory, const BVSplitterStrategy< typename Traits< BVTREE >::BVType > &splitter, int maxTrisInLeaf=1)
 general function for constructing a binary bounding volume tree in a top down fashion. More...
 
template<class BVTREE >
static BVTREE * makeTopDownTree (rw::geometry::Shell::CPtr shell, geometry::BVFactory< typename Traits< BVTREE >::BVType > &bvFactory, const BVShellSplitterStrategy< typename Traits< BVTREE >::BVType > &splitter, int maxTrisInLeaf=1)
 Top-down construction of a bounding volume tree. More...
 
template<class BVTREE >
static void recursiveTopDownTree (BVTree< BVTREE > *tree, typename Traits< BVTREE >::NodeIterator &node, rw::geometry::IndexedTriArray<> mesh, rw::geometry::BVFactory< typename Traits< BVTREE >::BVType > &bvFactory, const BVSplitterStrategy< typename Traits< BVTREE >::BVType > &splitter, size_t maxTrisInLeaf)
 recursive top down construction of a bounding volume tree More...
 
template<class BVTREE >
static void recursiveTopDownTree (BVTree< BVTREE > *tree, typename Traits< BVTREE >::NodeIterator &node, rw::geometry::IndexedFaceArray shell, rw::geometry::BVFactory< typename Traits< BVTREE >::BVType > &bvFactory, const BVShellSplitterStrategy< typename Traits< BVTREE >::BVType > &splitter, const size_t maxTrisInLeaf)
 Recursive top-down construction of a bounding volume tree. More...
 
template<class T >
static int evaluateSplitAxis (rw::geometry::IndexedTriArray<> &mesh, int splitAxis, double splitValue, const rw::math::Transform3D< T > &t3d)
 computes a score of a specific splitting axis. Basically each triangle in the mesh is visited and all vertices are tested for being on either left or right side of the splitting value. The score is then the total number of triangles being completely on either left or right side. Which means that a score=mesh.size() is the best score where the split value completely splits the triangles into two volumes. score=0 is the worst where all triangles has vertices on both sides on the split value. More...
 
static int evaluateSplitAxis (const rw::geometry::IndexedFaceArray &shell, const double splitValue)
 Evaluate the quality of a split axis. More...
 

Detailed Description

factory for creating bounding volume trees.

Member Function Documentation

◆ evaluateSplitAxis() [1/2]

static int evaluateSplitAxis ( const rw::geometry::IndexedFaceArray shell,
const double  splitValue 
)
inlinestatic

Evaluate the quality of a split axis.

A good split axis divides the object such that the number of faces lying completely to the left or right of the axis is maximized.

Note
Remember to call sortAxis() on the shell for the given axis before calling this method.
Parameters
shell[in] the shell where each IndexedFace contains the face extremums along the given axis.
splitValue[in] the split axis value.
Returns
the number of faces lying completely to the left or right of the split axis.

◆ evaluateSplitAxis() [2/2]

static int evaluateSplitAxis ( rw::geometry::IndexedTriArray<> &  mesh,
int  splitAxis,
double  splitValue,
const rw::math::Transform3D< T > &  t3d 
)
inlinestatic

computes a score of a specific splitting axis. Basically each triangle in the mesh is visited and all vertices are tested for being on either left or right side of the splitting value. The score is then the total number of triangles being completely on either left or right side. Which means that a score=mesh.size() is the best score where the split value completely splits the triangles into two volumes. score=0 is the worst where all triangles has vertices on both sides on the split value.

Parameters
meshdocumentation missing !
splitAxisdocumentation missing !
splitValuedocumentation missing !
t3ddocumentation missing !
Returns

◆ makeOBBCovarFactory()

rw::core::Ptr<geometry::BVFactory<rw::geometry::OBB<T> > > makeOBBCovarFactory ( )
inline

creates an OBB factory that fits obb's to triangle meshes by calculating the covariance of the triangle mesh and use the eigen vectors of the covariance as the axes of the OBB.

Returns
OBB factory

◆ makeOBVMeanSplitter()

rw::core::Ptr<BVTreeFactory::BVSplitterStrategy<OBV> > makeOBVMeanSplitter ( )
inline

creates a splitter strategy for obb tree construction using mean splitting strategy.

The strategy splits a trimesh in one of the axes of the OBB. The splitting point is determined as the mean on one of the OBB axes. Performs in O(n)

Returns
Splitter strategy for OBB tree construction

◆ makeOBVMedianSplitter()

rw::core::Ptr<BVSplitterStrategy<OBV> > makeOBVMedianSplitter ( )
inline

creates a splitter strategy for OBB tree construction using an object median splitting strategy.

splits a trimesh in one of the axis of a bounding volume. The splitter use a median based strategy where the splitpoint is determined as the object median and as such is suitable for creating balanced OBB trees. Median is found in O(n log n) time

◆ makeOBVShellMedianSplitter()

rw::core::Ptr<BVShellSplitterStrategy<OBV> > makeOBVShellMedianSplitter ( )
inline

Creates a splitter strategy for OBB tree construction using an object median splitting strategy.

Splits a shell representation with analytic surfaces in one of the axes of the bounding volume. The splitter use a median based strategy where the splitpoint is determined as the object median and as such is suitable for creating balanced OBB trees.

Returns
the splitting strategy.

◆ makeOBVSpatialMedianSplitter()

rw::core::Ptr<BVSplitterStrategy<OBV> > makeOBVSpatialMedianSplitter ( )
inline

creates a splitter strategy for OBB tree construction using a spatial median splitting strategy.

splits a trimesh in one of the axis of a bounding volume such that the bounding volume is split in two equal parts. Median is found in constant time.

◆ makeTopDownOBBTreeCovarMedian()

BVTREE* makeTopDownOBBTreeCovarMedian ( rw::geometry::TriMesh::Ptr  mesh,
int  maxTrisInLeaf = 1 
)
inline

creates an OBB tree using a covariance OBB factory and a object median splitting strategy.

Parameters
mesh[in] the mesh that should be decomposed into a OBB tree
maxTrisInLeaf[in] the maximum number of tris that are allowed in each leaf node
Returns
OBB tree

◆ makeTopDownOBBTreeMedian()

BVTREE* makeTopDownOBBTreeMedian ( rw::geometry::Shell::CPtr  shell,
int  maxTrisInLeaf = 1 
)
inline

Creates an OBB tree using a object median splitting strategy.

Parameters
shell[in] the shell to create OBB tree for.
maxTrisInLeaf[in] the maximum number of faces in a leaf node.
Returns
the OBB tree.

◆ makeTopDownTree() [1/2]

static BVTREE* makeTopDownTree ( rw::geometry::Shell::CPtr  shell,
geometry::BVFactory< typename Traits< BVTREE >::BVType > &  bvFactory,
const BVShellSplitterStrategy< typename Traits< BVTREE >::BVType > &  splitter,
int  maxTrisInLeaf = 1 
)
inlinestatic

Top-down construction of a bounding volume tree.

Parameters
shell[in] the shell to create bounding volume tree for. Must have at least one face.
bvFactorya factory for creating bounding volumes.
splitter[in] the splitting strategy used to divide the shell.
maxTrisInLeaf[in] how many faces to allow in one leaf of the tree.
Returns
the resulting bounding volume tree.

◆ makeTopDownTree() [2/2]

static BVTREE* makeTopDownTree ( rw::geometry::TriMesh::Ptr  mesh,
geometry::BVFactory< typename Traits< BVTREE >::BVType > &  bvFactory,
const BVSplitterStrategy< typename Traits< BVTREE >::BVType > &  splitter,
int  maxTrisInLeaf = 1 
)
inlinestatic

general function for constructing a binary bounding volume tree in a top down fashion.

Parameters
mesh[in] the mesh on which to construct the bounding volume tree
bvFactory[in] a factory for creating/fitting bounding volumes given a triangle mesh
splitter[in] divides a mesh into 2 meshes by sorting the mesh and providing a splitting index
maxTrisInLeaf[in] the maximum number of tris that are allowed in each leaf node
Returns

◆ recursiveTopDownTree() [1/2]

static void recursiveTopDownTree ( BVTree< BVTREE > *  tree,
typename Traits< BVTREE >::NodeIterator &  node,
rw::geometry::IndexedFaceArray  shell,
rw::geometry::BVFactory< typename Traits< BVTREE >::BVType > &  bvFactory,
const BVShellSplitterStrategy< typename Traits< BVTREE >::BVType > &  splitter,
const size_t  maxTrisInLeaf 
)
inlinestatic

Recursive top-down construction of a bounding volume tree.

Parameters
tree[out] the resulting bounding volume tree.
node[in/out] current node being handled in tree.
shell[in] the shell to create bounding volume tree for. Must have at least one face.
bvFactorya factory for creating bounding volumes.
splitter[in] the splitting strategy used to divide the shell.
maxTrisInLeaf[in] how many faces to allow in one leaf of the tree.

◆ recursiveTopDownTree() [2/2]

static void recursiveTopDownTree ( BVTree< BVTREE > *  tree,
typename Traits< BVTREE >::NodeIterator &  node,
rw::geometry::IndexedTriArray<>  mesh,
rw::geometry::BVFactory< typename Traits< BVTREE >::BVType > &  bvFactory,
const BVSplitterStrategy< typename Traits< BVTREE >::BVType > &  splitter,
size_t  maxTrisInLeaf 
)
inlinestatic

recursive top down construction of a bounding volume tree

Parameters
tree
node
mesh
bvFactory
splitter
maxTrisInLeaf

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