Template Class ConvexTpl

Inheritance Relationships

Base Type

Derived Type

Class Documentation

template<typename PolygonT>
class ConvexTpl : public coal::ConvexBaseTpl<PolygonT::IndexType>

Convex polytope.

Template Parameters:

PolygonT – the polygon class. It must have method size() and operator[](int i)

Subclassed by boost::serialization::internal::ConvexAccessor< PolygonT >

Public Types

typedef PolygonT::IndexType IndexType
typedef ConvexBaseTpl<IndexType> Base
typedef Base::Neighbors Neighbors

Public Functions

inline ConvexTpl()

Construct an uninitialized convex object.

inline ~ConvexTpl()
ConvexTpl(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.

Note

num_polygons_ is not the allocated size of polygons_.

Parameters:
  • points_ – list of 3D points

  • num_points_ – number of 3D points

  • polygons_

  • num_polygons_ – the number of polygons.

inline Base &base()

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

inline const Base &base() const

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

inline ConvexTpl(const ConvexTpl &other)

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

ConvexTpl &operator=(const ConvexTpl &other)

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

inline virtual ConvexTpl *clone() const override

Clone (deep copy).

inline virtual ConvexTpl *deepcopy() const override

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

template<typename OtherPolygonT>
inline ConvexTpl<OtherPolygonT> cast() const

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

virtual Matrix3s computeMomentofInertia() const override

based on http://number-none.com/blow/inertia/bb_inertia.doc

virtual Vec3s computeCOM() const override

compute center of mass

virtual Scalar computeVolume() const override

compute the volume

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.

Note

num_polygons is not the allocated size of polygons.

Parameters:
  • points – list of 3D points

  • num_points – number of 3D points

  • polygons

  • num_polygons – the number of polygons.

Public Members

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.

unsigned int num_polygons

Protected Functions

void fillNeighbors()

Protected Static Functions

template<typename OtherPolygonT>
static void deepcopy(const ConvexTpl<PolygonT> *source, ConvexTpl<OtherPolygonT> *copy)