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

Base configuration for initializing shapes. More...

#include <playrho/d2/ShapeConf.hpp>

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

Public Attributes

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

Related Functions

(Note that these are not member functions.)

constexpr NonNegative< AreaDensityGetDensity (const BaseShapeConf &arg) noexcept
 Gets the density of the given shape configuration.
 
constexpr Filter GetFilter (const BaseShapeConf &arg) noexcept
 Gets the filter of the given shape configuration.
 
constexpr NonNegativeFF< RealGetFriction (const BaseShapeConf &arg) noexcept
 Gets the friction of the given shape.
 
constexpr Finite< RealGetRestitution (const BaseShapeConf &arg) noexcept
 Gets the restitution of the given shape.
 
constexpr bool IsSensor (const BaseShapeConf &arg) noexcept
 Gets the is-sensor state of the given shape configuration.
 
void SetDensity (BaseShapeConf &arg, NonNegative< AreaDensity > value)
 Sets the density of the given shape configuration.
 
void SetFilter (BaseShapeConf &arg, Filter value)
 Sets the filter of the given shape configuration.
 
void SetFriction (BaseShapeConf &arg, NonNegative< Real > value)
 Sets the friction of the given shape.
 
void SetRestitution (BaseShapeConf &arg, Real value) noexcept
 Sets the restitution of the given shape.
 
void SetSensor (BaseShapeConf &arg, bool value)
 Sets the is-sensor state of the given shape configuration.
 

Detailed Description

Base configuration for initializing shapes.

Note
This is a nested base value class for initializing shapes.

Member Data Documentation

◆ density

NonNegative<AreaDensity> playrho::d2::BaseShapeConf::density = DefaultDensity

Area density of the associated shape.

Note
This must be a non-negative value.
Use 0 to indicate that the shape's associated mass should be 0.

Referenced by playrho::d2::ChainShapeConf::GetMassData(), playrho::d2::GetMassData(), playrho::d2::PolygonShapeConf::GetMassData(), and SetDensity().

◆ friction

NonNegative<Real> playrho::d2::BaseShapeConf::friction = DefaultFriction

Friction coefficient.

Note
This must be a value between 0 and +infinity. It is safer however to keep the value below the square root of the max value of a Real.
This is usually in the range [0,1].
The square-root of the product of this value multiplied by a touching fixture's friction becomes the friction coefficient for the contact.

Referenced by SetFriction().

◆ restitution

Finite<Real> playrho::d2::BaseShapeConf::restitution = DefaultRestitution

Restitution (elasticity) of the associated shape.

Note
This should be a valid finite value.
This is usually in the range [0,1].

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