PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::ChainShapeConf Struct Reference

Chain shape configuration. More...

#include <playrho/d2/ChainShapeConf.hpp>

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

Classes

class  VerticesWithNormals
 

Public Member Functions

ChainShapeConfAdd (const Length2 &vertex)
 Adds the given vertex.
 
DistanceProxy GetChild (ChildCounter index) const
 Gets the "child" shape at the given index.
 
ChildCounter GetChildCount () const noexcept
 Gets the "child" shape count.
 
MassData GetMassData () const
 Gets the mass data.
 
UnitVec GetNormal (ChildCounter index) const
 Gets the normal at the given index.
 
Length2 GetVertex (ChildCounter index) const
 Gets a vertex by index.
 
ChildCounter GetVertexCount () const noexcept
 Gets the vertex count.
 
ChainShapeConfRotate (const UnitVec &value)
 Rotates the vertices by the given amount. More...
 
ChainShapeConfScale (const Vec2 &value)
 Scales the vertices by the given amount. More...
 
ChainShapeConfSet (std::vector< Length2 > vertices)
 Sets the configuration up for representing a chain of vertices as given. More...
 
ChainShapeConfTranslate (const Length2 &value)
 Translates the vertices by the given amount. More...
 
ChainShapeConfUseVertexRadius (NonNegative< Length > value) noexcept
 Uses the given vertex radius.
 
- Public Member Functions inherited from playrho::d2::ShapeBuilder< ChainShapeConf >
constexpr ChainShapeConfUseDensity (NonNegative< AreaDensity > value) noexcept
 Uses the given density.
 
constexpr ChainShapeConfUseFilter (Filter value) noexcept
 Uses the given filter.
 
constexpr ChainShapeConfUseFriction (NonNegative< Real > value) noexcept
 Uses the given friction.
 
constexpr ChainShapeConfUseIsSensor (bool value) noexcept
 Uses the given is-sensor value.
 
constexpr ChainShapeConfUseRestitution (Finite< Real > value) noexcept
 Uses the given restitution.
 

Static Public Member Functions

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

Public Attributes

VerticesWithNormals segments
 Vertex & normals data.
 
NonNegative< LengthvertexRadius = GetDefaultVertexRadius()
 Vertex radius. More...
 
- Public Attributes inherited from playrho::d2::BaseShapeConf
NonNegative< AreaDensitydensity = DefaultDensity
 Area density of the associated shape. More...
 
Filter filter = DefaultFilter
 Filtering data for contacts.
 
NonNegative< Realfriction = DefaultFriction
 Friction coefficient. More...
 
bool isSensor = DefaultIsSensor
 A sensor shape collects contact information but never generates a collision response.
 
Finite< Realrestitution = DefaultRestitution
 Restitution (elasticity) of the associated shape. More...
 

Static Public Attributes

static constexpr auto DefaultVertexRadius = NonNegative<Length>{DefaultLinearSlop * Real{2}}
 Default vertex radius.
 
- Static Public Attributes inherited from playrho::d2::BaseShapeConf
static constexpr auto DefaultDensity = NonNegative<AreaDensity>{0_kgpm2}
 Default density value.
 
static constexpr auto DefaultFilter = Filter{}
 Default filter value.
 
static constexpr auto DefaultFriction = NonNegative<Real>{Real{2} / Real{10}}
 Default friction value.
 
static constexpr auto DefaultIsSensor = false
 Default is-sensor value.
 
static const auto DefaultRestitution = Finite<Real>{}
 Default restitution value.
 

Friends

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

Additional Inherited Members

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

◆ GetDefaultVertexRadius()

static constexpr NonNegative<Length> playrho::d2::ChainShapeConf::GetDefaultVertexRadius ( )
inlinestaticconstexprnoexcept

Gets the default vertex radius.

Note
This is just a backward compatibility interface for getting the default vertex radius. The new way is to use DefaultVertexRadius directly.
Returns
DefaultVertexRadius.

◆ Rotate()

ChainShapeConf & playrho::d2::ChainShapeConf::Rotate ( const UnitVec value)

Rotates the vertices by the given amount.

Note
This function provides the strong exception guarantee. The state of this instance won't change if this function throws any exception.

Referenced by playrho::d2::Rotate().

◆ Scale()

ChainShapeConf & playrho::d2::ChainShapeConf::Scale ( const Vec2 value)

Scales the vertices by the given amount.

Note
This function provides the strong exception guarantee. The state of this instance won't change if this function throws any exception.

Referenced by playrho::d2::Scale().

◆ Set()

ChainShapeConf & playrho::d2::ChainShapeConf::Set ( std::vector< Length2 vertices)

Sets the configuration up for representing a chain of vertices as given.

Note
This function provides the strong exception guarantee. The state of this instance won't change if this function throws any exception.
Exceptions
InvalidArgumentif the number of vertices given is greater than MaxChildCount.
Postcondition
GetVertices() returns the vertices given.
GetVertexCount() returns the number of vertices given.
GetVertex(i) returns the vertex vertices[i] for all valid indices.

◆ Translate()

ChainShapeConf & playrho::d2::ChainShapeConf::Translate ( const Length2 value)

Translates the vertices by the given amount.

Note
This function provides the strong exception guarantee. The state of this instance won't change if this function throws any exception.

Referenced by playrho::d2::Translate().

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(), and GetMassData().


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