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

Chain shape configuration. More...

#include <ChainShapeConf.hpp>

Inheritance diagram for playrho::d2::ChainShapeConf:
[legend]
Collaboration diagram for playrho::d2::ChainShapeConf:
[legend]

Public Member Functions

 ChainShapeConf ()
 Default constructor.
 
ChainShapeConfSet (std::vector< Length2 > arg)
 Sets the configuration up for representing a chain of vertices as given.
 
ChainShapeConfAdd (Length2 vertex)
 Adds the given vertex.
 
ChainShapeConfTransform (const Mat22 &m) noexcept
 Transforms all the vertices by the given transformation matrix. More...
 
ChildCounter GetChildCount () const noexcept
 Gets the "child" shape count.
 
DistanceProxy GetChild (ChildCounter index) const
 Gets the "child" shape at the given index.
 
MassData GetMassData () const noexcept
 Gets the mass data.
 
ChainShapeConfUseVertexRadius (NonNegative< Length > value) noexcept
 Uses the given vertex radius.
 
ChildCounter GetVertexCount () const noexcept
 Gets the vertex count.
 
Length2 GetVertex (ChildCounter index) const
 Gets a vertex by index.
 
UnitVec GetNormal (ChildCounter index) const
 Gets the normal at the given index.
 
- Public Member Functions inherited from playrho::d2::ShapeBuilder< ChainShapeConf >
constexpr ShapeBuilder ()=default
 Default constructor.
 
constexpr ShapeBuilder (const BaseShapeConf &value) noexcept
 Initializing constructor.
 
constexpr ChainShapeConfUseFriction (NonNegative< Real > value) noexcept
 Uses the given friction.
 
constexpr ChainShapeConfUseRestitution (Finite< Real > value) noexcept
 Uses the given restitution.
 
constexpr ChainShapeConfUseDensity (NonNegative< AreaDensity > value) noexcept
 Uses the given density.
 

Static Public Member Functions

static constexpr NonNegative< LengthGetDefaultVertexRadius () noexcept
 Gets the default vertex radius.
 

Public Attributes

NonNegative< LengthvertexRadius = GetDefaultVertexRadius()
 Vertex radius. More...
 
- Public Attributes inherited from playrho::d2::BaseShapeConf
NonNegative< Realfriction = NonNegative<Real>{Real{2} / Real{10}}
 Friction coefficient. More...
 
Finite< Realrestitution = Finite<Real>{0}
 Restitution (elasticity) of the associated shape. More...
 
NonNegative< AreaDensitydensity = NonNegative<AreaDensity>{0_kgpm2}
 Area density of the associated shape. More...
 

Private Attributes

std::vector< Length2m_vertices
 Vertices.
 
std::vector< UnitVecm_normals
 Normals.
 

Friends

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

Detailed Description

Chain shape configuration.

A chain shape is a free form sequence of line segments. The chain has two-sided collision, so you can use inside and outside collision. Therefore, you may use any winding order. Since there may be many vertices, they are allocated on the memory heap.

Warning
The chain will not collide properly if there are self-intersections.

Member Function Documentation

◆ Transform()

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

Transforms all the vertices by the given transformation matrix.

Note
This updates the normals too.
See also
https://en.wikipedia.org/wiki/Transformation_matrix

Member Data Documentation

◆ vertexRadius

NonNegative<Length> playrho::d2::ChainShapeConf::vertexRadius = GetDefaultVertexRadius()

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 GetChild(), GetMassData(), and playrho::d2::GetVertexRadius().


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