PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members
WorkspaceBoundingSphere Class Reference

A 2 or 3 dimensional bounding sphere in workspace. More...

Public Member Functions

Construction
 WorkspaceBoundingSphere (const size_t _n, const double _radius=std::numeric_limits< double >::max())
 
 WorkspaceBoundingSphere (const std::vector< double > &_center, const double _radius=std::numeric_limits< double >::max())
 
 WorkspaceBoundingSphere (const Vector3d &_center, const double _radius=std::numeric_limits< double >::max())
 
 WorkspaceBoundingSphere (XMLNode &_node)
 
virtual ~WorkspaceBoundingSphere () noexcept
 
virtual std::unique_ptr< BoundaryClone () const override
 
Property Accessors
virtual Boundary::Space Type () const noexcept override
 Get the space type. More...
 
virtual std::string Name () const noexcept override
 Get the name of the boundary type. More...
 
Containment Testing
virtual bool InBoundary (const Cfg &_cfg) 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
 
Polyhedron Representations
virtual GMSPolyhedron MakePolyhedron () const override
 This will be an approximate sphere with 480 faces. More...
 
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
 
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
 
Scaling
virtual void ScalePoint (std::vector< double > &_point) const noexcept
 
virtual void UnscalePoint (std::vector< double > &_point) const noexcept
 
Accessors
double GetRadius () const noexcept
 Get the radius.
 
void SetRadius (const double _r) noexcept
 Set the radius.
 
Point Testing

If the sphere and point have different dimensions, the missing values will be assumed to be 0.

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
 
Sampling
std::vector< double > Sample () const
 

Static Public Member Functions

Construction
static std::unique_ptr< BoundaryFactory (XMLNode &_node)
 

Public Types

Local Types
enum  Space { Workspace , CSpace }
 The types of space that can be modeled with boundaries.
 

Protected Member Functions

Containment Helpers
bool InWorkspace (const Cfg &_c) const
 
bool InCSpace (const Cfg &_c) const
 

Polyhedron Representations

virtual CGALPolyhedron CGAL () const
 Create a CGAL polyhedron representation of this. More...
 
typedef CGAL::Exact_predicates_exact_constructions_kernel CGALKernel
 
typedef CGAL::Polyhedron_3< CGALKernel > CGALPolyhedron
 

Detailed Description

A 2 or 3 dimensional bounding sphere in workspace.

Member Function Documentation

◆ Clone()

std::unique_ptr< Boundary > WorkspaceBoundingSphere::Clone ( ) const
overridevirtual

Duplicate this boundary and return a dynamically-allocated copy with the same type. This is provided in the base class so that we can copy a boundary object without knowing its type.

Returns
A dynamically-allocated copy of this with the same type.

Implements Boundary.

◆ Type()

Boundary::Space WorkspaceBoundingSphere::Type ( ) const
overridevirtualnoexcept

Get the space type.

Implements Boundary.

◆ Name()

std::string WorkspaceBoundingSphere::Name ( ) const
overridevirtualnoexcept

Get the name of the boundary type.

Implements Boundary.

◆ InBoundary() [1/4]

bool WorkspaceBoundingSphere::InBoundary ( const Cfg _c) const
overridevirtual

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.

Implements Boundary.

◆ MakePolyhedron()

GMSPolyhedron WorkspaceBoundingSphere::MakePolyhedron ( ) const
overridevirtual

This will be an approximate sphere with 480 faces.

Reimplemented from Boundary.

◆ InBoundary() [2/4]

bool Boundary::InBoundary ( const Vector3d &  _p) const
virtual

Test if a specific point lies within the boundary.

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

Reimplemented from AbstractBoundingSphere.

◆ InBoundary() [3/4]

virtual bool Boundary::InBoundary ( const std::vector< double > &  _v) const
virtual

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

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

Reimplemented from AbstractBoundingSphere.

◆ InBoundary() [4/4]

virtual bool Boundary::InBoundary ( const Cfg _c) const
virtual

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.

Reimplemented from AbstractBoundingSphere.

◆ GetDimension()

size_t AbstractBoundingSphere::GetDimension ( ) const
overridevirtualnoexceptinherited

Get the dimension of this boundary.

Implements Boundary.

◆ GetMaxDist()

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

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.

◆ GetRange()

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

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.

◆ GetCenter()

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

Get the boundary's center point.

Implements Boundary.

◆ GetVolume()

double AbstractBoundingSphere::GetVolume ( ) const
overridevirtualnoexceptinherited

Get the boundary's volume (Lebesgue Measure).

Implements Boundary.

◆ GetRandomPoint()

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

Get a random point inside the boundary.

Implements Boundary.

◆ PushInside()

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

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

Parameters
_pointThe point to push.

Implements Boundary.

◆ GetClearance()

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

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
overridevirtualinherited

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.

◆ SetCenter()

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

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 Vector3d &  _v)
overridevirtualinherited

Translate the boundary.

Parameters
_vThe offset to apply.

Implements Boundary.

◆ Translate() [2/2]

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

Translate the boundary.

Parameters
_tThe offset to apply.

Implements Boundary.

◆ ResetBoundary()

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

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.

◆ Read()

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

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.

◆ Write()

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

Write out a boundary.

Parameters
_osThe output stream to write to.

Implements Boundary.

◆ Factory()

std::unique_ptr< Boundary > Boundary::Factory ( XMLNode _node)
staticinherited

Construct a boundary as described by an XML node.

Parameters
_nodeThe XML node.
Returns
A boundary of the appropriate type.

◆ ScalePoint()

void Boundary::ScalePoint ( std::vector< double > &  _point) const
virtualnoexceptinherited

Scale a point relative to the maximum range of the boundary. Up to GetDimension() elements will be scaled so that this boundary's maximum range maps to [-1, 1]. Additional elements in the point will not be scaled.

Parameters
_pointThe point to unscale.

◆ UnscalePoint()

void Boundary::UnscalePoint ( std::vector< double > &  _point) const
virtualnoexceptinherited

Unscale a point relative to the maximum range of the boundary. Up to GetDimension() elements will be scaled so that [-1, 1] maps to this boundary's maximum range. Additional elements in the point will not be scaled.

Parameters
_pointThe point to unscale.

◆ CGAL()

Boundary::CGALPolyhedron Boundary::CGAL ( ) const
virtualinherited

Create a CGAL polyhedron representation of this.

Reimplemented in TetrahedralBoundary, and WorkspaceBoundingBox.

◆ InWorkspace()

bool Boundary::InWorkspace ( const Cfg _c) const
protectedinherited

Check that a configuration lies entirely within a workspace boundary.

Parameters
_cThe configuration of interest.
Returns
True if all of _c's geometry vertices lie within this boundary.

◆ InCSpace()

bool Boundary::InCSpace ( const Cfg _c) const
protectedinherited

Check that a configuration's DOF values lie entirely within a CSpace boundary.

Parameters
_cThe configuration of interest.
Returns
True if all of _c's DOF values lie within this boundary.

◆ Contains()

bool NSphere::Contains ( const std::vector< double > &  _p) const
noexceptinherited

Test if a given point lies within the n-sphere.

Parameters
_pThe point to test.
Returns
True if _p lies within the n-sphere.

◆ Clearance()

double NSphere::Clearance ( std::vector< double >  _p) const
noexceptinherited

Compute the minimum distance to the sphere's surface from a given point. This is bounding-sphere style, so clearance is positive if the point is inside the sphere and negative if it is outside.

Parameters
_pThe point of interest.
Returns
The minimum distance from _p to the sphere's surface.

◆ ClearancePoint()

std::vector< double > NSphere::ClearancePoint ( std::vector< double >  _p) const
noexceptinherited

Find the point on the sphere that is nearest to a given reference point.

Parameters
_pThe reference point.
Returns
The point on the surface that is nearest to _p.

◆ Sample()

std::vector< double > NSphere::Sample ( ) const
inherited

Sample a random point in the n-sphere with uniform probability via the Muller/Marsaglia method.


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