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

Base for convex polytope. More...

#include <coal/shape/geometric_shapes.h>

Inheritance diagram for coal::ConvexBaseTpl< _IndexType >:
Collaboration diagram for coal::ConvexBaseTpl< _IndexType >:

Public Types

typedef _IndexType index_type
 
typedef _IndexType IndexType
 
typedef ShapeBase Base
 
using Neighbors = coal::ConvexBaseTplNeighbors< IndexType >
 
using SupportWarmStartPolytope = ConvexBaseTplSupportWarmStartPolytope< IndexType >
 

Public Member Functions

virtual ~ConvexBaseTpl ()
 
Basebase ()
 Cast ConvexBaseTpl to ShapeBase. This method should never be marked as virtual. More...
 
const Basebase () const
 Const cast ConvexBaseTpl to ShapeBase. This method should never be marked as virtual. More...
 
 ConvexBaseTpl (const ConvexBaseTpl &other)
 Copy constructor. The copy constructor only shallow copies the data (it copies the shared pointers but does not deep clones the data). More...
 
ConvexBaseTploperator= (const ConvexBaseTpl &other)
 Copy assignment operator. The copy assignment operator shallow copies the data, just as the copy constructor. More...
 
virtual ConvexBaseTplclone () const
 Clone (deep copy). More...
 
virtual ConvexBaseTpldeepcopy () const
 Deep copy of the ConvexBaseTpl. This method deep copies every field of the class. More...
 
template<typename OtherIndexType >
ConvexBaseTpl< OtherIndexType > cast () const
 Cast this ConvexBase vertex indices to OtherIndexType. This effectively deep copies this ConvexBaseTpl into a new one. More...
 
void computeLocalAABB ()
 Compute AABB. More...
 
NODE_TYPE getNodeType () const
 Get node type: a convex polytope. More...
 
IndexType neighbor (IndexType i, IndexType j) const
 Get the index of the j-th neighbor of the i-th vertex. More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type 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 Vec3s computeCOM () const
 compute center of mass More...
 
virtual Matrix3s computeMomentofInertia () const
 compute the inertia matrix, related to the origin More...
 
virtual Scalar computeVolume () const
 compute the volume More...
 
virtual Matrix3s computeMomentofInertiaRelatedToCOM () const
 compute the inertia matrix, related to the com More...
 

Static Public Member Functions

static ConvexBaseTplconvexHull (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 ConvexBaseTplconvexHull (const Vec3s *points, unsigned int num_points, bool keepTriangles, const char *qhullCommand=NULL)
 

Public Attributes

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...
 

Static Public Attributes

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 Member Functions

 ConvexBaseTpl ()
 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...
 
void buildSupportWarmStart ()
 Build the support points warm starts. More...
 
void computeCenter ()
 
virtual bool isEqual (const CollisionGeometry &_other) const
 equal operator with another object of derived type. More...
 

Static Protected Member Functions

template<typename OtherIndexType >
static void deepcopy (const ConvexBaseTpl< IndexType > *source, ConvexBaseTpl< OtherIndexType > *copy)
 Deep copy of a ConvexBaseTpl. This method deep copies every field of the class. More...
 

Protected Attributes

std::shared_ptr< std::vector< IndexType > > 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...
 

Friends

template<typename OtherIndexType >
class ConvexBaseTpl
 

Detailed Description

template<typename _IndexType>
class coal::ConvexBaseTpl< _IndexType >

Base for convex polytope.

Template Parameters
_IndexTypetype of vertices indexes.
Note
Inherited classes are responsible for filling ConvexBase::neighbors;

Member Typedef Documentation

◆ Base

template<typename _IndexType >
typedef ShapeBase coal::ConvexBaseTpl< _IndexType >::Base

◆ index_type

template<typename _IndexType >
typedef _IndexType coal::ConvexBaseTpl< _IndexType >::index_type

◆ IndexType

template<typename _IndexType >
typedef _IndexType coal::ConvexBaseTpl< _IndexType >::IndexType

◆ Neighbors

template<typename _IndexType >
using coal::ConvexBaseTpl< _IndexType >::Neighbors = coal::ConvexBaseTplNeighbors<IndexType>

◆ SupportWarmStartPolytope

template<typename _IndexType >
using coal::ConvexBaseTpl< _IndexType >::SupportWarmStartPolytope = ConvexBaseTplSupportWarmStartPolytope<IndexType>

Constructor & Destructor Documentation

◆ ~ConvexBaseTpl()

template<typename _IndexType >
virtual coal::ConvexBaseTpl< _IndexType >::~ConvexBaseTpl ( )
inlinevirtual

◆ ConvexBaseTpl() [1/2]

template<typename _IndexType >
coal::ConvexBaseTpl< _IndexType >::ConvexBaseTpl ( const ConvexBaseTpl< _IndexType > &  other)
inline

Copy constructor. The copy constructor only shallow copies the data (it copies the shared pointers but does not deep clones the data).

◆ ConvexBaseTpl() [2/2]

template<typename _IndexType >
coal::ConvexBaseTpl< _IndexType >::ConvexBaseTpl ( )
inlineprotected

Construct an uninitialized convex object Initialization is done with ConvexBase::initialize.

Member Function Documentation

◆ base() [1/2]

template<typename _IndexType >
Base& coal::ConvexBaseTpl< _IndexType >::base ( )
inline

Cast ConvexBaseTpl to ShapeBase. This method should never be marked as virtual.

◆ base() [2/2]

template<typename _IndexType >
const Base& coal::ConvexBaseTpl< _IndexType >::base ( ) const
inline

Const cast ConvexBaseTpl to ShapeBase. This method should never be marked as virtual.

◆ buildSupportWarmStart()

template<typename _IndexType >
void coal::ConvexBaseTpl< _IndexType >::buildSupportWarmStart ( )
protected

Build the support points warm starts.

◆ cast()

template<typename _IndexType >
template<typename OtherIndexType >
ConvexBaseTpl<OtherIndexType> coal::ConvexBaseTpl< _IndexType >::cast ( ) const
inline

Cast this ConvexBase vertex indices to OtherIndexType. This effectively deep copies this ConvexBaseTpl into a new one.

◆ clone()

template<typename _IndexType >
virtual ConvexBaseTpl* coal::ConvexBaseTpl< _IndexType >::clone ( ) const
inlinevirtual

Clone (deep copy).

Implements coal::CollisionGeometry.

Reimplemented in coal::ConvexTpl< PolygonT >.

◆ computeCenter()

template<typename IndexType >
void coal::ConvexBaseTpl< IndexType >::computeCenter
protected

◆ computeLocalAABB()

template<typename IndexType >
void coal::ConvexBaseTpl< IndexType >::computeLocalAABB
virtual

Compute AABB.

Implements coal::CollisionGeometry.

◆ convexHull() [1/2]

template<typename _IndexType >
static ConvexBaseTpl* coal::ConvexBaseTpl< _IndexType >::convexHull ( const Vec3s points,
unsigned int  num_points,
bool  keepTriangles,
const char *  qhullCommand = NULL 
)
static

◆ convexHull() [2/2]

template<typename _IndexType >
static ConvexBaseTpl* coal::ConvexBaseTpl< _IndexType >::convexHull ( std::shared_ptr< std::vector< Vec3s >> &  points,
unsigned int  num_points,
bool  keepTriangles,
const char *  qhullCommand = NULL 
)
static

Build a convex hull based on Qhull library and store the vertices and optionally the triangles.

Parameters
points,num_pointsthe points whose convex hull should be computed.
keepTrianglesif true, returns a Convex<Triangle> object which contains the triangle of the shape.
qhullCommandthe command sent to qhull.
  • if keepTriangles is true, this parameter should include "Qt". If NULL, "Qt" is passed to Qhull.
  • if keepTriangles is false, an empty string is passed to Qhull.
Note
Coal must have been compiled with option COAL_HAS_QHULL set to ON.

◆ deepcopy() [1/2]

template<typename _IndexType >
virtual ConvexBaseTpl* coal::ConvexBaseTpl< _IndexType >::deepcopy ( ) const
inlinevirtual

Deep copy of the ConvexBaseTpl. This method deep copies every field of the class.

Reimplemented in coal::ConvexTpl< PolygonT >.

◆ deepcopy() [2/2]

template<typename IndexType >
template<typename OtherIndexType >
void coal::ConvexBaseTpl< IndexType >::deepcopy ( const ConvexBaseTpl< IndexType > *  source,
ConvexBaseTpl< OtherIndexType > *  copy 
)
staticprotected

Deep copy of a ConvexBaseTpl. This method deep copies every field of the class.

◆ getNodeType() [1/3]

template<typename IndexType >
NODE_TYPE coal::ConvexBaseTpl< IndexType >::getNodeType
virtual

Get node type: a convex polytope.

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [2/3]

NODE_TYPE coal::ConvexBaseTpl< std::uint16_t >::getNodeType ( ) const
inlinevirtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [3/3]

NODE_TYPE coal::ConvexBaseTpl< std::uint32_t >::getNodeType ( ) const
inlinevirtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ initialize()

template<typename IndexType >
void coal::ConvexBaseTpl< IndexType >::initialize ( std::shared_ptr< std::vector< Vec3s >>  points_,
unsigned int  num_points_ 
)
protected

Initialize the points of the convex shape This also initializes the ConvexBase::center.

Parameters
points_list of 3D points ///
num_points_number of 3D points

◆ isEqual()

template<typename _IndexType >
virtual bool coal::ConvexBaseTpl< _IndexType >::isEqual ( const CollisionGeometry other) const
inlineprotectedvirtual

equal operator with another object of derived type.

Implements coal::CollisionGeometry.

◆ neighbor()

template<typename _IndexType >
IndexType coal::ConvexBaseTpl< _IndexType >::neighbor ( IndexType  i,
IndexType  j 
) const
inline

Get the index of the j-th neighbor of the i-th vertex.

◆ operator=()

template<typename IndexType >
ConvexBaseTpl< IndexType > & coal::ConvexBaseTpl< IndexType >::operator= ( const ConvexBaseTpl< _IndexType > &  other)

Copy assignment operator. The copy assignment operator shallow copies the data, just as the copy constructor.

◆ set()

template<typename IndexType >
void coal::ConvexBaseTpl< IndexType >::set ( std::shared_ptr< std::vector< Vec3s >>  points_,
unsigned int  num_points_ 
)
protected

Set the points of the convex shape.

Parameters
points_list of 3D points ///
num_points_number of 3D points

Friends And Related Function Documentation

◆ ConvexBaseTpl

template<typename _IndexType >
template<typename OtherIndexType >
friend class ConvexBaseTpl
friend

Member Data Documentation

◆ center

template<typename _IndexType >
Vec3s coal::ConvexBaseTpl< _IndexType >::center

center of the convex polytope, this is used for collision: center is guaranteed in the internal of the polytope (as it is convex)

◆ neighbors

template<typename _IndexType >
std::shared_ptr<std::vector<Neighbors> > coal::ConvexBaseTpl< _IndexType >::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.

◆ nneighbors_

template<typename _IndexType >
std::shared_ptr<std::vector<IndexType> > coal::ConvexBaseTpl< _IndexType >::nneighbors_
protected

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.

◆ normals

template<typename _IndexType >
std::shared_ptr<std::vector<Vec3s> > coal::ConvexBaseTpl< _IndexType >::normals

An array of the normals of the polygon.

◆ num_normals_and_offsets

template<typename _IndexType >
unsigned int coal::ConvexBaseTpl< _IndexType >::num_normals_and_offsets

◆ num_points

template<typename _IndexType >
unsigned int coal::ConvexBaseTpl< _IndexType >::num_points

◆ num_support_warm_starts

template<typename _IndexType >
constexpr size_t coal::ConvexBaseTpl< _IndexType >::num_support_warm_starts = 14
staticconstexpr

Number of support warm starts.

◆ num_vertices_large_convex_threshold

template<typename _IndexType >
constexpr size_t coal::ConvexBaseTpl< _IndexType >::num_vertices_large_convex_threshold = 32
staticconstexpr

Above this threshold, the convex polytope is considered large. This influcences the way the support function is computed.

◆ offsets

template<typename _IndexType >
std::shared_ptr<std::vector<Scalar> > coal::ConvexBaseTpl< _IndexType >::offsets

An array of the offsets to the normals of the polygon. Note: there are as many offsets as normals.

◆ points

template<typename _IndexType >
std::shared_ptr<std::vector<Vec3s> > coal::ConvexBaseTpl< _IndexType >::points

An array of the points of the polygon.

◆ support_warm_starts

template<typename _IndexType >
SupportWarmStartPolytope coal::ConvexBaseTpl< _IndexType >::support_warm_starts

Support warm start polytopes.


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