Class ConvexBase

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class ConvexBase : public coal::ShapeBase

Base for convex polytope.

Note

Inherited classes are responsible for filling ConvexBase::neighbors;

Subclassed by boost::serialization::internal::ConvexBaseAccessor, coal::Convex< PolygonT >

Public Functions

virtual ~ConvexBase()
inline virtual ConvexBase *clone() const

Clone (deep copy). This method is consistent with BVHModel clone method. The copy constructor is called, which duplicates the data.

virtual void computeLocalAABB()

Compute AABB.

inline virtual NODE_TYPE getNodeType() const

Get node type: a convex polytope.

Public Members

std::shared_ptr<std::vector<Vec3s>> points

An array of the points of the polygon.

unsigned int num_points
std::shared_ptr<std::vector<Vec3s>> normals

An array of the normals of the polygon.

std::shared_ptr<std::vector<double>> 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 ConvexBase *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_QHULL set to ON.

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

static COAL_DEPRECATED ConvexBase * 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 ConvexBase()

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

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.

Parameters:
  • ownStorage – weither the ConvexBase owns the data.

  • points_ – list of 3D points ///

  • num_points_ – number of 3D points

void set(std::shared_ptr<std::vector<Vec3s>> points_, unsigned int num_points_)

Set the points of the convex shape.

Parameters:
  • ownStorage – weither the ConvexBase owns the data.

  • points_ – list of 3D points ///

  • num_points_ – number of 3D points

ConvexBase(const ConvexBase &other)

Copy constructor Only the list of neighbors is copied.

void buildSupportWarmStart()

Build the support points warm starts.

Protected Attributes

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.

struct Neighbors

Public Functions

inline unsigned char const &count() const
inline unsigned int &operator[](int i)
inline unsigned int const &operator[](int i) const
inline bool operator==(const Neighbors &other) const
inline bool operator!=(const Neighbors &other) const

Public Members

unsigned char count_
unsigned int *n_
struct SupportWarmStartPolytope

The support warm start polytope contains certain points of this which are support points in specific directions of space. This struct is used to warm start the support function computation for large meshes (num_points > 32).

Public Members

std::vector<Vec3s> points

Array of support points to warm start the support function computation.

std::vector<int> indices

Indices of the support points warm starts. These are the indices of the real convex, not the indices of points in the warm start polytope.