PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::ConvexHull Class Reference

Convex hull. More...

#include <MultiShapeConf.hpp>

Collaboration diagram for playrho::d2::ConvexHull:
[legend]

Public Member Functions

DistanceProxy GetDistanceProxy () const
 Gets the distance proxy for this convex hull.
 
NonNegative< LengthGetVertexRadius () const noexcept
 Gets the vertex radius of this convex hull. More...
 
ConvexHullTransform (const Mat22 &m) noexcept
 Transforms all the vertices by the given transformation matrix. More...
 

Static Public Member Functions

static ConvexHull Get (const VertexSet &pointSet, NonNegative< Length > vertexRadius=NonNegative< Length >{DefaultLinearSlop *Real{2}})
 Gets the convex hull for the given set of vertices.
 

Private Member Functions

 ConvexHull (std::vector< Length2 > verts, std::vector< UnitVec > norms, NonNegative< Length > vr)
 Initializing constructor.
 

Private Attributes

std::vector< Length2vertices
 Array of vertices. More...
 
std::vector< UnitVecnormals
 Normals of edges. More...
 
NonNegative< LengthvertexRadius
 Vertex radius. More...
 

Friends

bool operator== (const ConvexHull &lhs, const ConvexHull &rhs) noexcept
 Equality operator.
 
bool operator!= (const ConvexHull &lhs, const ConvexHull &rhs) noexcept
 Inequality operator.
 

Detailed Description

Convex hull.

Member Function Documentation

◆ GetVertexRadius()

NonNegative<Length> playrho::d2::ConvexHull::GetVertexRadius ( ) const
inlinenoexcept

Gets the vertex radius of this convex hull.

Returns
Non-negative distance.

◆ Transform()

ConvexHull & playrho::d2::ConvexHull::Transform ( const Mat22 m)
noexcept

Transforms all the vertices by the given transformation matrix.

See also
https://en.wikipedia.org/wiki/Transformation_matrix

Referenced by playrho::d2::MultiShapeConf::Transform().

Member Data Documentation

◆ normals

std::vector<UnitVec> playrho::d2::ConvexHull::normals
private

Normals of edges.

These are 90-degree clockwise-rotated unit-vectors of the vectors defined by consecutive pairs of elements of vertices.

Referenced by GetDistanceProxy().

◆ vertexRadius

NonNegative<Length> playrho::d2::ConvexHull::vertexRadius
private

Vertex radius.

This is the radius from the vertex that the shape's "skin" should extend outward by. While any edges — line segments between multiple vertices — are straight, corners between them (the vertices) are rounded and treated as rounded. Shapes with larger vertex radiuses compared to edge lengths therefore will be more prone to rolling or having other shapes more prone to roll off of them.

Note
This should be a non-negative value.

Referenced by GetDistanceProxy(), and GetVertexRadius().

◆ vertices

std::vector<Length2> playrho::d2::ConvexHull::vertices
private

Array of vertices.

Consecutive vertices constitute "edges" of the polygon.

Referenced by GetDistanceProxy().


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