![]() |
Parasol Planning Library (PPL)
|
#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< CGALKernel > | CGALPolyhedron |
Public Member Functions | |
Construction | |
GMSPolyhedron () | |
GMSPolyhedron (const GMSPolyhedron &_p) | |
GMSPolyhedron (GMSPolyhedron &&_p) | |
GMSPolyhedron (glutils::triangulated_model &&_t) | |
~GMSPolyhedron () | |
Assignment | |
GMSPolyhedron & | operator= (const GMSPolyhedron &_p) |
GMSPolyhedron & | operator= (GMSPolyhedron &&_p) |
Transformation | |
GMSPolyhedron & | operator*= (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< WorkspaceBoundingBox > | ComputeBoundingBox () 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) |
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.
typedef CGAL::Exact_predicates_exact_constructions_kernel GMSPolyhedron::CGALKernel |
typedef CGALKernel::Point_3 GMSPolyhedron::CGALPoint |
typedef CGAL::Polyhedron_3<CGALKernel> GMSPolyhedron::CGALPolyhedron |
|
strong |
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.
Enumerator | |
---|---|
COM | |
Surface | |
None |
|
default |
GMSPolyhedron::GMSPolyhedron | ( | const GMSPolyhedron & | _p | ) |
GMSPolyhedron::GMSPolyhedron | ( | GMSPolyhedron && | _p | ) |
GMSPolyhedron::GMSPolyhedron | ( | glutils::triangulated_model && | _t | ) |
|
default |
GMSPolyhedron::CGALPolyhedron GMSPolyhedron::CGAL | ( | ) | const |
Get a CGAL polyhedron representation of this object.
std::unique_ptr< WorkspaceBoundingBox > GMSPolyhedron::ComputeBoundingBox | ( | ) | const |
Compute an axis-aligned bounding box for this polyhedron.
GMSPolyhedron GMSPolyhedron::ComputeConvexHull | ( | ) | const |
Compute the polyhedron's convex hull vertices and facets.
const Vector3d & GMSPolyhedron::GetCentroid | ( | ) | const |
Get the centroid of the polyhedron (average of the vertices).
|
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.
|
noexcept |
Get the maximum radius relative to the polyhedron's center.
|
noexcept |
Get the minimum radius relative to the polyhedron's center.
|
noexcept |
|
noexcept |
|
noexcept |
Get the pqp CD model. It will be constructed if it doesn't already exist.
Point3d GMSPolyhedron::GetRandPtOnSurface | ( | ) | const |
Get a random point on the surface of the polyhedron.
|
noexcept |
Get the rapid CD model. It will be constructed if it doesn't already exist.
|
noexcept |
Get the total surface area of the polyhedron.
|
noexcept |
|
noexcept |
void GMSPolyhedron::Invert | ( | ) |
Invert the polyhedron so that normals face the opposite direction.
Vector3d GMSPolyhedron::LoadFromIModel | ( | IModel * | _imodel, |
COMAdjust | _comAdjust | ||
) |
Load vertices and triangles from the IModel, which loads all types of models.
_imodel | An IModel input. @param_comAdjust The COM adjustment type to use. |
@TODO Remove this and force everything to be bounding-box centered.
|
static |
Build an axis-aligned box polyhedron.
_x | The min/max range in the x direction. |
_y | The min/max range in the y direction. |
_z | The min/max range in the z direction. |
2-----6 +Y/| /| | 3--—7 | |—+X | 0—|-4 / |/ |/ +Z 1--—5
bool GMSPolyhedron::operator!= | ( | const GMSPolyhedron & | _p | ) | const |
GMSPolyhedron & GMSPolyhedron::operator*= | ( | const Transformation & | _t | ) |
Apply a transformation to the polyhedron.
GMSPolyhedron & GMSPolyhedron::operator= | ( | const GMSPolyhedron & | _p | ) |
GMSPolyhedron & GMSPolyhedron::operator= | ( | GMSPolyhedron && | _p | ) |
bool GMSPolyhedron::operator== | ( | const GMSPolyhedron & | _p | ) | const |
Vector3d GMSPolyhedron::Read | ( | const std::string & | _fileName, |
COMAdjust | _comAdjust | ||
) |
Read in a geometry file in either BYU or OBJ format.
_fileName | The name of the file to read. |
_comAdjust | The type of COM adjustment to use. |
void GMSPolyhedron::Scale | ( | double | _scalingFactor | ) |
Scale a polyhedron by a factor and keep it centered at its original centroid.
_scalingFactor | The scaling factor |
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.
void GMSPolyhedron::WriteBYU | ( | std::ostream & | _os | ) | const |
Output the model to a BYU-format file.
_os | The output stream to use. |
void GMSPolyhedron::WriteObj | ( | std::ostream & | _os | ) | const |
Output the model to a Obj-format file.
_os | The output stream to use. |