coal  3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
coal::Convex< PolygonT > Class Template Reference

Convex polytope. More...

#include <coal/shape/convex.h>

Inheritance diagram for coal::Convex< PolygonT >:
Collaboration diagram for coal::Convex< PolygonT >:

Public Member Functions

 Convex ()
 Construct an uninitialized convex object. More...
 
 Convex (std::shared_ptr< std::vector< Vec3s >> points_, unsigned int num_points_, std::shared_ptr< std::vector< PolygonT >> polygons_, unsigned int num_polygons_)
 Constructing a convex, providing normal and offset of each polytype surface, and the points and shape topology information. More...
 
 Convex (const Convex &other)
 Copy constructor Only the list of neighbors is copied. More...
 
 ~Convex ()
 
Matrix3s computeMomentofInertia () const
 based on http://number-none.com/blow/inertia/bb_inertia.doc More...
 
Vec3s computeCOM () const
 compute center of mass More...
 
Scalar computeVolume () const
 compute the volume More...
 
void set (std::shared_ptr< std::vector< Vec3s >> points, unsigned int num_points, std::shared_ptr< std::vector< PolygonT >> polygons, unsigned int num_polygons)
 Set the current Convex from a list of points and polygons. More...
 
virtual Convex< PolygonT > * clone () const
 Clone (deep copy) More...
 
- Public Member Functions inherited from coal::ConvexBase
virtual ~ConvexBase ()
 
void computeLocalAABB ()
 Compute AABB. More...
 
NODE_TYPE getNodeType () const
 Get node type: a convex polytope. More...
 
- Public Member Functions inherited from coal::ShapeBase
 ShapeBase ()
 
 ShapeBase (const ShapeBase &other)
   More...
 
ShapeBaseoperator= (const ShapeBase &other)=default
 
virtual ~ShapeBase ()
 
OBJECT_TYPE getObjectType () const
 Get object type: a geometric shape. More...
 
void setSweptSphereRadius (Scalar radius)
 Set radius of sphere swept around the shape. Must be >= 0. More...
 
Scalar getSweptSphereRadius () const
 Get radius of sphere swept around the shape. This radius is always >= 0. More...
 
- Public Member Functions inherited from coal::CollisionGeometry
 CollisionGeometry ()
 
 CollisionGeometry (const CollisionGeometry &other)=default
 Copy constructor. More...
 
virtual ~CollisionGeometry ()
 
bool operator== (const CollisionGeometry &other) const
 Equality operator. More...
 
bool operator!= (const CollisionGeometry &other) const
 Difference operator. More...
 
void * getUserData () const
 get user data in geometry More...
 
void setUserData (void *data)
 set user data in geometry More...
 
bool isOccupied () const
 whether the object is completely occupied More...
 
bool isFree () const
 whether the object is completely free More...
 
bool isUncertain () const
 whether the object has some uncertainty More...
 
virtual Matrix3s computeMomentofInertiaRelatedToCOM () const
 compute the inertia matrix, related to the com More...
 

Public Attributes

std::shared_ptr< std::vector< PolygonT > > polygons
 An array of PolygonT object. PolygonT should contains a list of vertices for each polygon, in counter clockwise order. More...
 
unsigned int num_polygons
 
- Public Attributes inherited from coal::ConvexBase
std::shared_ptr< std::vector< Vec3s > > points
 An array of the points of the polygon. More...
 
unsigned int num_points
 
std::shared_ptr< std::vector< Vec3s > > normals
 An array of the normals of the polygon. More...
 
std::shared_ptr< std::vector< Scalar > > offsets
 An array of the offsets to the normals of the polygon. Note: there are as many offsets as normals. More...
 
unsigned int num_normals_and_offsets
 
std::shared_ptr< std::vector< Neighbors > > neighbors
 Neighbors of each vertex. It is an array of size num_points. For each vertex, it contains the number of neighbors and a list of indices pointing to them. More...
 
Vec3s center
 center of the convex polytope, this is used for collision: center is guaranteed in the internal of the polytope (as it is convex) More...
 
SupportWarmStartPolytope support_warm_starts
 Support warm start polytopes. More...
 
- Public Attributes inherited from coal::CollisionGeometry
Vec3s aabb_center
 AABB center in local coordinate. More...
 
Scalar aabb_radius
 AABB radius. More...
 
AABB aabb_local
 AABB in local coordinate, used for tight AABB when only translation transform. More...
 
void * user_data
 pointer to user defined data specific to this object More...
 
Scalar cost_density
 collision cost for unit volume More...
 
Scalar threshold_occupied
 threshold for occupied ( >= is occupied) More...
 
Scalar threshold_free
 threshold for free (<= is free) More...
 

Protected Member Functions

void fillNeighbors ()
 
- Protected Member Functions inherited from coal::ConvexBase
 ConvexBase ()
 Construct an uninitialized convex object Initialization is done with ConvexBase::initialize. More...
 
void initialize (std::shared_ptr< std::vector< Vec3s >> points_, unsigned int num_points_)
 Initialize the points of the convex shape This also initializes the ConvexBase::center. More...
 
void set (std::shared_ptr< std::vector< Vec3s >> points_, unsigned int num_points_)
 Set the points of the convex shape. More...
 
 ConvexBase (const ConvexBase &other)
 Copy constructor Only the list of neighbors is copied. More...
 
void buildSupportWarmStart ()
 Build the support points warm starts. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from coal::ConvexBase
static ConvexBaseconvexHull (std::shared_ptr< std::vector< Vec3s >> &points, unsigned int num_points, bool keepTriangles, const char *qhullCommand=NULL)
 Build a convex hull based on Qhull library and store the vertices and optionally the triangles. More...
 
static ConvexBaseconvexHull (const Vec3s *points, unsigned int num_points, bool keepTriangles, const char *qhullCommand=NULL)
 
- Static Public Attributes inherited from coal::ConvexBase
static constexpr size_t num_vertices_large_convex_threshold = 32
 Above this threshold, the convex polytope is considered large. This influcences the way the support function is computed. More...
 
static constexpr size_t num_support_warm_starts = 14
 Number of support warm starts. More...
 
- Protected Attributes inherited from coal::ConvexBase
std::shared_ptr< std::vector< unsigned int > > nneighbors_
 Array of indices of the neighbors of each vertex. Since we don't know a priori the number of neighbors of each vertex, we store the indices of the neighbors in a single array. The neighbors attribute, an array of Neighbors, is used to point each vertex to the right indices in the nneighbors_ array. More...
 
- Protected Attributes inherited from coal::ShapeBase
Scalar m_swept_sphere_radius {0}
 Radius of the sphere swept around the shape. Default value is 0. Note: this property differs from inflated method of certain derived classes (e.g. Box, Sphere, Ellipsoid, Capsule, Cone, Cylinder) in the sense that inflated returns a new shape which can be inflated but also deflated. Also, an inflated shape is not rounded. It simply has a different size. Sweeping a shape with a sphere is a different operation (a Minkowski sum), which rounds the sharp corners of a shape. The swept sphere radius is a property of the shape itself and can be manually updated between collision checks. More...
 

Detailed Description

template<typename PolygonT>
class coal::Convex< PolygonT >

Convex polytope.

Template Parameters
PolygonTthe polygon class. It must have method size() and operator[](int i)

Constructor & Destructor Documentation

◆ Convex() [1/3]

template<typename PolygonT >
coal::Convex< PolygonT >::Convex ( )
inline

Construct an uninitialized convex object.

◆ Convex() [2/3]

template<typename PolygonT >
coal::Convex< PolygonT >::Convex ( std::shared_ptr< std::vector< Vec3s >>  points_,
unsigned int  num_points_,
std::shared_ptr< std::vector< PolygonT >>  polygons_,
unsigned int  num_polygons_ 
)

Constructing a convex, providing normal and offset of each polytype surface, and the points and shape topology information.

Parameters
ownStoragewhether this class owns the pointers of points and polygons. If owned, they are deleted upon destruction.
points_list of 3D points
num_points_number of 3D points
polygons_An array of PolygonT object. PolygonT should contains a list of vertices for each polygon, in counter clockwise order.
num_polygons_the number of polygons.
Note
num_polygons_ is not the allocated size of polygons_.

◆ Convex() [3/3]

template<typename PolygonT >
coal::Convex< PolygonT >::Convex ( const Convex< PolygonT > &  other)

Copy constructor Only the list of neighbors is copied.

◆ ~Convex()

template<typename PolygonT >
coal::Convex< PolygonT >::~Convex

Member Function Documentation

◆ clone()

template<typename PolygonT >
Convex< PolygonT > * coal::Convex< PolygonT >::clone
virtual

Clone (deep copy)

Reimplemented from coal::ConvexBase.

◆ computeCOM()

template<typename PolygonT >
Vec3s coal::Convex< PolygonT >::computeCOM
virtual

compute center of mass

Reimplemented from coal::CollisionGeometry.

◆ computeMomentofInertia()

template<typename PolygonT >
Matrix3s coal::Convex< PolygonT >::computeMomentofInertia
virtual

◆ computeVolume()

template<typename PolygonT >
Scalar coal::Convex< PolygonT >::computeVolume
virtual

compute the volume

Reimplemented from coal::CollisionGeometry.

◆ fillNeighbors()

template<typename PolygonT >
void coal::Convex< PolygonT >::fillNeighbors
protected

◆ set()

template<typename PolygonT >
void coal::Convex< PolygonT >::set ( std::shared_ptr< std::vector< Vec3s >>  points,
unsigned int  num_points,
std::shared_ptr< std::vector< PolygonT >>  polygons,
unsigned int  num_polygons 
)

Set the current Convex from a list of points and polygons.

Parameters
ownStoragewhether this class owns the pointers of points and polygons. If owned, they are deleted upon destruction.
pointslist of 3D points
num_pointsnumber of 3D points
polygonsAn array of PolygonT object. PolygonT should contains a list of vertices for each polygon, in counter clockwise order.
num_polygonsthe number of polygons.
Note
num_polygons is not the allocated size of polygons.

Member Data Documentation

◆ num_polygons

template<typename PolygonT >
unsigned int coal::Convex< PolygonT >::num_polygons

◆ polygons

template<typename PolygonT >
std::shared_ptr<std::vector<PolygonT> > coal::Convex< PolygonT >::polygons

An array of PolygonT object. PolygonT should contains a list of vertices for each polygon, in counter clockwise order.


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