Template Class ConvexBaseTpl
Defined in File geometric_shapes.h
Inheritance Relationships
Base Type
public coal::ShapeBase(Class ShapeBase)
Class Documentation
-
template<typename _IndexType>
class ConvexBaseTpl : public coal::ShapeBase Base for convex polytope.
Note
Inherited classes are responsible for filling ConvexBase::neighbors;
- Template Parameters:
_IndexType – type of vertices indexes.
Public Types
-
typedef _IndexType IndexType
-
using Neighbors = coal::ConvexBaseTplNeighbors<IndexType>
-
using SupportWarmStartPolytope = ConvexBaseTplSupportWarmStartPolytope<IndexType>
Public Functions
- COAL_DEPRECATED_MESSAGE (Use IndexType) typedef _IndexType index_type
-
inline virtual ~ConvexBaseTpl()
-
inline Base &base()
Cast ConvexBaseTpl to ShapeBase. This method should never be marked as virtual.
-
inline const Base &base() const
Const cast ConvexBaseTpl to ShapeBase. This method should never be marked as virtual.
-
inline 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).
-
ConvexBaseTpl &operator=(const ConvexBaseTpl &other)
Copy assignment operator. The copy assignment operator shallow copies the data, just as the copy constructor.
-
inline virtual ConvexBaseTpl *clone() const
Clone (deep copy).
-
inline virtual ConvexBaseTpl *deepcopy() const
Deep copy of the ConvexBaseTpl. This method deep copies every field of the class.
-
template<typename OtherIndexType>
inline ConvexBaseTpl<OtherIndexType> cast() const Cast this ConvexBase vertex indices to OtherIndexType. This effectively deep copies this ConvexBaseTpl into a new one.
-
inline IndexType neighbor(IndexType i, IndexType j) const
Get the index of the j-th neighbor of the i-th vertex.
-
inline virtual NODE_TYPE getNodeType() const
get the node type
-
inline virtual NODE_TYPE getNodeType() const
get the node type
Public Members
-
unsigned int num_points
-
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.
-
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.
-
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)
-
SupportWarmStartPolytope support_warm_starts
Support warm start polytopes.
Public Static Functions
- static COAL_DLLAPI ConvexBaseTpl * convexHull (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.
Note
Coal must have been compiled with option
COAL_HAS_QHULLset toON.- Parameters:
points, num_points – the points whose convex hull should be computed.
keepTriangles – if
true, returns a Convex<Triangle> object which contains the triangle of the shape.qhullCommand – the command sent to qhull.
if
keepTrianglesistrue, this parameter should include “Qt”. IfNULL, “Qt” is passed to Qhull.if
keepTrianglesisfalse, an empty string is passed to Qhull.
- static COAL_DEPRECATED COAL_DLLAPI ConvexBaseTpl * convexHull (const Vec3s *points, unsigned int num_points, bool keepTriangles, const char *qhullCommand=NULL)
Public Static 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.
-
static constexpr size_t num_support_warm_starts = 14
Number of support warm starts.
Protected Functions
-
inline ConvexBaseTpl()
Construct an uninitialized convex object Initialization is done with ConvexBase::initialize.
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
Set the points of the convex shape.
- Parameters:
points_ – list of 3D points ///
num_points_ – number of 3D points
- void COAL_DLLAPI buildSupportWarmStart ()
Build the support points warm starts.
-
void computeCenter()
-
inline virtual bool isEqual(const CollisionGeometry &_other) const
equal operator with another object of derived type.
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
neighborsattribute, an array ofNeighbors, is used to point each vertex to the right indices in thenneighbors_array.
Protected Static 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.
Friends
- friend class ConvexBaseTpl