RobWorkProject  23.9.11-
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
BSphere< T > Class Template Reference

class representing an Bounding sphere More...

#include <BSphere.hpp>

Inherits BV< rw::geometry::BSphere< double > >.

Public Types

typedef T value_type
 
- Public Types inherited from BV< rw::geometry::BSphere< double > >
typedef rw::geometry::BSphere< double > DerivedType
 
typedef rw::geometry::BSphere< double > BVType
 
typedef Traits< rw::geometry::BSphere< double > >::value_type value_type
 
typedef rw::core::Ptr< BV< rw::geometry::BSphere< double > > > Ptr
 

Public Member Functions

 BSphere (T radius=1.0)
 constructor using sphere center of (0, 0, 0) More...
 
 BSphere (const rw::math::Vector3D< T > &pos, T radius=1.0)
 constructor setting both sphere center and radius More...
 
 BSphere (const rw::geometry::BSphere< T > &bs)
 Copy constroctor. More...
 
const rw::math::Vector3D< T > & getPosition () const
 get the position of the sphere center More...
 
void setPosition (const rw::math::Vector3D< T > &p3d)
 set the sphere center coordinate More...
 
const T & getRadius () const
 get the sphere radius More...
 
const T getRadiusSqr () const
 get the sphere radius^2 More...
 
calcArea () const
 get the surface area More...
 
calcVolume () const
 get the volume More...
 
- Public Member Functions inherited from BV< rw::geometry::BSphere< double > >
const rw::math::Vector3D< value_type > & getPosition () const
 
value_type calcArea () const
 
value_type calcVolume () const
 

Static Public Member Functions

static BSphere< T > fitEigen (const rw::geometry::TriMesh &tris)
 fit a sphere in $O(n)$ to a triangle mesh using Principal Component Analysis (PCA) where the eigen values of the vertices are used to compute the center of the sphere using the vector with the maximum spread (largest eigenvalue). More...
 
static BSphere< T > fitEigen (const rw::core::Ptr< rw::geometry::TriMesh > &tris)
 
static BSphere< T > fitEigen (const rw::core::Ptr< rw::geometry::GeometryData > &tris)
 

Friends

std::ostream & operator<< (std::ostream &os, const BSphere< T > &sphere)
 Ouputs BSphere to stream. More...
 

Detailed Description

template<class T = double>
class rw::geometry::BSphere< T >

class representing an Bounding sphere

Constructor & Destructor Documentation

◆ BSphere() [1/3]

BSphere ( radius = 1.0)
inline

constructor using sphere center of (0, 0, 0)

Parameters
radius[in] set the radius of the sphere

◆ BSphere() [2/3]

BSphere ( const rw::math::Vector3D< T > &  pos,
radius = 1.0 
)
inline

constructor setting both sphere center and radius

Parameters
pos[in] the position of the center of the sphere
radius[in] set the radius of the sphere

◆ BSphere() [3/3]

BSphere ( const rw::geometry::BSphere< T > &  bs)
inline

Copy constroctor.

Parameters
bs[in] object to copy

Member Function Documentation

◆ calcArea()

T calcArea ( ) const
inline

get the surface area

Returns
surface area

◆ calcVolume()

T calcVolume ( ) const
inline

get the volume

Returns
volume

◆ fitEigen()

static BSphere<T> fitEigen ( const rw::geometry::TriMesh tris)
static

fit a sphere in $O(n)$ to a triangle mesh using Principal Component Analysis (PCA) where the eigen values of the vertices are used to compute the center of the sphere using the vector with the maximum spread (largest eigenvalue).

Parameters
tris[in] input mesh
Returns
bounding sphere

◆ getPosition()

const rw::math::Vector3D<T>& getPosition ( ) const
inline

get the position of the sphere center

Returns
a Vector3D with the center coordinates

◆ getRadius()

const T& getRadius ( ) const
inline

get the sphere radius

Returns
sphere radius

◆ getRadiusSqr()

const T getRadiusSqr ( ) const
inline

get the sphere radius^2

Returns
sphere radius^2

◆ setPosition()

void setPosition ( const rw::math::Vector3D< T > &  p3d)
inline

set the sphere center coordinate

Parameters
p3d[in] the new center coordinates

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const BSphere< T > &  sphere 
)
friend

Ouputs BSphere to stream.

Parameters
os[in/out] stream to use
sphere
Returns
the resulting stream

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