Parasol Planning Library (PPL)
Public Member Functions | Friends
TetrahedralBoundary Class Reference

A tetrahedral bounding region in workspace. More...

#include <TetrahedralBoundary.h>

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

Public Member Functions

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
 
Construction
 TetrahedralBoundary (const std::array< Point3d, 4 > &_pts, const bool _check=true)
 
 TetrahedralBoundary (const std::vector< Point3d > &_pts, const bool _check=true)
 
 TetrahedralBoundary (XMLNode &_node)
 
virtual std::unique_ptr< BoundaryClone () const override
 
virtual ~TetrahedralBoundary () noexcept
 
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...
 
virtual size_t GetDimension () const noexcept override
 Get the dimension of this boundary. More...
 
virtual double GetMaxDist (const double _r1=2., const double _r2=.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 Vector3d &_p) const override
 
virtual bool InBoundary (const std::vector< double > &_v) const override
 
virtual bool InBoundary (const Cfg &_c) const override
 
Clearance Testing
virtual double GetClearance (const Vector3d &_p) const override
 
virtual Vector3d GetClearancePoint (const Vector3d &_p) const override
 
I/O
virtual void Read (std::istream &_is, CountingStreamBuffer &_cbs) override
 
virtual void Write (std::ostream &_os) const override
 
CGAL Representation
virtual CGALPolyhedron CGAL () const override
 Create a CGAL polyhedron representation of this. More...
 
virtual GMSPolyhedron MakePolyhedron () const override
 
- Public Member Functions inherited from Boundary
virtual void ScalePoint (std::vector< double > &_point) const noexcept
 
virtual void UnscalePoint (std::vector< double > &_point) const noexcept
 
virtual ~Boundary () noexcept
 

Protected Member Functions

Helpers
void OrderPoints () noexcept
 Check that the points are in the correct order and fix if necessary. More...
 
std::array< Vector3d, 6 > ComputeEdges () const
 
std::array< Vector3d, 4 > ComputeNormals () const
 Compute the normals. The first three are for faces touched by point 0. More...
 
NBox ComputeBBX () const
 Compute the bounding box. More...
 
double ComputeVolume () const
 Compute the volume. More...
 
- Protected Member Functions inherited from Boundary
bool InWorkspace (const Cfg &_c) const
 
bool InCSpace (const Cfg &_c) const
 

Protected Attributes

Internal State
std::array< Point3d, 4 > m_points
 The vertices of the tetrahedron. More...
 
std::array< Vector3d, 4 > m_normals
 The normals of the tetrahedron. More...
 
NBox m_bbx {3}
 The bounding box of the tetrahedron. More...
 
double m_volume {0}
 The volume of the tetrahedron. More...
 

Friends

std::ostream & operator<< (std::ostream &_os, const TetrahedralBoundary &_b)
 

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)
 

Detailed Description

A tetrahedral bounding region in workspace.

Constructor & Destructor Documentation

◆ TetrahedralBoundary() [1/3]

TetrahedralBoundary::TetrahedralBoundary ( const std::array< Point3d, 4 > &  _pts,
const bool  _check = true 
)
explicit

Construct a TetrahedralBoundary from four points.

Parameters
_ptsThe points to use.
_checkCheck that the points are correct?

If no check is used, the first three points must form an outward-facing facet using the right-hand rule as shown.

1

/|\ / | \ 2–|–3 \ | / |/ 0

◆ TetrahedralBoundary() [2/3]

TetrahedralBoundary::TetrahedralBoundary ( const std::vector< Point3d > &  _pts,
const bool  _check = true 
)
explicit

◆ TetrahedralBoundary() [3/3]

TetrahedralBoundary::TetrahedralBoundary ( XMLNode _node)

◆ ~TetrahedralBoundary()

TetrahedralBoundary::~TetrahedralBoundary ( )
virtualdefaultnoexcept

Member Function Documentation

◆ CGAL()

Boundary::CGALPolyhedron TetrahedralBoundary::CGAL ( ) const
overridevirtual

Create a CGAL polyhedron representation of this.

The first three points must form an outward-facing facet.

Reimplemented from Boundary.

◆ Clone()

std::unique_ptr< Boundary > TetrahedralBoundary::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.

◆ ComputeBBX()

NBox TetrahedralBoundary::ComputeBBX ( ) const
protected

Compute the bounding box.

◆ ComputeEdges()

std::array< Vector3d, 6 > TetrahedralBoundary::ComputeEdges ( ) const
protected

Compute the edges. The resulting vectors point from lower-index points higher-index points.

◆ ComputeNormals()

std::array< Vector3d, 4 > TetrahedralBoundary::ComputeNormals ( ) const
protected

Compute the normals. The first three are for faces touched by point 0.

◆ ComputeVolume()

double TetrahedralBoundary::ComputeVolume ( ) const
protected

Compute the volume.

◆ GetCenter()

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

Get the boundary's center point.

Implements Boundary.

◆ GetClearance()

double TetrahedralBoundary::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 TetrahedralBoundary::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 TetrahedralBoundary::GetDimension ( ) const
overridevirtualnoexcept

Get the dimension of this boundary.

Implements Boundary.

◆ GetMaxDist()

double TetrahedralBoundary::GetMaxDist ( const double  _r1 = 2.,
const double  _r2 = .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 > TetrahedralBoundary::GetRandomPoint ( ) const
overridevirtual

Get a random point inside the boundary.

Implements Boundary.

◆ GetRange()

const Range< double > & TetrahedralBoundary::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 TetrahedralBoundary::GetVolume ( ) const
overridevirtualnoexcept

Get the boundary's volume (Lebesgue Measure).

Implements Boundary.

◆ InBoundary() [1/3]

bool TetrahedralBoundary::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.

◆ InBoundary() [2/3]

bool TetrahedralBoundary::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/3]

bool TetrahedralBoundary::InBoundary ( const Vector3d &  _p) const
overridevirtual

Test if a specific point lies within the boundary.

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

Reimplemented from Boundary.

◆ MakePolyhedron()

GMSPolyhedron TetrahedralBoundary::MakePolyhedron ( ) const
overridevirtual

Create a GMSPolyhedron representation of this. The polyhedron will be inside-out (normals facing inward) to properly represent the contact normals.

Reimplemented from Boundary.

◆ Name()

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

Get the name of the boundary type.

Implements Boundary.

◆ OrderPoints()

void TetrahedralBoundary::OrderPoints ( )
protectednoexcept

Check that the points are in the correct order and fix if necessary.

◆ PushInside()

void TetrahedralBoundary::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 TetrahedralBoundary::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 TetrahedralBoundary::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 TetrahedralBoundary::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 TetrahedralBoundary::Translate ( const std::vector< double > &  _t)
overridevirtual

Translate the boundary.

Parameters
_tThe offset to apply.

Implements Boundary.

◆ Translate() [2/2]

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

Translate the boundary.

Parameters
_vThe offset to apply.

Implements Boundary.

◆ Type()

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

Get the space type.

Implements Boundary.

◆ Write()

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

Write out a boundary.

Parameters
_osThe output stream to write to.

Implements Boundary.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  _os,
const TetrahedralBoundary _b 
)
friend

Field Documentation

◆ m_bbx

NBox TetrahedralBoundary::m_bbx {3}
protected

The bounding box of the tetrahedron.

◆ m_normals

std::array<Vector3d, 4> TetrahedralBoundary::m_normals
protected

The normals of the tetrahedron.

◆ m_points

std::array<Point3d, 4> TetrahedralBoundary::m_points
protected

The vertices of the tetrahedron.

◆ m_volume

double TetrahedralBoundary::m_volume {0}
protected

The volume of the tetrahedron.


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