Parasol Planning Library (PPL)
GMSPolyhedron Class Referencefinal

#include <GMSPolyhedron.h>

Public Types

Local Types
enum class  COMAdjust { COM , Surface , None }
 
typedef CGAL::Exact_predicates_exact_constructions_kernel CGALKernel
 
typedef CGALKernel::Point_3 CGALPoint
 
typedef CGAL::Polyhedron_3< CGALKernelCGALPolyhedron
 

Public Member Functions

Construction
 GMSPolyhedron ()
 
 GMSPolyhedron (const GMSPolyhedron &_p)
 
 GMSPolyhedron (GMSPolyhedron &&_p)
 
 GMSPolyhedron (glutils::triangulated_model &&_t)
 
 ~GMSPolyhedron ()
 
Assignment
GMSPolyhedronoperator= (const GMSPolyhedron &_p)
 
GMSPolyhedronoperator= (GMSPolyhedron &&_p)
 
Transformation
GMSPolyhedronoperator*= (const Transformation &_t)
 Apply a transformation to the polyhedron. More...
 
void Invert ()
 Invert the polyhedron so that normals face the opposite direction. More...
 
void Scale (double _scalingFactor)
 
Equality
bool operator== (const GMSPolyhedron &_p) const
 
bool operator!= (const GMSPolyhedron &_p) const
 
IO Functions
Vector3d Read (const std::string &_fileName, COMAdjust _comAdjust)
 
Vector3d LoadFromIModel (IModel *_imodel, COMAdjust _comAdjust)
 
void WriteBYU (std::ostream &_os) const
 
void WriteObj (std::ostream &_os) const
 
Accessors
std::vector< Vector3d > & GetVertexList () noexcept
 
std::vector< GMSPolygon > & GetPolygonList () noexcept
 
const std::vector< Vector3d > & GetVertexList () const noexcept
 
const std::vector< GMSPolygon > & GetPolygonList () const noexcept
 
const Vector3d & GetCentroid () const
 Get the centroid of the polyhedron (average of the vertices). More...
 
double GetSurfaceArea () const noexcept
 Get the total surface area of the polyhedron. More...
 
double GetMaxRadius () const noexcept
 Get the maximum radius relative to the polyhedron's center. More...
 
double GetMinRadius () const noexcept
 Get the minimum radius relative to the polyhedron's center. More...
 
Geometry Functions
Point3d GetRandPtOnSurface () const
 Get a random point on the surface of the polyhedron. More...
 
std::unique_ptr< WorkspaceBoundingBoxComputeBoundingBox () const
 Compute an axis-aligned bounding box for this polyhedron. More...
 
GMSPolyhedron ComputeConvexHull () const
 Compute the polyhedron's convex hull vertices and facets. More...
 
CGALPolyhedron CGAL () const
 Get a CGAL polyhedron representation of this object. More...
 
void UpdateCGALPoints ()
 
Collision Detection Models
RAPID_model * GetRapidModel () const noexcept
 
PQP_Model * GetPQPModel () const noexcept
 
const Vector3d & GetInsidePoint () const noexcept
 

Static Public Member Functions

Build Common Shapes
static GMSPolyhedron MakeBox (const Range< double > &_x, const Range< double > &_y, const Range< double > &_z)
 

Detailed Description

Geometric structure for polyhedra including vertices, faces, and surface area.

@TODO Replace this object with CGAL::Polyhedron_3 or at least extend from it. We really do not need three different classes to represent polyhedrons, and CGAL's representation is the most mature.

Examples
CollisionDetection_UseCase.cpp.

Member Typedef Documentation

◆ CGALKernel

typedef CGAL::Exact_predicates_exact_constructions_kernel GMSPolyhedron::CGALKernel

◆ CGALPoint

typedef CGALKernel::Point_3 GMSPolyhedron::CGALPoint

◆ CGALPolyhedron

typedef CGAL::Polyhedron_3<CGALKernel> GMSPolyhedron::CGALPolyhedron

Member Enumeration Documentation

◆ COMAdjust

Center of mass adjustment approaches

This enum lists the method to adjust all vertices of a model. 'COM' will subtract the center of mass (com) from all vertices. 'Surface' will subtract only x and z components of the com from all vertices. 'None' will not perform any adjustment.

Todo:
This has been a major source of bugs for a long time and should be removed entirely. All polyhedrons should be bounding-box centered without exception.
Enumerator
COM 
Surface 
None 

Constructor & Destructor Documentation

◆ GMSPolyhedron() [1/4]

GMSPolyhedron::GMSPolyhedron ( )
default

◆ GMSPolyhedron() [2/4]

GMSPolyhedron::GMSPolyhedron ( const GMSPolyhedron _p)

◆ GMSPolyhedron() [3/4]

GMSPolyhedron::GMSPolyhedron ( GMSPolyhedron &&  _p)

◆ GMSPolyhedron() [4/4]

GMSPolyhedron::GMSPolyhedron ( glutils::triangulated_model &&  _t)

◆ ~GMSPolyhedron()

GMSPolyhedron::~GMSPolyhedron ( )
default

Member Function Documentation

◆ CGAL()

GMSPolyhedron::CGALPolyhedron GMSPolyhedron::CGAL ( ) const

Get a CGAL polyhedron representation of this object.

◆ ComputeBoundingBox()

std::unique_ptr< WorkspaceBoundingBox > GMSPolyhedron::ComputeBoundingBox ( ) const

Compute an axis-aligned bounding box for this polyhedron.

◆ ComputeConvexHull()

GMSPolyhedron GMSPolyhedron::ComputeConvexHull ( ) const

Compute the polyhedron's convex hull vertices and facets.

◆ GetCentroid()

const Vector3d & GMSPolyhedron::GetCentroid ( ) const

Get the centroid of the polyhedron (average of the vertices).

◆ GetInsidePoint()

const Vector3d & GMSPolyhedron::GetInsidePoint ( ) const
noexcept

Get a point just 'beneath' one of the facets to for is-inside-obstacle checks. This is to catch degenerate cases where the zero point.

◆ GetMaxRadius()

double GMSPolyhedron::GetMaxRadius ( ) const
noexcept

Get the maximum radius relative to the polyhedron's center.

◆ GetMinRadius()

double GMSPolyhedron::GetMinRadius ( ) const
noexcept

Get the minimum radius relative to the polyhedron's center.

◆ GetPolygonList() [1/2]

const vector< GMSPolygon > & GMSPolyhedron::GetPolygonList ( ) const
noexcept

◆ GetPolygonList() [2/2]

vector< GMSPolygon > & GMSPolyhedron::GetPolygonList ( )
noexcept

◆ GetPQPModel()

PQP_Model * GMSPolyhedron::GetPQPModel ( ) const
noexcept

Get the pqp CD model. It will be constructed if it doesn't already exist.

◆ GetRandPtOnSurface()

Point3d GMSPolyhedron::GetRandPtOnSurface ( ) const

Get a random point on the surface of the polyhedron.

◆ GetRapidModel()

RAPID_model * GMSPolyhedron::GetRapidModel ( ) const
noexcept

Get the rapid CD model. It will be constructed if it doesn't already exist.

◆ GetSurfaceArea()

double GMSPolyhedron::GetSurfaceArea ( ) const
noexcept

Get the total surface area of the polyhedron.

◆ GetVertexList() [1/2]

const vector< Vector3d > & GMSPolyhedron::GetVertexList ( ) const
noexcept

◆ GetVertexList() [2/2]

vector< Vector3d > & GMSPolyhedron::GetVertexList ( )
noexcept

◆ Invert()

void GMSPolyhedron::Invert ( )

Invert the polyhedron so that normals face the opposite direction.

◆ LoadFromIModel()

Vector3d GMSPolyhedron::LoadFromIModel ( IModel *  _imodel,
COMAdjust  _comAdjust 
)

Load vertices and triangles from the IModel, which loads all types of models.

Parameters
_imodelAn IModel input. @param_comAdjust The COM adjustment type to use.
Returns
The parsed model's center of mass.

@TODO Remove this and force everything to be bounding-box centered.

◆ MakeBox()

GMSPolyhedron GMSPolyhedron::MakeBox ( const Range< double > &  _x,
const Range< double > &  _y,
const Range< double > &  _z 
)
static

Build an axis-aligned box polyhedron.

Parameters
_xThe min/max range in the x direction.
_yThe min/max range in the y direction.
_zThe min/max range in the z direction.
Returns
The polyhedron object. Vertex diagram:
2-----6    +Y
/| /| | 3--—7 | |—+X | 0—|-4 / |/ |/ +Z 1--—5

◆ operator!=()

bool GMSPolyhedron::operator!= ( const GMSPolyhedron _p) const

◆ operator*=()

GMSPolyhedron & GMSPolyhedron::operator*= ( const Transformation &  _t)

Apply a transformation to the polyhedron.

◆ operator=() [1/2]

GMSPolyhedron & GMSPolyhedron::operator= ( const GMSPolyhedron _p)

◆ operator=() [2/2]

GMSPolyhedron & GMSPolyhedron::operator= ( GMSPolyhedron &&  _p)

◆ operator==()

bool GMSPolyhedron::operator== ( const GMSPolyhedron _p) const

◆ Read()

Vector3d GMSPolyhedron::Read ( const std::string &  _fileName,
COMAdjust  _comAdjust 
)

Read in a geometry file in either BYU or OBJ format.

Parameters
_fileNameThe name of the file to read.
_comAdjustThe type of COM adjustment to use.
Returns
The parsed model's center of mass.

◆ Scale()

void GMSPolyhedron::Scale ( double  _scalingFactor)

Scale a polyhedron by a factor and keep it centered at its original centroid.

Parameters
_scalingFactorThe scaling factor

◆ UpdateCGALPoints()

void GMSPolyhedron::UpdateCGALPoints ( )

Make sure the CGAL points match the vertex list. This is only needed for polys that are created manually rather than from file. The points will not be exact as they are copied from doubles.

◆ WriteBYU()

void GMSPolyhedron::WriteBYU ( std::ostream &  _os) const

Output the model to a BYU-format file.

Parameters
_osThe output stream to use.

◆ WriteObj()

void GMSPolyhedron::WriteObj ( std::ostream &  _os) const

Output the model to a Obj-format file.

Parameters
_osThe output stream to use.

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