Parasol Planning Library (PPL)
AbstractBoundingSphere Class Reference

#include <AbstractBoundingSphere.h>

Inheritance diagram for AbstractBoundingSphere:
Inheritance graph
[legend]
Collaboration diagram for AbstractBoundingSphere:
Collaboration graph
[legend]

Public Member Functions

Construction
 AbstractBoundingSphere (const size_t _n, const double _radius=std::numeric_limits< double >::max())
 
 AbstractBoundingSphere (const std::vector< double > &_center, const double _radius=std::numeric_limits< double >::max())
 
 AbstractBoundingSphere (XMLNode &_node)
 
virtual ~AbstractBoundingSphere () noexcept
 
Boundary Properties
virtual size_t GetDimension () const noexcept override
 Get the dimension of this boundary. More...
 
virtual double GetMaxDist (const double _r1=2.0, const double _r2=0.5) const override
 
virtual const Range< double > & GetRange (const size_t _i) const override
 
virtual const std::vector< double > & GetCenter () const noexcept override
 Get the boundary's center point. More...
 
virtual double GetVolume () const noexcept override
 Get the boundary's volume (Lebesgue Measure). More...
 
Sampling
virtual std::vector< double > GetRandomPoint () const override
 Get a random point inside the boundary. More...
 
virtual void PushInside (std::vector< double > &_sample) const noexcept override
 
Containment Testing
virtual bool InBoundary (const std::vector< double > &_p) const override
 
virtual bool InBoundary (const Vector3d &_p) const
 
virtual bool InBoundary (const std::vector< double > &_v) const=0
 
virtual bool InBoundary (const Cfg &_c) const=0
 
Clearance Testing
virtual double GetClearance (const Vector3d &_p) const override
 
virtual Vector3d GetClearancePoint (const Vector3d &_p) const override
 
Modifiers
virtual void SetCenter (const std::vector< double > &_c) noexcept override
 
virtual void Translate (const Vector3d &_v) override
 
virtual void Translate (const std::vector< double > &_t) override
 
virtual void ResetBoundary (const std::vector< std::pair< double, double >> &_bbx, const double _margin) override
 
I/O
virtual void Read (std::istream &_is, CountingStreamBuffer &_cbs) override
 
virtual void Write (std::ostream &_os) const override
 
- Public Member Functions inherited from Boundary
virtual Space Type () const noexcept=0
 Get the space type. More...
 
virtual std::string Name () const noexcept=0
 Get the name of the boundary type. More...
 
virtual void ScalePoint (std::vector< double > &_point) const noexcept
 
virtual void UnscalePoint (std::vector< double > &_point) const noexcept
 
virtual bool InBoundary (const Vector3d &_p) const
 
virtual bool InBoundary (const Cfg &_c) const =0
 
virtual CGALPolyhedron CGAL () const
 Create a CGAL polyhedron representation of this. More...
 
virtual GMSPolyhedron MakePolyhedron () const
 
virtual ~Boundary () noexcept
 
virtual std::unique_ptr< BoundaryClone () const =0
 
- Public Member Functions inherited from NSphere
 NSphere (const size_t _n, const double _r=std::numeric_limits< double >::max())
 
 NSphere (const std::vector< double > &_center, const double _r=std::numeric_limits< double >::max())
 
virtual ~NSphere () noexcept
 
size_t GetDimension () const noexcept
 Get the dimension of this sphere. More...
 
void SetCenter (const std::vector< double > &_c) noexcept
 
const std::vector< double > & GetCenter () const noexcept
 Get the center point. More...
 
double GetRadius () const noexcept
 Get the radius. More...
 
void SetRadius (const double _r) noexcept
 Set the radius. More...
 
void Translate (const std::vector< double > &_v) noexcept
 
double GetVolume () const noexcept
 Compute the (hyper)volume or Lebesgue measure. More...
 
bool Contains (const std::vector< double > &_p) const noexcept
 
double Clearance (std::vector< double > _p) const noexcept
 
std::vector< double > ClearancePoint (std::vector< double > _p) const noexcept
 
std::vector< double > Sample () const
 

Additional Inherited Members

- Public Types inherited from Boundary
enum  Space { Workspace , CSpace }
 The types of space that can be modeled with boundaries. More...
 
typedef CGAL::Exact_predicates_exact_constructions_kernel CGALKernel
 
typedef CGAL::Polyhedron_3< CGALKernelCGALPolyhedron
 
- Static Public Member Functions inherited from Boundary
static std::unique_ptr< BoundaryFactory (XMLNode &_node)
 
- Protected Member Functions inherited from Boundary
bool InWorkspace (const Cfg &_c) const
 
bool InCSpace (const Cfg &_c) const
 

Detailed Description

An n-dimensional bounding sphere.

Constructor & Destructor Documentation

◆ AbstractBoundingSphere() [1/3]

AbstractBoundingSphere::AbstractBoundingSphere ( const size_t  _n,
const double  _radius = std::numeric_limits<double>::max() 
)
explicit

Construct a bounding sphere at the origin with a fixed number of dimensions and radius.

Parameters
_nThe number of dimensions to use.
_radiusThe radius (infinite by default).

◆ AbstractBoundingSphere() [2/3]

AbstractBoundingSphere::AbstractBoundingSphere ( const std::vector< double > &  _center,
const double  _radius = std::numeric_limits<double>::max() 
)
explicit

Construct a bounding sphere with a given center point and radius.

Parameters
_centerThe center point, which is assumed to be of full dimension.
_radiusThe radius (infinite by default).

◆ AbstractBoundingSphere() [3/3]

AbstractBoundingSphere::AbstractBoundingSphere ( XMLNode _node)

Construct a bounding sphere from an XML node.

Parameters
_nodeThe XML node to parse.

◆ ~AbstractBoundingSphere()

AbstractBoundingSphere::~AbstractBoundingSphere ( )
virtualdefaultnoexcept

Member Function Documentation

◆ GetCenter()

const std::vector< double > & AbstractBoundingSphere::GetCenter ( ) const
overridevirtualnoexcept

Get the boundary's center point.

Implements Boundary.

◆ GetClearance()

double AbstractBoundingSphere::GetClearance ( const Vector3d &  _p) const
overridevirtual

Get the distance from a test point to the nearest point on the boundary.

Parameters
_pThe test point.
Returns
The distance from _p to the clearance point of _p.

Implements Boundary.

◆ GetClearancePoint()

Vector3d AbstractBoundingSphere::GetClearancePoint ( const Vector3d &  _p) const
overridevirtual

Get the nearest point on the boundary to a test point.

Parameters
_pThe test point.
Returns
The point on this boundary nearest to _p.

Implements Boundary.

◆ GetDimension()

size_t AbstractBoundingSphere::GetDimension ( ) const
overridevirtualnoexcept

Get the dimension of this boundary.

Implements Boundary.

◆ GetMaxDist()

double AbstractBoundingSphere::GetMaxDist ( const double  _r1 = 2.0,
const double  _r2 = 0.5 
) const
overridevirtual

Get the longest distance contained within the boundary. Supports any Minkowski distance.

Parameters
_r1The term-wise power in the Minkowski difference.
_r2The whole expression power in the Minkowski difference.

Implements Boundary.

◆ GetRandomPoint()

std::vector< double > AbstractBoundingSphere::GetRandomPoint ( ) const
overridevirtual

Get a random point inside the boundary.

Implements Boundary.

◆ GetRange()

const Range< double > & AbstractBoundingSphere::GetRange ( const size_t  _i) const
overridevirtual

Get the boundary range for a specific dimension.

Parameters
_iThe dimension index.
Returns
The range of values spanned by this boundary in dimension _i.

Implements Boundary.

◆ GetVolume()

double AbstractBoundingSphere::GetVolume ( ) const
overridevirtualnoexcept

Get the boundary's volume (Lebesgue Measure).

Implements Boundary.

◆ InBoundary() [1/4]

virtual bool Boundary::InBoundary

Test if a configuration lies within the boundary.

Parameters
_cfgThe configuration to test.
Returns
True if the configuration is considered to lie inside the boundary.

◆ InBoundary() [2/4]

bool AbstractBoundingSphere::InBoundary ( const std::vector< double > &  _v) const
overridevirtual

Test if a specific n-dimensional point lies within the boundary.

Parameters
_vThe point to test.
Returns
True if _v lies inside this boundary.

Implements Boundary.

◆ InBoundary() [3/4]

virtual bool Boundary::InBoundary

Test if a specific n-dimensional point lies within the boundary.

Parameters
_vThe point to test.
Returns
True if _v lies inside this boundary.

◆ InBoundary() [4/4]

bool Boundary::InBoundary

Test if a specific point lies within the boundary.

Parameters
_pThe point to test.
Returns
True if _p lies inside this boundary.

◆ PushInside()

void AbstractBoundingSphere::PushInside ( std::vector< double > &  _point) const
overridevirtualnoexcept

Minimally push a point so that it lies within the boundary.

Parameters
_pointThe point to push.

Implements Boundary.

◆ Read()

void AbstractBoundingSphere::Read ( std::istream &  _is,
CountingStreamBuffer _cbs 
)
overridevirtual

Read in a boundary.

Parameters
_isThe input stream to read from.
_cbsThe counting stream buffer for keeping track of where we are in the input stream.

Implements Boundary.

◆ ResetBoundary()

void AbstractBoundingSphere::ResetBoundary ( const std::vector< std::pair< double, double >> &  _bbx,
const double  _margin 
)
overridevirtual

Resize the boundary to fit inside a bounding box plus some margin.

Parameters
_bbxThe new base bounding box.
_marginThe additional margin for _bbx. Negative margins cause shrinkage.

Implements Boundary.

◆ SetCenter()

void AbstractBoundingSphere::SetCenter ( const std::vector< double > &  _c)
overridevirtualnoexcept

Move the boundary to a new center point.

Parameters
_cThe new center point for the boundary.

Implements Boundary.

◆ Translate() [1/2]

void AbstractBoundingSphere::Translate ( const std::vector< double > &  _t)
overridevirtual

Translate the boundary.

Parameters
_tThe offset to apply.

Implements Boundary.

◆ Translate() [2/2]

void AbstractBoundingSphere::Translate ( const Vector3d &  _v)
overridevirtual

Translate the boundary.

Parameters
_vThe offset to apply.

Implements Boundary.

◆ Write()

void AbstractBoundingSphere::Write ( std::ostream &  _os) const
overridevirtual

Write out a boundary.

Parameters
_osThe output stream to write to.

Implements Boundary.


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