Chain shape configuration. More...
#include <ChainShapeConf.hpp>
Public Member Functions | |
ChainShapeConf () | |
Default constructor. | |
ChainShapeConf & | Set (std::vector< Length2 > arg) |
Sets the configuration up for representing a chain of vertices as given. | |
ChainShapeConf & | Add (Length2 vertex) |
Adds the given vertex. | |
ChainShapeConf & | Transform (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. | |
ChainShapeConf & | UseVertexRadius (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 ChainShapeConf & | UseFriction (NonNegative< Real > value) noexcept |
Uses the given friction. | |
constexpr ChainShapeConf & | UseRestitution (Finite< Real > value) noexcept |
Uses the given restitution. | |
constexpr ChainShapeConf & | UseDensity (NonNegative< AreaDensity > value) noexcept |
Uses the given density. | |
Static Public Member Functions | |
static constexpr NonNegative< Length > | GetDefaultVertexRadius () noexcept |
Gets the default vertex radius. | |
Public Attributes | |
NonNegative< Length > | vertexRadius = GetDefaultVertexRadius() |
Vertex radius. More... | |
Public Attributes inherited from playrho::d2::BaseShapeConf | |
NonNegative< Real > | friction = NonNegative<Real>{Real{2} / Real{10}} |
Friction coefficient. More... | |
Finite< Real > | restitution = Finite<Real>{0} |
Restitution (elasticity) of the associated shape. More... | |
NonNegative< AreaDensity > | density = NonNegative<AreaDensity>{0_kgpm2} |
Area density of the associated shape. More... | |
Private Attributes | |
std::vector< Length2 > | m_vertices |
Vertices. | |
std::vector< UnitVec > | m_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. | |
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.
|
noexcept |
Transforms all the vertices by the given transformation matrix.
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.
Referenced by GetChild(), GetMassData(), and playrho::d2::GetVertexRadius().