PlayRho  2.0.0
An interactive physics engine & library.
playrho Namespace Reference

Namespaces

 d2
 
 detail
 
 pmr
 

Classes

class  ArrayList
 Array list. More...
 
class  BlockAllocator
 
struct  BlockDeallocator
 Block deallocator. More...
 
struct  ConstraintSolverConf
 Constraint solver configuration data. More...
 
class  Contact
 A potential contact between the children of two body associated shapes. More...
 
struct  Contactable
 Aggregate data for identifying one side (of two) in a contact. More...
 
struct  ContactFeature
 The contact feature. More...
 
class  ContactKey
 Key value class for contacts. More...
 
struct  DynamicTreeBranchData
 Branch data of a tree node. More...
 
struct  DynamicTreeUnusedData
 Unused data of a tree node. More...
 
union  DynamicTreeVariantData
 Variant data. More...
 
struct  Filter
 A holder for contact filtering data. More...
 
class  FlagGuard
 Flag guard type. More...
 
class  GrowableStack
 
class  Interval
 Interval template type. More...
 
class  InvalidArgument
 Invalid argument logic error. More...
 
struct  Island
 Definition of a self-contained constraint "island". More...
 
struct  IslandStats
 Island solver statistics. More...
 
class  LengthError
 Length based logic error. More...
 
struct  LengthIndexPair
 A length associated with two vertex counter indices. More...
 
struct  LexicographicalGreater
 Function object for performing lexicographical greater-than comparisons of containers. More...
 
struct  LexicographicalGreaterEqual
 Function object for performing lexicographical greater-than or equal-to comparisons of containers. More...
 
struct  LexicographicalLess
 Function object for performing lexicographical less-than comparisons of containers. More...
 
struct  LexicographicalLessEqual
 Function object for performing lexicographical less-than or equal-to comparisons of containers. More...
 
struct  MovementConf
 Movement configuration. More...
 
class  ObjectPool
 Object pool with indexable properties. More...
 
class  OutOfRange
 Out-of-range exception with a range type & value. More...
 
struct  PreStepStats
 Pre-phase per-step statistics. More...
 
struct  RegStepStats
 Regular-phase per-step statistics. More...
 
struct  ReversionWrapper
 Wrapper for reversing ranged-for loop ordering. More...
 
class  Span
 An encapsulation of an array and its size. More...
 
class  StackAllocator
 
struct  StepConf
 Step configuration. More...
 
struct  StepStats
 Per-step statistics. More...
 
class  ThreadLocalAllocator
 Thread local "stateless" allocator. More...
 
struct  ToiConf
 Time of impact configuration. More...
 
struct  ToiOutput
 Output data for time of impact. More...
 
struct  ToiStepStats
 TOI-phase per-step statistics. More...
 
class  TypeID
 Type identifier. More...
 
struct  Vector
 Vector. More...
 
struct  Version
 Version numbering scheme. More...
 
struct  WasDestroyed
 Was destroyed invalid argument logic error. More...
 
class  WrongState
 Wrong state logic error. More...
 

Typedefs

using Angle = detail::plane_angle
 Angle quantity. More...
 
using AngularAcceleration = detail::angular_acceleration
 Angular acceleration quantity. More...
 
using AngularMomentum = detail::angular_momentum
 Angular momentum quantity. More...
 
using AngularVelocity = detail::angular_velocity
 Angular velocity quantity. More...
 
using Area = detail::area
 Area quantity. More...
 
using AreaDensity = detail::surface_density
 Area (surface) density quantity. More...
 
using BodyCounter = std::remove_const_t< decltype(MaxBodies)>
 Count type for bodies. More...
 
using BodyID = detail::IndexingNamedType< BodyCounter, struct BodyIdentifier >
 Body identifier. More...
 
using BodyShapeFunction = std::function< void(std::pair< BodyID, ShapeID >)>
 Body-shapes function.
 
using ChildCounter = std::remove_const_t< decltype(MaxChildCount)>
 Child counter type. More...
 
using ContactCounter = WiderType< BodyCounter >
 Count type for contacts. More...
 
using ContactFunction = std::function< void(ContactID)>
 Contacts function.
 
using ContactID = detail::IndexingNamedType< ContactCounter, struct ContactIdentifier >
 Contact identifier. More...
 
template<typename Type , typename Check , typename DecayedType = std::decay_t<Type>>
using DecayedTypeIfNotSame = std::enable_if_t<!std::is_same_v< DecayedType, Check >, DecayedType >
 Decayed type if not same as the checked type. More...
 
using DynamicTreeSize = ContactCounter
 Dynamic tree size type.
 
template<typename T >
using Finite = detail::Checked< T, detail::FiniteChecker< T > >
 Finite constrained value type.
 
template<typename T >
using FiniteFF = detail::Checked< T, detail::FiniteChecker< T >, true >
 Fast failing finite constrained value type.
 
using Force = detail::force
 Force quantity. More...
 
using Force2 = Vector2< Force >
 2-element vector of Force quantities. More...
 
using Frequency = detail::frequency
 Frequency quantity. More...
 
template<typename Type , typename Return >
using HasNullaryFunctor = detail::HasFunctor< Type, Return()>
 Has nullary functor type alias. More...
 
template<typename Type , typename Return , typename Arg >
using HasUnaryFunctor = detail::HasFunctor< Type, Return(Arg)>
 Has unary functor type alias. More...
 
using IndexPair = std::pair< VertexCounter, VertexCounter >
 Index pair. More...
 
using IndexPair3 = std::array< IndexPair, MaxSimplexEdges >
 Array of three index-pair elements. More...
 
using InvMass = detail::inverse_mass
 Inverse mass quantity. More...
 
using InvMass2 = Vector2< InvMass >
 2-element vector of inverse mass (InvMass) quantities.
 
using InvMass22 = Matrix22< InvMass >
 2 by 2 matrix of InvMass elements.
 
using InvMass3 = Vector3< InvMass >
 3-element vector of inverse mass (InvMass) quantities.
 
using InvRotInertia = detail::inverse_moment_of_inertia
 Inverse rotational inertia quantity. More...
 
using JointCounter = std::remove_const_t< decltype(MaxJoints)>
 Counter type for joints. More...
 
using JointFunction = std::function< void(JointID)>
 Joints function.
 
using JointID = detail::IndexingNamedType< JointCounter, struct JointIdentifier >
 Joint identifier. More...
 
using KeyedContactID = std::pair< ContactKey, ContactID >
 Keyed contact identifier.
 
using Length = detail::length
 Length quantity. More...
 
using Length2 = Vector2< Length >
 2-element vector of Length quantities. More...
 
using LinearAcceleration = detail::acceleration
 Linear acceleration quantity. More...
 
using LinearAcceleration2 = Vector2< LinearAcceleration >
 2-element vector of linear acceleration (LinearAcceleration) quantities. More...
 
using LinearVelocity = detail::velocity
 Linear velocity quantity. More...
 
using LinearVelocity2 = Vector2< LinearVelocity >
 2-element vector of linear velocity (LinearVelocity) quantities. More...
 
using Mass = detail::mass
 Mass quantity. More...
 
using Mass2 = Vector2< Mass >
 2-element vector of Mass quantities.
 
using Mass22 = Matrix22< Mass >
 2 by 2 matrix of Mass elements.
 
using Mass3 = Vector3< Mass >
 3-element vector of Mass quantities.
 
using Mat22 = Matrix22< Real >
 2 by 2 matrix of Real elements.
 
using Mat33 = Matrix33< Real >
 3 by 3 matrix of Real elements.
 
template<typename T , std::size_t M, std::size_t N>
using Matrix = Vector< Vector< T, N >, M >
 Generic M by N matrix. More...
 
template<typename T >
using Matrix22 = Matrix< T, 2, 2 >
 2 by 2 matrix.
 
template<typename T >
using Matrix33 = Matrix< T, 3, 3 >
 3 by 3 matrix.
 
using Momentum = detail::momentum
 Momentum quantity. More...
 
using Momentum2 = Vector2< Momentum >
 2-element vector of Momentum quantities. More...
 
template<typename T >
using Negative = detail::Checked< T, detail::NegativeChecker< T > >
 Negative constrained value type.
 
template<typename T >
using NegativeFF = detail::Checked< T, detail::NegativeChecker< T >, true >
 Fast failing negative constrained value type.
 
template<typename T >
using NonNegative = detail::Checked< T, detail::NonNegativeChecker< T > >
 Non-negative constrained value type.
 
template<typename T >
using NonNegativeFF = detail::Checked< T, detail::NonNegativeChecker< T >, true >
 Fast failing non-negative constrained value type.
 
template<typename T >
using NonNull = std::enable_if_t< std::is_pointer_v< T >, detail::Checked< T, detail::NonZeroChecker< T > >>
 Non-null constrained value type.
 
template<typename T >
using NonNullFF = std::enable_if_t< std::is_pointer_v< T >, detail::Checked< T, detail::NonZeroChecker< T >, true > >
 Fast failing non-null constrained value type.
 
template<typename T >
using NonPositive = detail::Checked< T, detail::NonPositiveChecker< T > >
 Non-positive constrained value type.
 
template<typename T >
using NonPositiveFF = detail::Checked< T, detail::NonPositiveChecker< T >, true >
 Fast failing non-positive constrained value type.
 
template<typename T >
using NonZero = std::enable_if_t<!std::is_pointer_v< T >, detail::Checked< T, detail::NonZeroChecker< T > >>
 Non-zero constrained value type.
 
template<typename T >
using NonZeroFF = std::enable_if_t<!std::is_pointer_v< T >, detail::Checked< T, detail::NonZeroChecker< T >, true > >
 Fast failing non-zero constrained value type.
 
using PairLength2 = std::pair< Length2, Length2 >
 Pair of Length2 values. More...
 
template<typename T >
using Positive = detail::Checked< T, detail::PositiveChecker< T > >
 Positive constrained value type.
 
template<typename T >
using PositiveFF = detail::Checked< T, detail::PositiveChecker< T >, true >
 Fast failing positive constrained value type.
 
using Real = float
 Real-number type. More...
 
using RotInertia = detail::moment_of_inertia
 Rotational inertia quantity. More...
 
using SecondMomentOfArea = detail::second_moment_of_area
 Second moment of area quantity. More...
 
using ShapeCounter = std::remove_const_t< decltype(MaxShapes)>
 Count type for shapes. More...
 
using ShapeFunction = std::function< void(ShapeID)>
 Shapes function.
 
using ShapeID = detail::IndexingNamedType< ShapeCounter, struct ShapeIdentifier >
 Shape identifier. More...
 
using Time = detail::time
 Time quantity. More...
 
using TimestepIters = std::uint8_t
 Time step iterations type. More...
 
using Torque = detail::torque
 Torque quantity. More...
 
template<class T >
using underlying_type_t = typename detail::underlying_type< T >::type
 Underlying-type convenience alias.
 
template<typename T >
using UnitInterval = detail::Checked< T, detail::UnitIntervalChecker< T > >
 Unit interval constrained value type.
 
template<typename T >
using UnitIntervalFF = detail::Checked< T, detail::UnitIntervalChecker< T >, true >
 Fast failing unit interval constrained value type.
 
using Vec2 = Vector2< Real >
 Vector with 2 Real elements. More...
 
using Vec3 = Vector3< Real >
 A 3-dimensional column vector with 3 elements.
 
template<typename T >
using Vector2 = Vector< T, 2 >
 Vector with 2-elements. More...
 
template<typename T >
using Vector3 = Vector< T, 3 >
 Vector with 3-elements. More...
 
using VertexCounter = std::remove_const_t< decltype(MaxShapeVertices)>
 Vertex count type. More...
 
using VertexCounter2 = VertexCounterArray< 2 >
 2-element vertex counter array.
 
template<std::size_t N>
using VertexCounterArray = std::array< VertexCounter, N >
 Vertex counter array template alias.
 
template<typename T >
using WiderType = typename detail::Wider< T >::type
 The wider type helper.
 
template<typename T >
using ZeroToUnderOne = detail::Checked< T, detail::ZeroToUnderOneChecker< T > >
 Unit interval constrained value type.
 
template<typename T >
using ZeroToUnderOneFF = detail::Checked< T, detail::ZeroToUnderOneChecker< T >, true >
 Fast failing unit interval constrained value type.
 

Enumerations

enum class  BodyType { Static = 0 , Kinematic , Dynamic }
 Type of body. More...
 
enum class  LimitState { e_inactiveLimit , e_atLowerLimit , e_atUpperLimit , e_equalLimits }
 Limit state. More...
 
enum class  PointState { Null , Add , Persist , Remove }
 Point state enumeration. More...
 
enum class  RayCastOpcode { Terminate , IgnoreFixture , ClipRay , ResetRay }
 Ray cast opcode enumeration. More...
 

Functions

d2::UnitVec abs (const d2::UnitVec &v) noexcept
 Gets the absolute value of the given value.
 
template<typename T , std::size_t N>
constexpr auto abs (const Vector< T, N > &v) noexcept -> decltype(abs(T{}), Vector< T, N >{})
 Absolute value function for vectors.
 
void * Alloc (std::size_t size)
 Allocates memory. More...
 
template<typename T >
T * AllocArray (std::size_t size)
 Allocates memory for an array. More...
 
template<typename T >
constexpr auto AlmostEqual (T a, T b, int ulp=4) -> std::enable_if_t< IsArithmeticV< T >, bool >
 Determines whether the given two values are "almost equal". More...
 
template<typename T >
constexpr auto AlmostZero (const T &value) -> decltype(abs(value)< std::numeric_limits< T >::min())
 Gets whether a given value is almost zero. More...
 
template<typename T >
auto Atan2 (T y, T x)
 Computes the arc-tangent of the given y and x values. More...
 
template<typename T >
auto Average (const T &span)
 Computes the average of the given values.
 
template<typename T >
auto begin (ReversionWrapper< T > w)
 Begin function for getting a reversed order iterator.
 
template<typename T >
constexpr auto Bisect (const T &a1, const T &a2) -> decltype((a1+a2)/2)
 Bisection method. More...
 
template<class T >
constexpr auto cfloor (T v) noexcept
 Constant expression enhanced floor function. More...
 
void Clear (Island &island) noexcept
 Clears the island containers.
 
constexpr auto compare (const Version &lhs, const Version &rhs) noexcept
 Comparison function. More...
 
Length2 ComputeCentroid (const Span< const Length2 > &vertices)
 Computes the centroid of a counter-clockwise array of 3 or more vertices. More...
 
std::size_t Count (const Island &island, BodyID entry)
 Counts the number of occurrences of the given entry in the given island.
 
std::size_t Count (const Island &island, ContactID entry)
 Counts the number of occurrences of the given entry in the given island.
 
std::size_t Count (const Island &island, JointID entry)
 Counts the number of occurrences of the given entry in the given island.
 
template<class T1 , class T2 , std::enable_if_t< std::tuple_size_v< T1 >==2 &&std::tuple_size_v< T2 >==2, int > = 0>
constexpr auto Cross (const T1 &a, const T2 &b) noexcept
 Performs the 2-element analog of the cross product of two vectors. More...
 
template<class T >
constexpr auto ctrunc (T v) noexcept
 Constant expression enhanced truncate function. More...
 
template<typename T1 , typename T2 >
constexpr auto Dot (const T1 &a, const T2 &b) noexcept
 Performs the dot product on two vectors (A and B). More...
 
constexpr bool empty (IndexPair3 pairs) noexcept
 Checks whether the given collection of index pairs is empty.
 
template<typename T >
auto end (ReversionWrapper< T > w)
 End function for getting a reversed order iterator.
 
template<class InputIt1 , class InputIt2 >
constexpr auto Equal (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) -> decltype(first1==last1, first2==last2,++first1,++first2, *first1== *first2)
 A pre-C++20 constant expression implementation of std::equal. More...
 
template<typename T , typename U >
auto EraseAll (T &container, const U &value) -> decltype(distance(container.erase(remove(begin(container), end(container), value), end(container)), end(container)))
 Convenience template function for erasing specified value from container. More...
 
template<typename T , typename U >
auto EraseFirst (T &container, const U &value) -> decltype(container.erase(find(begin(container), end(container), value)) !=end(container))
 Convenience template function for erasing first found value from container. More...
 
constexpr void FlagForFiltering (Contact &contact) noexcept
 Flags the contact for filtering. More...
 
constexpr void FlagForUpdating (Contact &contact) noexcept
 Flags the contact for updating. More...
 
constexpr ContactFeature Flip (ContactFeature val) noexcept
 Flips contact features information.
 
void Free (void *mem)
 Frees memory. More...
 
template<std::size_t I, std::size_t N, typename T >
constexpr auto get (const Vector< T, N > &v) noexcept
 Gets the specified element of the given collection.
 
template<std::size_t I, std::size_t N, typename T >
constexpr auto & get (Vector< T, N > &v) noexcept
 Gets the specified element of the given collection.
 
template<class T >
Angle GetAngle (const Vector2< T > &value)
 Gets the angle. More...
 
NonNegativeFF< AreaGetAreaOfCircle (Length radius)
 Gets the area of a circle.
 
NonNegativeFF< AreaGetAreaOfPolygon (const Span< const Length2 > &vertices)
 Gets the area of a polygon. More...
 
constexpr BodyID GetBodyA (const Contact &contact) noexcept
 Gets the body A ID of the given contact.
 
constexpr BodyID GetBodyB (const Contact &contact) noexcept
 Gets the body B ID of the given contact.
 
std::string GetBuildDetails ()
 Gets the build details of the library.
 
template<typename T , typename U = decltype(Interval<T>{}, ((T{} + T{}) / 2))>
constexpr auto GetCenter (const Interval< T > &v) noexcept(noexcept((v.GetMin()+v.GetMax())/2))
 Gets the center of the given interval. More...
 
constexpr ChildCounter GetChildIndexA (const Contact &contact) noexcept
 Gets the child index A of the given contact.
 
constexpr ChildCounter GetChildIndexB (const Contact &contact) noexcept
 Gets the child index B of the given contact.
 
std::vector< Length2GetCircleVertices (Length radius, std::size_t slices, Angle start=0_deg, Real turns=Real(1))
 Gets the vertices for a circle described by the given parameters.
 
template<typename T , std::size_t N>
constexpr std::enable_if_t<!IsVectorV< T >, Vector< Vector< T, 1 >, N > > GetColumnMatrix (Vector< T, N > arg)
 Gets the specified column of the given matrix as a column matrix.
 
constexpr ConstraintSolverConf GetDefaultPositionSolverConf () noexcept
 Gets the default position solver configuration.
 
constexpr auto GetDefaultToiConf ()
 Gets the default time of impact configuration.
 
constexpr ConstraintSolverConf GetDefaultToiPositionSolverConf () noexcept
 Gets the default TOI position solver configuration.
 
constexpr ContactFeature GetFaceFaceContactFeature (ContactFeature::Index a, ContactFeature::Index b) noexcept
 Gets the face face contact feature for the given indices.
 
constexpr ContactFeature GetFaceVertexContactFeature (ContactFeature::Index a, ContactFeature::Index b) noexcept
 Gets the face vertex contact feature for the given indices.
 
template<std::size_t N>
VertexCounter GetFirstShapeVertexIdx (const detail::SeparationInfo< N > &info) noexcept
 Gets first shape vertex index.
 
constexpr auto GetFriction (const Contact &contact) noexcept
 Gets the coefficient of friction. More...
 
template<class T >
constexpr auto GetFwdPerpendicular (const Vector2< T > &vector) noexcept -> Vector2< T >
 Gets a vector clockwise (forward-clockwise) perpendicular to the given vector. More...
 
constexpr Angle GetFwdRotationalAngle (const Angle &a1, const Angle &a2) noexcept
 Gets the forward/clockwise rotational angle to go from angle 1 to angle 2. More...
 
template<typename T >
constexpr std::enable_if_t< IsSquareMatrixV< T >, T > GetIdentity ()
 Gets the identity matrix of the template type and size as given by the argument. More...
 
template<typename T , std::size_t N>
constexpr std::enable_if_t<!IsVectorV< T >, Matrix< T, N, N > > GetIdentityMatrix ()
 Gets the identity matrix of the template type and size. More...
 
template<typename T >
constexpr Interval< T > GetIntersection (Interval< T > a, const Interval< T > &b) noexcept
 Gets the intersecting interval of two given ranges.
 
constexpr auto GetInverse22 (const Mat33 &value) noexcept -> Mat33
 Gets the inverse of the given matrix as a 2-by-2. More...
 
template<typename T >
auto GetMagnitude (const T &value) noexcept(noexcept(sqrt(GetMagnitudeSquared(value)))) -> decltype(sqrt(GetMagnitudeSquared(value)))
 Gets the magnitude of the given value. More...
 
template<typename T >
constexpr auto GetMagnitudeSquared (const T &value) noexcept
 Gets the square of the magnitude of the given iterable value. More...
 
Length GetMaxRegLinearCorrection (const StepConf &conf) noexcept
 Gets the maximum regular linear correction from the given value.
 
template<typename T >
constexpr auto GetModuloNext (T value, const T count) noexcept -> decltype(++value,(value< count)? value:static_cast< T >(0), T())
 Gets the modulo next value. More...
 
template<typename T >
constexpr auto GetModuloPrev (const T value, const T count) noexcept -> decltype((value ? value :count) - static_cast< T >(1), T())
 Gets the modulo previous value. More...
 
MovementConf GetMovementConf (const StepConf &conf) noexcept
 Gets the movement configuration from the given value. More...
 
const char * GetName (const TypeID &id) noexcept
 Gets the name associated with the given type ID.
 
constexpr const char * GetName (ContactFeature::Type type) noexcept
 Gets the human readable name for the given contact feature type.
 
const char * GetName (ToiOutput::State state) noexcept
 Gets a human readable name for the given output state.
 
Angle GetNormalized (Angle value) noexcept
 Gets the "normalized" value of the given angle. More...
 
constexpr std::size_t GetNumValidIndices (IndexPair3 pairs) noexcept
 Gets the number of valid indices in the given collection of index pairs. More...
 
constexpr auto GetOtherBody (const Contact &c, BodyID bodyID) noexcept
 Gets the other body ID for the contact than the one given.
 
SecondMomentOfArea GetPolarMoment (const Span< const Length2 > &vertices)
 Gets the polar moment of the area enclosed by the given vertices. More...
 
ConstraintSolverConf GetRegConstraintSolverConf (const StepConf &conf) noexcept
 Gets the regular phase constraint solver configuration for the given step configuration.
 
constexpr auto GetRestitution (const Contact &contact) noexcept
 Gets the coefficient of restitution. More...
 
template<class T >
constexpr auto GetRevPerpendicular (const Vector2< T > &vector) noexcept -> Vector2< T >
 Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector. More...
 
constexpr Angle GetRevRotationalAngle (const Angle &a1, const Angle &a2) noexcept
 Gets the reverse (counter) clockwise rotational angle to go from angle 1 to angle 2. More...
 
template<typename T , std::size_t N>
constexpr std::enable_if_t<!IsVectorV< T >, Vector< Vector< T, N >, 1 > > GetRowMatrix (Vector< T, N > arg)
 Gets the specified row of the given matrix as a row matrix.
 
template<VertexCounter M, std::size_t N>
VertexCounter GetSecondShapeVertexIdx (const detail::SeparationInfo< N > &info) noexcept
 Gets second shape vertex indices.
 
constexpr ShapeID GetShapeA (const Contact &contact) noexcept
 Gets the shape A associated with the given contact.
 
constexpr ShapeID GetShapeB (const Contact &contact) noexcept
 Gets the shape B associated with the given contact.
 
Angle GetShortestDelta (Angle a0, Angle a1) noexcept
 Gets the shortest angular distance to go from angle 0 to angle 1. More...
 
template<typename T , typename U = decltype(Interval<T>{}, (T{} - T{}))>
constexpr auto GetSize (const Interval< T > &v) noexcept(noexcept(v.GetMax() - v.GetMin()))
 Gets the size of the given interval. More...
 
constexpr auto GetSymInverse33 (const Mat33 &value) noexcept -> Mat33
 Gets the symmetric inverse of this matrix as a 3-by-3. More...
 
constexpr auto GetTangentSpeed (const Contact &contact) noexcept
 Gets the desired tangent speed. More...
 
constexpr auto GetToi (const Contact &contact) noexcept
 Gets the time of impact (TOI) as a fraction. More...
 
ToiConf GetToiConf (const StepConf &conf) noexcept
 Gets the time of impact configuration for the given step configuration.
 
ConstraintSolverConf GetToiConstraintSolverConf (const StepConf &conf) noexcept
 Gets the TOI phase constraint solver configuration for the given step configuration.
 
constexpr auto GetToiCount (const Contact &contact) noexcept
 Gets the time of impact count. More...
 
template<typename T >
TypeID GetTypeID () noexcept
 Gets the type ID for the function's template parameter type with its name demangled.
 
template<typename T >
TypeID GetTypeID (const T &) noexcept
 Gets the type ID for the function parameter type with its name demangled.
 
template<typename T >
constexpr const char * GetTypeName () noexcept
 Gets the name associated with the given template parameter type.
 
constexpr auto GetVec2 (const Vector2< Real > &value) -> Vec2
 Gets the given value as a 2-element vector of reals (Vec2).
 
template<class T >
constexpr auto GetVec2 (const Vector2< T > &value) -> decltype(Vec2{static_cast< Real >(get< 0 >(value).value()), static_cast< Real >(get< 1 >(value).value())})
 Gets value as 2-element vector of reals for any type having value() member function.
 
Version GetVersion () noexcept
 Gets the version information of the library.
 
constexpr ContactFeature GetVertexFaceContactFeature (ContactFeature::Index a, ContactFeature::Index b) noexcept
 Gets the vertex face contact feature for the given indices.
 
constexpr ContactFeature GetVertexVertexContactFeature (ContactFeature::Index a, ContactFeature::Index b) noexcept
 Gets the vertex vertex contact feature for the given indices.
 
template<typename T , std::size_t N>
constexpr auto GetX (const Vector< T, N > &value) -> decltype(get< 0 >(value))
 Gets the "X" element of the given value - i.e. the first element.
 
template<typename T , std::size_t N>
constexpr auto GetX (Vector< T, N > &value) -> decltype(get< 0 >(value))
 Gets the "X" element of the given value - i.e. the first element.
 
template<typename T , std::size_t N>
constexpr auto GetY (const Vector< T, N > &value) -> decltype(get< 1 >(value))
 Gets the "Y" element of the given value - i.e. the second element.
 
template<typename T , std::size_t N>
constexpr auto GetY (Vector< T, N > &value) -> decltype(get< 1 >(value))
 Gets the "Y" element of the given value - i.e. the second element.
 
template<typename T , std::size_t N>
constexpr auto GetZ (const Vector< T, N > &value) -> decltype(get< 2 >(value))
 Gets the "Z" element of the given value - i.e. the third element.
 
template<typename T , std::size_t N>
constexpr auto GetZ (Vector< T, N > &value) -> decltype(get< 2 >(value))
 Gets the "Z" element of the given value - i.e. the third element.
 
constexpr auto HasValidToi (const Contact &contact) noexcept
 Gets whether a TOI is set. More...
 
constexpr Vec2 InverseTransform (const Vec2 &v, const Mat22 &A) noexcept
 
template<class IN_TYPE >
constexpr auto Invert (const Matrix22< IN_TYPE > &value) noexcept
 Inverts the given value.
 
bool IsAccelerable (BodyType type)
 Is "accelerable". More...
 
constexpr auto IsDestroyed (const Contact &c) noexcept -> bool
 Whether or not the given contact was destroyed. More...
 
constexpr bool IsEnabled (const Contact &contact) noexcept
 Gets whether the given contact is enabled or not.
 
template<typename T >
constexpr bool IsEntirelyAfter (const Interval< T > &a, const Interval< T > &b)
 Determines whether the first range is entirely after the second range.
 
template<typename T >
constexpr bool IsEntirelyBefore (const Interval< T > &a, const Interval< T > &b)
 Determines whether the first range is entirely before the second range.
 
template<typename T >
constexpr bool IsEntirelyEnclosing (const Interval< T > &a, const Interval< T > &b)
 Determines whether the first range entirely encloses the second.
 
constexpr bool IsFor (const Contact &c, BodyID bodyID, ShapeID shapeID) noexcept
 Is-for convenience function. More...
 
constexpr bool IsFor (const Contact &c, ShapeID shapeID) noexcept
 Is-for convenience function. More...
 
constexpr bool IsFor (const Contactable &c, BodyID bodyID, ShapeID shapeID) noexcept
 Is-for convenience function. More...
 
bool IsFullOfBodies (const Island &island)
 Determines whether the given island is full of bodies.
 
bool IsFullOfContacts (const Island &island)
 Determines whether the given island is full of contacts.
 
constexpr bool IsImpenetrable (const Contact &contact) noexcept
 Whether the given contact is "impenetrable". More...
 
template<typename T , typename U = decltype(Interval<T>{}, T{} < T{}, T{} >= T{})>
constexpr bool IsIntersecting (const Interval< T > &a, const Interval< T > &b) noexcept(noexcept(T{}< T{}) &&noexcept(T{} >=T{}))
 Checks whether two value ranges have any intersection/overlap at all. More...
 
bool IsMaxTranslationWithinTolerance (const StepConf &conf) noexcept
 Determines whether the maximum translation is within tolerance.
 
template<typename T >
constexpr auto IsOdd (const T &val) -> decltype((val % 2) !=T{})
 Is-odd. More...
 
template<typename T >
constexpr auto IsPowerOfTwo (const T &n) -> decltype(n &&!(n &(n - 1)))
 Reports whether or not the given value is a power of two.
 
constexpr bool IsSensor (const Contact &contact) noexcept
 Gets whether the given contact is for sensors or not.
 
bool IsSpeedable (BodyType type)
 Is "speedable". More...
 
constexpr bool IsTouching (const Contact &contact) noexcept
 Gets whether the given contact is touching or not.
 
constexpr auto IsValid (const BodyID &value) noexcept -> bool
 Determines validity of given value by comparing against playrho::InvalidBodyID . More...
 
constexpr auto IsValid (const ContactID &value) noexcept -> bool
 Determines validity of given value by comparing against playrho::InvalidContactID . More...
 
constexpr auto IsValid (const d2::Acceleration &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr auto IsValid (const d2::Manifold &value) noexcept -> bool
 Gets whether the given manifold is valid.
 
constexpr auto IsValid (const d2::Position &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr auto IsValid (const d2::Sweep &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr auto IsValid (const d2::Transformation &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr auto IsValid (const d2::UnitVec &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr auto IsValid (const d2::Velocity &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr auto IsValid (const JointID &value) noexcept -> bool
 Determines validity of given value by comparing against playrho::InvalidJointID . More...
 
constexpr auto IsValid (const Mat22 &value) noexcept -> bool
 Determines if the given value is valid. More...
 
constexpr auto IsValid (const ShapeID &value) noexcept -> bool
 Determines validity of given value by comparing against playrho::InvalidShapeID . More...
 
template<typename T >
constexpr auto IsValid (const T &value) noexcept -> bool
 Determines if the given value is valid, using the equality operator. More...
 
template<typename TYPE >
constexpr auto IsValid (const Vector2< TYPE > &value) noexcept -> bool
 Determines whether the given vector contains finite coordinates.
 
constexpr auto IsValid (std::size_t value) noexcept -> bool
 Determines if the given value is valid.
 
template<typename T >
constexpr auto MakeUnsigned (const T &arg) noexcept -> std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T >>
 Makes the given value into an unsigned value. More...
 
constexpr auto max_size (IndexPair3 pairs) -> decltype(pairs.max_size())
 Gets the maximum size of the given container of index pairs. More...
 
auto MixFriction (NonNegativeFF< Real > friction1, NonNegativeFF< Real > friction2)
 Mixes friction. More...
 
auto MixRestitution (Real restitution1, Real restitution2) noexcept
 Mixes restitution. More...
 
template<typename T >
auto ModuloViaFmod (T dividend, T divisor)
 Modulo operation using std::fmod. More...
 
template<typename T >
auto ModuloViaTrunc (T dividend, T divisor) noexcept
 Modulo operation using std::trunc. More...
 
constexpr Mat22 MulT (const Mat22 &A, const Mat22 &B) noexcept
 Computes A^T * B.
 
constexpr auto NeedsFiltering (const Contact &contact) noexcept
 Whether or not the contact needs filtering.
 
constexpr auto NeedsUpdating (const Contact &contact) noexcept
 Whether or not the contact needs updating.
 
template<typename T >
constexpr auto NextPowerOfTwo (T x) -> decltype((x|(x >> 1u)), T(++x))
 Gets the next largest power of 2. More...
 
Real Normalize (Vec2 &vector)
 Converts the given vector into a unit vector and returns its original length.
 
template<typename T , std::size_t LhsSize, std::size_t RhsSize>
constexpr auto operator!= (const ArrayList< T, LhsSize > &lhs, const ArrayList< T, RhsSize > &rhs) noexcept
 Inequality operator support.
 
bool operator!= (const BlockAllocator &a, const BlockAllocator &b)
 BlockAllocator inequality operator.
 
constexpr bool operator!= (const Contact &lhs, const Contact &rhs) noexcept
 Operator not-equals.
 
constexpr bool operator!= (const Contactable &lhs, const Contactable &rhs) noexcept
 Inequality operator.
 
constexpr bool operator!= (const ContactKey &lhs, const ContactKey &rhs) noexcept
 Inequality operator.
 
constexpr bool operator!= (const Filter lhs, const Filter rhs) noexcept
 Inequality operator.
 
template<typename T >
constexpr bool operator!= (const Interval< T > &a, const Interval< T > &b) noexcept
 Inequality operator. More...
 
constexpr auto operator!= (const PreStepStats &lhs, const PreStepStats &rhs) -> bool
 Operator not-equal support.
 
constexpr auto operator!= (const RegStepStats &lhs, const RegStepStats &rhs) -> bool
 Operator not-equal support.
 
template<typename T >
constexpr auto operator!= (const Span< T > &lhs, const Span< T > &rhs) noexcept
 Inequality operator support.
 
constexpr auto operator!= (const ToiStepStats &lhs, const ToiStepStats &rhs) -> bool
 Operator not-equal support.
 
template<typename T , std::size_t N>
constexpr bool operator!= (const Vector< T, N > &lhs, const Vector< T, N > &rhs) noexcept
 Inequality operator.
 
constexpr auto operator!= (const Version &lhs, const Version &rhs) noexcept
 Inequality operator.
 
constexpr bool operator!= (ContactFeature lhs, ContactFeature rhs) noexcept
 Determines if the given two contact features are not equal.
 
constexpr Length operator""_cm (long double v) noexcept
 SI unit symbol for a centimeter of Length. More...
 
constexpr Length operator""_cm (unsigned long long int v) noexcept
 SI unit symbol for a centimeter of Length. More...
 
constexpr Time operator""_d (long double v) noexcept
 Symbol for a day unit of Time. More...
 
constexpr Time operator""_d (unsigned long long int v) noexcept
 Symbol for a day unit of Time. More...
 
constexpr Angle operator""_deg (long double v) noexcept
 Abbreviation for a degree unit of Angle. More...
 
constexpr Angle operator""_deg (unsigned long long int v) noexcept
 Abbreviation for a degree unit of Angle. More...
 
constexpr Length operator""_dm (long double v) noexcept
 SI unit symbol for a decimeter of Length. More...
 
constexpr Length operator""_dm (unsigned long long int v) noexcept
 SI unit symbol for a decimeter of Length. More...
 
constexpr Mass operator""_g (long double v) noexcept
 SI unit symbol for a gram unit of Mass. More...
 
constexpr Mass operator""_g (unsigned long long int v) noexcept
 SI unit symbol for a gram unit of Mass. More...
 
constexpr Length operator""_Gm (long double v) noexcept
 SI unit symbol for a gigameter unit of Length. More...
 
constexpr Length operator""_Gm (unsigned long long int v) noexcept
 SI unit symbol for a gigameter unit of Length. More...
 
constexpr Time operator""_h (long double v) noexcept
 Symbol for an hour unit of Time. More...
 
constexpr Time operator""_h (unsigned long long int v) noexcept
 Symbol for an hour unit of Time. More...
 
constexpr Frequency operator""_Hz (long double v) noexcept
 SI symbol for a hertz unit of Frequency. More...
 
constexpr Frequency operator""_Hz (unsigned long long int v) noexcept
 SI symbol for a hertz unit of Frequency. More...
 
constexpr Mass operator""_kg (long double v) noexcept
 SI unit symbol for a kilogram unit of Mass. More...
 
constexpr Mass operator""_kg (unsigned long long int v) noexcept
 SI unit symbol for a kilogram unit of Mass. More...
 
constexpr AreaDensity operator""_kgpm2 (long double v) noexcept
 Abbreviation for kilogram per square meter.
 
constexpr AreaDensity operator""_kgpm2 (unsigned long long int v) noexcept
 Abbreviation for kilogram per square meter.
 
constexpr Length operator""_km (long double v) noexcept
 SI symbol for a kilometer unit of Length. More...
 
constexpr Length operator""_km (unsigned long long int v) noexcept
 SI symbol for a kilometer unit of Length. More...
 
constexpr LinearVelocity operator""_kps (long double v) noexcept
 Abbreviation for kilometer per second. More...
 
constexpr LinearVelocity operator""_kps (unsigned long long int v) noexcept
 Abbreviation for kilometer per second. More...
 
constexpr Length operator""_m (long double v) noexcept
 SI unit symbol for a meter of Length. More...
 
constexpr Length operator""_m (unsigned long long int v) noexcept
 SI unit symbol for a meter of Length. More...
 
constexpr Area operator""_m2 (long double v) noexcept
 Abbreviation for meter squared unit of Area. More...
 
constexpr Area operator""_m2 (unsigned long long int v) noexcept
 Abbreviation for meter squared unit of Area. More...
 
constexpr Time operator""_min (long double v) noexcept
 SI symbol for a minute unit of Time. More...
 
constexpr Time operator""_min (unsigned long long int v) noexcept
 SI symbol for a minute unit of Time. More...
 
constexpr Length operator""_Mm (long double v) noexcept
 SI unit symbol for a megameter unit of Length. More...
 
constexpr Length operator""_Mm (unsigned long long int v) noexcept
 SI unit symbol for a megameter unit of Length. More...
 
constexpr LinearVelocity operator""_mps (long double v) noexcept
 Abbreviation for meter per second. More...
 
constexpr LinearVelocity operator""_mps (unsigned long long int v) noexcept
 Abbreviation for meter per second. More...
 
constexpr LinearAcceleration operator""_mps2 (long double v) noexcept
 Abbreviation for meter per second squared. More...
 
constexpr LinearAcceleration operator""_mps2 (unsigned long long int v) noexcept
 Abbreviation for meter per second squared. More...
 
constexpr Force operator""_N (long double v) noexcept
 SI symbol for a newton unit of Force. More...
 
constexpr Force operator""_N (unsigned long long int v) noexcept
 SI symbol for a newton unit of Force. More...
 
constexpr Torque operator""_Nm (long double v) noexcept
 Abbreviation for newton-meter unit of torque. More...
 
constexpr Torque operator""_Nm (unsigned long long int v) noexcept
 Abbreviation for newton-meter unit of torque. More...
 
constexpr Momentum operator""_Ns (long double v) noexcept
 SI symbol for a newton second of impulse. More...
 
constexpr Momentum operator""_Ns (unsigned long long int v) noexcept
 SI symbol for a newton second of impulse. More...
 
constexpr Mass operator""_Pg (long double v) noexcept
 SI unit symbol for a petagram unit of Mass. More...
 
constexpr Mass operator""_Pg (unsigned long long int v) noexcept
 SI unit symbol for a petagram unit of Mass. More...
 
constexpr Angle operator""_rad (long double v) noexcept
 SI symbol for a radian unit of Angle. More...
 
constexpr Angle operator""_rad (unsigned long long int v) noexcept
 SI symbol for a radian unit of Angle. More...
 
constexpr AngularVelocity operator""_rpm (long double v) noexcept
 Abbreviation for revolutions per minute. More...
 
constexpr AngularVelocity operator""_rpm (unsigned long long int v) noexcept
 Abbreviation for revolutions per minute. More...
 
constexpr Time operator""_s (long double v) noexcept
 SI symbol for a second unit of Time. More...
 
constexpr Time operator""_s (unsigned long long int v) noexcept
 SI symbol for a second unit of Time. More...
 
constexpr Mass operator""_Yg (long double v) noexcept
 SI unit symbol for a yottagram unit of Mass. More...
 
constexpr Mass operator""_Yg (unsigned long long int v) noexcept
 SI unit symbol for a yottagram unit of Mass. More...
 
template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 > &&!IsVectorV< T1 >, Vector< OT, N > > operator* (const T1 &s, const Vector< T2, N > &a) noexcept
 Multiplication operator for non-vector times vector. More...
 
template<typename T1 , typename T2 , std::size_t A, std::size_t B, typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 > &&!IsVectorV< T1 >, Vector< OT, B > > operator* (const Vector< T1, A > &lhs, const Vector< Vector< T2, B >, A > &rhs) noexcept
 Multiplies an A-element vector by a A-by-B vector of vectors. More...
 
template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 > &&!IsVectorV< T2 >, Vector< OT, N > > operator* (const Vector< T1, N > &a, const T2 &s) noexcept
 Multiplication operator for vector times non-vector. More...
 
template<typename T1 , typename T2 , std::size_t A, std::size_t B, typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 > &&!IsVectorV< T2 >, Vector< OT, B > > operator* (const Vector< Vector< T1, A >, B > &lhs, const Vector< T2, A > &rhs) noexcept
 Multiplies a B-by-A vector of vectors by an A-element vector. More...
 
template<typename T1 , typename T2 , std::size_t A, std::size_t B, std::size_t C, typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 >, Vector< Vector< OT, C >, A > > operator* (const Vector< Vector< T1, B >, A > &lhs, const Vector< Vector< T2, C >, B > &rhs) noexcept
 Calculates the matrix product of the two given vector of vectors (matrices). More...
 
template<typename T1 , typename T2 , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T1, decltype(T1{} *T2{})>, Vector< T1, N > & > operator*= (Vector< T1, N > &lhs, const T2 rhs) noexcept
 Multiplication assignment operator.
 
template<typename T , std::size_t M, std::size_t N>
constexpr auto operator+ (const Matrix< T, M, N > &lhs, const Matrix< T, M, N > &rhs) noexcept
 Matrix addition operator for two same-type, same-sized matrices. More...
 
template<typename T , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T, decltype(T{}+T{})>, Vector< T, N > > operator+ (Vector< T, N > lhs, const Vector< T, N > rhs) noexcept
 Adds two vectors component-wise.
 
template<typename T , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T, decltype(+T{})>, Vector< T, N > > operator+ (Vector< T, N > v) noexcept
 Unary plus operator.
 
template<typename T , std::size_t S>
constexpr ArrayList< T, S > & operator+= (ArrayList< T, S > &lhs, T rhs)
 Appends the given value onto back. More...
 
template<typename T , std::size_t S, class U >
constexpr auto operator+= (ArrayList< T, S > &lhs, U &&rhs) -> decltype(rhs.begin(), rhs.end(), rhs.size(), lhs)
 Appends the given values onto back. More...
 
template<typename T , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T, decltype(T{}+T{})>, Vector< T, N > & > operator+= (Vector< T, N > &lhs, const Vector< T, N > rhs) noexcept
 Increments the left hand side value by the right hand side value.
 
template<typename T , std::size_t M, std::size_t N>
constexpr auto operator- (const Matrix< T, M, N > &lhs, const Matrix< T, M, N > &rhs) noexcept
 Matrix subtraction operator for two same-type, same-sized matrices. More...
 
template<typename T , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T, decltype(T{} - T{})>, Vector< T, N > > operator- (Vector< T, N > lhs, const Vector< T, N > rhs) noexcept
 Subtracts two vectors component-wise.
 
template<typename T , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T, decltype(-T{})>, Vector< T, N > > operator- (Vector< T, N > v) noexcept
 Unary negation operator.
 
template<typename T , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T, decltype(T{} - T{})>, Vector< T, N > & > operator-= (Vector< T, N > &lhs, const Vector< T, N > rhs) noexcept
 Decrements the left hand side value by the right hand side value.
 
template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} / T2{})>
constexpr std::enable_if_t< IsDivisableV< T1, T2 > &&!IsVectorV< T2 >, Vector< OT, N > > operator/ (const Vector< T1, N > &a, const T2 &s) noexcept
 Division operator.
 
template<typename T1 , typename T2 , std::size_t N>
constexpr std::enable_if_t< std::is_same_v< T1, decltype(T1{}/T2{})>, Vector< T1, N > & > operator/= (Vector< T1, N > &lhs, const T2 rhs) noexcept
 Division assignment operator.
 
constexpr bool operator< (const Contactable &lhs, const Contactable &rhs) noexcept
 Less-than operator.
 
constexpr bool operator< (const ContactKey &lhs, const ContactKey &rhs) noexcept
 Less-than operator.
 
template<typename T >
constexpr bool operator< (const Interval< T > &lhs, const Interval< T > &rhs) noexcept
 Less-than operator. More...
 
template<std::size_t N0, class T0 , std::size_t N1, class T1 >
constexpr bool operator< (const Vector< T0, N0 > &lhs, const Vector< T1, N1 > &rhs) noexcept
 Less than operator. More...
 
constexpr auto operator< (const Version &lhs, const Version &rhs) noexcept
 Less-than operator.
 
inline ::std::ostream & operator<< (::std::ostream &os, const ContactFeature &value)
 Stream output operator.
 
template<typename T >
::std::ostream & operator<< (::std::ostream &os, const Interval< T > &value)
 Output stream operator.
 
template<typename T , std::size_t N>
::std::ostream & operator<< (::std::ostream &os, const Vector< T, N > &value)
 Output stream operator.
 
auto operator<< (std::ostream &os, const Contactable &c) -> std::ostream &
 Output stream operator support.
 
constexpr bool operator<= (const ContactKey &lhs, const ContactKey &rhs) noexcept
 Less-than or equal-to operator.
 
template<typename T >
constexpr bool operator<= (const Interval< T > &lhs, const Interval< T > &rhs) noexcept
 Less-than or equal-to operator. More...
 
constexpr auto operator<= (const Version &lhs, const Version &rhs) noexcept
 Less-than or equal-to operator.
 
template<typename T , std::size_t LhsSize, std::size_t RhsSize>
constexpr auto operator== (const ArrayList< T, LhsSize > &lhs, const ArrayList< T, RhsSize > &rhs) noexcept
 Equality operator support.
 
bool operator== (const BlockAllocator &a, const BlockAllocator &b)
 BlockAllocator equality operator.
 
constexpr bool operator== (const Contact &lhs, const Contact &rhs) noexcept
 Operator equals.
 
constexpr bool operator== (const Contactable &lhs, const Contactable &rhs) noexcept
 Equality operator.
 
constexpr bool operator== (const ContactKey &lhs, const ContactKey &rhs) noexcept
 Equality operator.
 
constexpr bool operator== (const Filter lhs, const Filter rhs) noexcept
 Equality operator.
 
template<typename T >
constexpr bool operator== (const Interval< T > &a, const Interval< T > &b) noexcept
 Equality operator. More...
 
constexpr auto operator== (const PreStepStats &lhs, const PreStepStats &rhs) -> bool
 Operator equal support.
 
constexpr auto operator== (const RegStepStats &lhs, const RegStepStats &rhs) -> bool
 Operator equal support.
 
template<typename T >
constexpr auto operator== (const Span< T > &lhs, const Span< T > &rhs) noexcept
 Equality operator support.
 
constexpr auto operator== (const ToiStepStats &lhs, const ToiStepStats &rhs) -> bool
 Operator equal support.
 
template<typename T , std::size_t N>
constexpr bool operator== (const Vector< T, N > &lhs, const Vector< T, N > &rhs) noexcept
 Equality operator.
 
constexpr auto operator== (const Version &lhs, const Version &rhs) noexcept
 Equality operator.
 
constexpr bool operator== (ContactFeature lhs, ContactFeature rhs) noexcept
 Determines if the given two contact features are equal.
 
constexpr bool operator> (const ContactKey &lhs, const ContactKey &rhs) noexcept
 Greater-than operator.
 
template<typename T >
constexpr bool operator> (const Interval< T > &lhs, const Interval< T > &rhs) noexcept
 Greater-than operator. More...
 
constexpr auto operator> (const Version &lhs, const Version &rhs) noexcept
 Greater-than operator.
 
constexpr bool operator>= (const ContactKey &lhs, const ContactKey &rhs) noexcept
 Greater-than or equal-to operator.
 
template<typename T >
constexpr bool operator>= (const Interval< T > &lhs, const Interval< T > &rhs) noexcept
 Greater-than or equal-to operator. More...
 
constexpr auto operator>= (const Version &lhs, const Version &rhs) noexcept
 Greater-than or equal-to operator.
 
void * Realloc (void *ptr, std::size_t size)
 Reallocates memory. More...
 
template<typename T >
T * ReallocArray (T *ptr, std::size_t count)
 Reallocates memory for an array. More...
 
void Reserve (Island &island, BodyCounter bodies, ContactCounter contacts, JointCounter joints)
 Reserves space ahead of time.
 
template<typename T >
std::enable_if_t< IsReverseIterableV< T >, ReversionWrapper< T > > Reverse (T &&iterable)
 Gets a reversed order iterated wrapper. More...
 
template<typename T >
auto RoundOff (const T &value, unsigned precision=DefaultRoundOffPrecission) -> decltype(round(value *static_cast< T >(precision))/static_cast< T >(precision))
 Computes the rounded value of the given value.
 
auto RoundOff (const Vec2 &value, std::uint32_t precision=DefaultRoundOffPrecission) -> Vec2
 Computes the rounded value of the given value. More...
 
template<typename T , typename U >
constexpr auto Secant (const T &target, const U &a1, const T &s1, const U &a2, const T &s2) -> decltype(a1+(target - s1) *(a2 - a1)/(s2 - s1))
 Secant method. More...
 
constexpr void SetDestroyed (Contact &c) noexcept
 Sets the destroyed property of the given contact. More...
 
constexpr void SetEnabled (Contact &contact) noexcept
 Enables the contact. More...
 
constexpr void SetFriction (Contact &contact, NonNegative< Real > value) noexcept
 Sets the friction value for the identified contact. More...
 
constexpr void SetImpenetrable (Contact &contact) noexcept
 Sets the impenetrability of the given contact. More...
 
constexpr void SetRestitution (Contact &contact, Real value)
 Sets the restitution value for the identified contact. More...
 
constexpr void SetSensor (Contact &contact) noexcept
 Sets the sensor state of the given contact. More...
 
constexpr void SetTangentSpeed (Contact &contact, LinearVelocity value) noexcept
 Sets the desired tangent speed for a conveyor belt behavior. More...
 
constexpr void SetToi (Contact &contact, const std::optional< UnitIntervalFF< Real >> &toi) noexcept
 Sets the time of impact (TOI). More...
 
constexpr void SetToiCount (Contact &contact, Contact::substep_type value) noexcept
 Sets the TOI count to the given value. More...
 
bool ShouldCollide (const Filter filterA, const Filter filterB) noexcept
 Determines whether collision processing should be performed.
 
constexpr auto size (IndexPair3 pairs) -> decltype(GetNumValidIndices(pairs))
 Gets the dynamic size of the given collection of index pairs. More...
 
template<typename T , typename U >
constexpr auto Solve (const Matrix22< U > &mat, const Vector2< T > &b) noexcept
 Solves A * x = b, where b is a column vector. More...
 
template<typename T >
constexpr auto Solve22 (const Mat33 &mat, const Vector2< T > &b) noexcept -> Vector2< T >
 Solves A * x = b, where b is a column vector. More...
 
template<typename T >
constexpr auto Solve33 (const Mat33 &mat, const Vector3< T > &b) noexcept -> Vector3< T >
 Solves A * x = b, where b is a column vector. More...
 
void Sort (Island &island) noexcept
 Sorts the island containers.
 
template<class T >
constexpr auto Square (T t) noexcept(noexcept(t *t)) -> decltype(t *t)
 Squares the given value.
 
template<class T >
constexpr auto StripUnit (const T &value) -> std::enable_if_t< IsArithmeticV< T > &&!detail::is_detected_v< detail::get_member_type, T >, T >
 Strips the units off of the given value. More...
 
template<typename T >
constexpr auto to_underlying (T value) noexcept -> underlying_type_t< T >
 
template<class T >
constexpr auto ToSigned (const T &value) -> decltype(static_cast< std::make_signed_t< T >>(value))
 Converts the given value to its closest signed equivalent.
 
const char * ToString (LimitState val) noexcept
 Provides a human readable C-style string uniquely identifying the given limit state.
 
constexpr Vec2 Transform (const Vec2 &v, const Mat33 &A) noexcept
 Multiplies a vector by a matrix.
 
template<std::size_t M, typename T1 , std::size_t N, typename T2 >
constexpr auto Transform (const Vector< T1, M > &v, const Matrix< T2, M, N > &m) noexcept
 Multiplies an M-element vector by an M-by-N matrix. More...
 
constexpr void UnflagForFiltering (Contact &contact) noexcept
 Unflags this contact for filtering. More...
 
constexpr void UnflagForUpdating (Contact &contact) noexcept
 Unflags this contact for updating. More...
 
constexpr void UnsetDestroyed (Contact &c) noexcept
 Unsets the destroyed property of the given contact. More...
 
constexpr void UnsetEnabled (Contact &contact) noexcept
 Disables the identified contact. More...
 
constexpr void UnsetImpenetrable (Contact &contact) noexcept
 Unsets the impenetrability of the given contact. More...
 
constexpr void UnsetSensor (Contact &contact) noexcept
 Unsets the sensor state of the given contact. More...
 
RegStepStatsUpdate (RegStepStats &lhs, const IslandStats &rhs) noexcept
 Updates regular-phase per-step statistics with island statistics.
 
template<typename T >
ObjectPool< T >::size_type used (const ObjectPool< T > &array) noexcept
 Gets the number of elements that are used in the specified structure. More...
 

Variables

constexpr auto BigG = static_cast<Real>(6.67408e-11f) * CubicMeter / (Kilogram * SquareSecond)
 Big "G". More...
 
constexpr auto Centi = Real(1e-2)
 Centi- (1 x 10^-2). More...
 
constexpr auto CubicMeter = Meter * Meter * Meter
 Cubic meter unit of volume.
 
constexpr auto Deci = Real(1e-1)
 Deci- (1 x 10^-1). More...
 
constexpr auto DefaultAabbExtension = DefaultLinearSlop * Real(20)
 Default AABB extension amount.
 
constexpr auto DefaultAngularSleepTolerance = Real((Pi * 2) / 180) * RadianPerSecond
 Default angular sleep tolerance. More...
 
constexpr auto DefaultAngularSlop = (Pi * 2_rad) / Real(180)
 Default angular slop. More...
 
constexpr auto DefaultCirclesRatio = Real(10)
 Default circles ratio. More...
 
constexpr auto DefaultDistanceMultiplier = Real(2)
 Default distance multiplier.
 
constexpr auto DefaultLinearSleepTolerance = 0.01_mps
 Default linear sleep tolerance. More...
 
constexpr auto DefaultLinearSlop = 0.005_m
 Default linear slop. More...
 
constexpr auto DefaultMaxAngularCorrection = Real(8.0f / 180.0f) * Pi * 1_rad
 Default maximum angular correction. More...
 
constexpr auto DefaultMaxDistanceIters = std::uint8_t{20}
 Default max number of distance iterations.
 
constexpr auto DefaultMaxLinearCorrection = 0.2_m
 Default maximum linear correction. More...
 
constexpr auto DefaultMaxRotation = Angle{179_deg}
 Default maximum rotation per world step. More...
 
constexpr auto DefaultMaxSubSteps = std::uint8_t{8}
 Default maximum number of sub steps. More...
 
constexpr auto DefaultMaxToiIters = std::uint8_t{20}
 Default maximum time of impact iterations.
 
constexpr auto DefaultMaxToiRootIters = std::uint8_t{30}
 Default maximum time of impact root iterator count.
 
constexpr auto DefaultMaxTranslation = 2_m
 Default maximum translation amount. More...
 
constexpr auto DefaultMaxVertexRadius = 255_m
 Default maximum vertex radius. More...
 
constexpr auto DefaultMinStillTimeToSleep = Time{1_s / 2}
 Default minimum still time to sleep. More...
 
constexpr auto DefaultMinVertexRadius = 0.01_m
 Default minimum vertex radius. More...
 
constexpr auto DefaultRegMinMomentum = Momentum{0_Ns / 100}
 Default regular-phase minimum momentum. More...
 
constexpr auto DefaultRoundOffPrecission = unsigned{100000}
 Default round-off precision.
 
constexpr auto DefaultStepFrequency = 60_Hz
 Default step frequency. More...
 
constexpr auto DefaultStepTime = Time{1_s / 60}
 Default step time. More...
 
constexpr auto DefaultToiMinMomentum = Momentum{0_Ns / 100}
 Default TOI-phase minimum momentum. More...
 
constexpr auto DefaultVelocityThreshold = 1_mps
 Default velocity threshold.
 
constexpr auto Degree = Angle{Radian * Pi / Real{180}}
 Degree unit of angle quantity. More...
 
constexpr auto DegreePerSecond = AngularVelocity{RadianPerSecond * Degree / Radian}
 Degree per second unit of angular velocity. More...
 
constexpr auto DegreePerSquareSecond = Degree / (Second * Second)
 Degree per square second unit of angular acceleration. More...
 
constexpr auto EarthlyLinearAcceleration = static_cast<Real>(-9.8f) * MeterPerSquareSecond
 Earthly gravity. More...
 
constexpr auto Giga = Real(1e9)
 Giga- (1 x 10^9). More...
 
constexpr auto Hertz = Frequency(detail::hertz)
 Hertz unit of Frequency. More...
 
template<class T , std::enable_if_t< std::numeric_limits< T >::has_signaling_NaN||std::numeric_limits< T >::has_quiet_NaN, int > = 0>
constexpr auto Invalid
 Invalid value of the template's instantiated numeric type. More...
 
constexpr auto InvalidBodyID = BodyID{static_cast<BodyID::underlying_type>(-1)}
 Invalid body ID value. More...
 
constexpr auto InvalidContactID = ContactID{static_cast<ContactID::underlying_type>(-1)}
 Invalid contact ID value. More...
 
constexpr auto InvalidIndexPair
 Invalid index-pair value. More...
 
constexpr auto InvalidJointID = JointID{static_cast<JointID::underlying_type>(-1)}
 Invalid joint ID value. More...
 
constexpr auto InvalidLength2 = Length2{Invalid<Length>, Invalid<Length>}
 Invalid Length2 constant.
 
constexpr auto InvalidShapeID = ShapeID{static_cast<ShapeID::underlying_type>(-1)}
 Invalid shape ID value. More...
 
constexpr auto InvalidVertex = static_cast<VertexCounter>(-1)
 Invalid vertex index. More...
 
template<class T1 , class T2 = T1>
constexpr bool IsAddableV = detail::IsAddable<T1, T2>::value
 Determines whether the given type is an addable type.
 
template<class T >
constexpr bool IsArithmeticV = detail::IsArithmetic<T>::value
 Determines whether the given type is an arithmetic type.
 
template<class T1 , class T2 = T1>
constexpr bool IsDivisableV = detail::IsDivisable<T1, T2>::value
 Determines whether the given type is a divisible type.
 
template<class T1 , class T2 = T1>
constexpr bool IsEqualityComparableV = detail::IsEqualityComparable<T1, T2>::value
 Determines whether the given types are equality comparable.
 
template<class T1 , class T2 = T1>
constexpr bool IsInequalityComparableV = detail::IsInequalityComparable<T1, T2>::value
 Determines whether the given types are inequality comparable.
 
template<class T >
constexpr bool IsIterableV = detail::IsIterable<T>::value
 Determines whether the given type is an iterable type.
 
template<class T >
constexpr bool IsMatrixV = detail::IsMatrix<T>::value
 Determines whether the given type is a Matrix type.
 
template<class T1 , class T2 = T1>
constexpr bool IsMultipliableV = detail::IsMultipliable<T1, T2>::value
 Determines whether the given type is a multipliable type.
 
template<class T >
constexpr bool IsReverseIterableV = detail::IsReverseIterable<T>::value
 Determines whether the given type is a reverse iterable type.
 
template<class T >
constexpr bool IsSquareMatrixV = detail::IsSquareMatrix<T>::value
 Determines whether the given type is a square Matrix type.
 
template<class T >
constexpr bool IsVectorV = detail::IsVector<T>::value
 Determines whether the given type is a Vector type.
 
constexpr auto Kilo = Real(1e3)
 Kilo- (1 x 10^3). More...
 
constexpr auto Kilogram = Mass(detail::kilogram)
 Kilogram unit of mass. More...
 
constexpr auto KilogramPerSquareMeter = AreaDensity(detail::kilogram_per_square_meter)
 Kilogram per square meter unit of area density. More...
 
constexpr auto MaxBodies
 Maximum number of bodies in a world. More...
 
constexpr auto MaxChildCount = std::numeric_limits<std::uint32_t>::max() >> 6
 Max child count.
 
constexpr auto MaxContacts = ContactCounter{MaxBodies} * ContactCounter{MaxBodies - 1} / ContactCounter{2}
 Maximum number of contacts in a world (2147319811). More...
 
constexpr auto MaxFloat = std::numeric_limits<Real>::max()
 Maximum float value.
 
constexpr auto MaxJoints
 Maximum number of joints in a world. More...
 
constexpr auto MaxManifoldPoints = std::uint8_t{2}
 Maximum manifold points. More...
 
constexpr auto MaxShapes
 Maximum number of shapes in a world. More...
 
constexpr auto MaxShapeVertices = std::uint8_t{254}
 Maximum number of vertices for any shape type. More...
 
constexpr auto MaxSimplexEdges = std::uint8_t{3}
 Maximum number of supportable edges in a simplex.
 
constexpr auto Mega = Real(1e6)
 Mega- (1 x 10^6). More...
 
constexpr auto Meter = Length(detail::meter)
 Meter unit of Length. More...
 
constexpr auto MeterPerSecond = LinearVelocity(detail::meter_per_second)
 Meter per second unit of linear velocity. More...
 
constexpr auto MeterPerSquareSecond = LinearAcceleration(detail::meter_per_second_squared)
 Meter per square second unit of linear acceleration. More...
 
constexpr auto Newton = Force(detail::newton)
 Newton unit of force. More...
 
constexpr auto NewtonMeter = Torque(detail::newton_meter)
 Newton meter unit of torque. More...
 
constexpr auto NewtonMeterSecond = NewtonMeter * Second
 Newton meter second unit of angular momentum. More...
 
constexpr auto NewtonSecond = Newton * Second
 Newton second unit of momentum. More...
 
constexpr auto Peta = Real(1e15)
 Peta- (1 x 10^15). More...
 
constexpr auto Pi = Real(3.14159265358979323846264338327950288L)
 Pi. More...
 
constexpr auto Radian = Angle(detail::radian)
 Radian unit of angle. More...
 
constexpr auto RadianPerSecond = AngularVelocity(detail::radian_per_second)
 Radian per second unit of angular velocity. More...
 
constexpr auto RadianPerSquareSecond = Radian / (Second * Second)
 Radian per square second unit of angular acceleration. More...
 
constexpr auto RevolutionsPerMinute = 2 * Pi * Radian / (Real{detail::SecondsPerMinute} * Second)
 Revolutions per minute units of angular velocity. More...
 
constexpr auto Second = Time(detail::second)
 Second unit of time. More...
 
constexpr auto SquareMeter = Area(detail::square_meter)
 Square meter unit of area. More...
 
constexpr auto SquareRadian = Radian * Radian
 Square radian unit type. More...
 
constexpr auto SquareRootTwo
 Square root of two. More...
 
constexpr auto SquareSecond = Second * Second
 Square second unit. More...
 
constexpr auto Tera = Real(1e12)
 Tera- (1 x 10^12). More...
 
constexpr auto Yotta = Real(1e24)
 Yotta- (1 x 10^24). More...
 

Detailed Description

Name space for all PlayRho related names.

Typedef Documentation

◆ BodyCounter

using playrho::BodyCounter = typedef std::remove_const_t<decltype(MaxBodies)>

Count type for bodies.

Note
This type must always be able to contain the playrho::MaxBodies value.
See also
MaxBodies, ContactCounter, JointCounter, ShapeCounter.
Examples
World.cpp, and WorldBody.cpp.

◆ BodyID

using playrho::BodyID = typedef detail::IndexingNamedType<BodyCounter, struct BodyIdentifier>

Body identifier.

A strongly typed identifier for uniquely identifying bodes within playrho::d2::World instances. This is based on the playrho::BodyCounter type as its underlying type. These identifiers can be compared with other body identifiers. Two body identifiers from the same world that compare equal for example, identify the same body within that world.

See also
InvalidBodyID, BodyCounter, ContactID, JointID, ShapeID, d2::Body, d2::World.
Examples
DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, Joint.cpp, MotorJoint.cpp, PrismaticJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, World.cpp, and WorldShape.cpp.

◆ ChildCounter

using playrho::ChildCounter = typedef std::remove_const_t<decltype(MaxChildCount)>

Child counter type.

Relating to "children" of shape where each child is a convex shape possibly comprising a concave shape.

Note
This type must always be able to contain the MaxChildCount value.
Examples
Compositor.cpp, Shape.cpp, World.cpp, WorldContact.cpp, and WorldShape.cpp.

◆ ContactCounter

Count type for contacts.

Note
This type is meant to contain up to the square of the maximum value of a playrho::BodyCounter without possibility of overflow.
See also
MaxContacts, BodyCounter, JointCounter, ShapeCounter.
Examples
World.cpp, and WorldContact.cpp.

◆ ContactID

using playrho::ContactID = typedef detail::IndexingNamedType<ContactCounter, struct ContactIdentifier>

Contact identifier.

A strongly typed identifier for uniquely identifying contacts within playrho::d2::World instances. This is based on the playrho::ContactCounter type as its underlying type. These identifiers can be compared with other contact identifiers. Two contact identifiers from the same world that compare equal for example, identify the same contact within that world.

See also
InvalidContactID, Contact, ContactCounter, BodyID, JointID, ShapeID, d2::World.
Examples
World.cpp.

◆ DecayedTypeIfNotSame

template<typename Type , typename Check , typename DecayedType = std::decay_t<Type>>
using playrho::DecayedTypeIfNotSame = typedef std::enable_if_t<!std::is_same_v<DecayedType, Check>, DecayedType>

Decayed type if not same as the checked type.

Note
This is done separately from other checks to ensure order of compiler's SFINAE processing and to ensure elimination of check class before attempting to process other checks like is_copy_constructible_v. This prevents a compiler error that started showing up in gcc-9.

◆ Force2

using playrho::Force2 = typedef Vector2<Force>

2-element vector of Force quantities.

Note
Often used as a 2-dimensional force vector.
Examples
World.cpp, and WorldBody.cpp.

◆ HasNullaryFunctor

template<typename Type , typename Return >
using playrho::HasNullaryFunctor = typedef detail::HasFunctor<Type, Return()>

Has nullary functor type alias.

See also
HasUnaryFunctor.

◆ HasUnaryFunctor

template<typename Type , typename Return , typename Arg >
using playrho::HasUnaryFunctor = typedef detail::HasFunctor<Type, Return(Arg)>

Has unary functor type alias.

See also
HasNullaryFunctor.

◆ IndexPair

using playrho::IndexPair = typedef std::pair<VertexCounter, VertexCounter>

Index pair.

Note
Using std::array would make more sense if it weren't for the fact that std::pair, but not std::array, has constexpr equality and inequality operators.

◆ IndexPair3

using playrho::IndexPair3 = typedef std::array<IndexPair, MaxSimplexEdges>

Array of three index-pair elements.

Note
An element having the InvalidIndexPair value, denotes an unused or invalid elements.

◆ JointCounter

using playrho::JointCounter = typedef std::remove_const_t<decltype(MaxJoints)>

Counter type for joints.

Note
This type must be able to contain the playrho::MaxJoints value.
See also
MaxJoints, BodyCounter, ContactCounter, ShapeCounter.
Examples
World.cpp.

◆ JointID

using playrho::JointID = typedef detail::IndexingNamedType<JointCounter, struct JointIdentifier>

Joint identifier.

A strongly typed identifier for uniquely identifying joints within playrho::d2::World instances. This is based on the playrho::JointCounter type as its underlying type. These identifiers can be compared with other joint identifiers. Two joint identifiers from the same world that compare equal for example, identify the same joint within that world.

See also
InvalidJointID, JointCounter, BodyID, ContactID, ShapeID, d2::Joint, d2::World.

◆ Length2

◆ LinearAcceleration2

2-element vector of linear acceleration (LinearAcceleration) quantities.

Note
Often used as a 2-dimensional linear acceleration vector.
Examples
Body.cpp, DistanceJoint.cpp, RevoluteJoint.cpp, World.cpp, and WorldBody.cpp.

◆ LinearVelocity2

2-element vector of linear velocity (LinearVelocity) quantities.

Note
Often used as a 2-dimensional speed vector.
Examples
Body.cpp, World.cpp, and WorldBody.cpp.

◆ Matrix

template<typename T , std::size_t M, std::size_t N>
using playrho::Matrix = typedef Vector<Vector<T, N>, M>

Generic M by N matrix.

Note
M is the number of rows of the matrix.
N is the number of columns of the matrix.
See also
https://en.wikipedia.org/wiki/Matrix_(mathematics)
Vector, Matrix Traits, IsVectorV

◆ Momentum2

2-element vector of Momentum quantities.

Note
Often used as a 2-dimensional momentum vector.
Examples
DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, Joint.cpp, MotorJoint.cpp, PrismaticJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, and WorldBody.cpp.

◆ PairLength2

using playrho::PairLength2 = typedef std::pair<Length2, Length2>

Pair of Length2 values.

Note
Uses std::pair because this is a pair and also because std::pair has more support for constant expressions.

◆ Real

using playrho::Real = typedef float

Real-number type.

This is the number type underlying numerical calculations conceptually involving real-numbers. Ideally the implementation of this type doesn't suffer from things like: catastrophic cancellation, catastrophic division, overflows, nor underflows.

Note
This can be implemented using any of the fundamental floating point types (float, double, or long double).
This can also be implemented using a LiteralType that has necessary support: all common mathematical functions, support for infinity and NaN, and a specialization of the std::numeric_limits class template for it.
Regarding division:
  • While dividing 1 by a real, caching the result, and then doing multiplications with the result may well be faster (than repeatedly dividing), dividing 1 by the real can also result in an underflow situation that's then compounded every time it's multiplied with other values.
  • Meanwhile, dividing every time by a real isolates any underflows to the particular division where underflow occurs.
Warning
The note regarding division applies even more so when using a fixed-point type (for Real).
See also
https://en.cppreference.com/w/cpp/language/types
https://en.cppreference.com/w/cpp/types/is_floating_point
https://en.cppreference.com/w/cpp/named_req/LiteralType
Examples
Body.cpp, Compositor.cpp, DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, MotorJoint.cpp, PrismaticJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, Shape.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, World.cpp, WorldBody.cpp, WorldContact.cpp, and WorldShape.cpp.

◆ ShapeCounter

using playrho::ShapeCounter = typedef std::remove_const_t<decltype(MaxShapes)>

Count type for shapes.

Note
This type must always be able to contain the playrho::MaxShapes value.
See also
MaxShapes, BodyCounter, ContactCounter, JointCounter.

◆ ShapeID

using playrho::ShapeID = typedef detail::IndexingNamedType<ShapeCounter, struct ShapeIdentifier>

Shape identifier.

A strongly typed identifier for uniquely identifying shapes within playrho::d2::World instances. This is based on the playrho::ShapeCounter type as its underlying type. These identifiers can be compared with other shape identifiers. Two shape identifiers from the same world that compare equal for example, identify the same shape within that world.

See also
InvalidShapeID, ShapeCounter, BodyID, ContactID, JointID, d2::Shape, d2::World.
Examples
Body.cpp, World.cpp, and WorldShape.cpp.

◆ TimestepIters

using playrho::TimestepIters = typedef std::uint8_t

Time step iterations type.

A type for counting iterations per time-step.

◆ Vec2

using playrho::Vec2 = typedef Vector2<Real>

Vector with 2 Real elements.

Note
This data structure is two-times the size of the Real type (or 8 using Real of float).
Examples
Compositor.cpp, Shape.cpp, World.cpp, WorldBody.cpp, and WorldShape.cpp.

◆ Vector2

template<typename T >
using playrho::Vector2 = typedef Vector<T, 2>

Vector with 2-elements.

Note
This is just a C++11 alias template for 2-element uses of the Vector template.

◆ Vector3

template<typename T >
using playrho::Vector3 = typedef Vector<T, 3>

Vector with 3-elements.

Note
This is just a C++11 alias template for 3-element uses of the Vector template.

◆ VertexCounter

using playrho::VertexCounter = typedef std::remove_const_t<decltype(MaxShapeVertices)>

Vertex count type.

Note
This type must not support more than 255 vertices as that would conflict with the ContactFeature::Index type.
See also
MaxShapeVertices, InvalidVertex.

Enumeration Type Documentation

◆ BodyType

enum playrho::BodyType
strong

Type of body.

Note
static: zero mass, zero velocity, may be manually moved.
kinematic: zero mass, non-zero velocity set by user, moved by solver.
dynamic: positive mass, non-zero velocity determined by forces, moved by solver.
See also
IsSpeedable(BodyType), IsAccelerable(BodyType).
Enumerator
Static 

Static body type.

Static bodies have no mass, have no forces applied to them, and aren't moved by physical processes. They are impenetrable.

Note
Physics applied: none.
Kinematic 

Kinematic body type.

Kinematic bodies: have no mass, cannot have forces applied to them, can move at set velocities (they are "speedable"), and are impenetrable.

Note
Physics applied: velocity.
Dynamic 

Dynamic body type.

Dynamic bodies are fully simulated bodies - they are "speedable" and "accelerable". Dynamic bodies always have a positive non-zero mass. They may be penetrable.

Note
Physics applied: velocity, acceleration.

◆ LimitState

enum playrho::LimitState
strong

Limit state.

Note
Only used by joints that implement some notion of a limited range.
Enumerator
e_inactiveLimit 

Inactive limit.

e_atLowerLimit 

At-lower limit.

e_atUpperLimit 

At-upper limit.

e_equalLimits 

Equal limit.

Equal limit is used to indicate that a joint's upper and lower limits are approximately the same.

◆ PointState

enum playrho::PointState
strong

Point state enumeration.

Note
This is used for determining the state of contact points.
Enumerator
Null 

Point does not exist.

Add 

Point was added in the update.

Persist 

Point persisted across the update.

Remove 

Point was removed in the update.

◆ RayCastOpcode

Ray cast opcode enumeration.

Instructs some ray casting methods on what to do next.

Enumerator
Terminate 

End the ray-cast search for fixtures.

Use this to stop searching for fixtures.

IgnoreFixture 

Ignore the current fixture.

Use this to continue searching for fixtures along the ray.

ClipRay 

Clip the ray end to the current point.

Use this shorten the ray to the current point and to continue searching for fixtures now along the newly shortened ray.

ResetRay 

Reset the ray end back to the second point.

Use this to restore the ray to its full length and to continue searching for fixtures now along the restored full length ray.

Function Documentation

◆ Alloc()

void * playrho::Alloc ( std::size_t  size)

Allocates memory.

Note
One can change this function to use ones own memory allocator. Be sure to conform to this function's interface: throw a std::bad_alloc exception if unable to allocate non-zero sized memory and return a null pointer if the requested size is zero. This is done to ensure that the behavior is not implementation defined unlike std::malloc.
Exceptions
std::bad_allocIf unable to allocate non-zero sized memory.
Returns
Non-null pointer if size is not zero else nullptr. Pointer must be deallocated with Free(void*) or one of the Realloc functions.
See also
Free, Realloc, ReallocArray.

Referenced by AllocArray(), playrho::BlockAllocator::Allocate(), and playrho::StackAllocator::Allocate().

◆ AllocArray()

template<typename T >
T* playrho::AllocArray ( std::size_t  size)

Allocates memory for an array.

Exceptions
std::bad_allocIf unable to allocate non-zero sized memory.
Returns
Non-null pointer if size is not zero else nullptr. Pointer must be deallocated with Free(void*) or one of the Realloc functions.
See also
Free, Alloc, ReallocArray.

◆ compare()

constexpr auto playrho::compare ( const Version lhs,
const Version rhs 
)
constexprnoexcept

Comparison function.

Returns
Less-than zero if left-hand-side argument is less than the right. Greater-than zero if left-hand-side argument is greater than the right. Or zero if both arguments are the same.

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

◆ Equal()

template<class InputIt1 , class InputIt2 >
constexpr auto playrho::Equal ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2 
) -> decltype(first1 == last1, first2 == last2, ++first1, ++first2, *first1 == *first2)
constexpr

A pre-C++20 constant expression implementation of std::equal.

See also
https://en.cppreference.com/w/cpp/algorithm/equal

Referenced by operator==().

◆ EraseAll()

template<typename T , typename U >
auto playrho::EraseAll ( T &  container,
const U &  value 
) -> decltype(distance(container.erase(remove(begin(container), end(container), value), end(container)), end(container)))

Convenience template function for erasing specified value from container.

Note
This basically is the C++20 std::erase function.
Returns
Count of elements erased.
See also
EraseFirst.

◆ EraseFirst()

template<typename T , typename U >
auto playrho::EraseFirst ( T &  container,
const U &  value 
) -> decltype(container.erase(find(begin(container), end(container), value)) != end(container))

Convenience template function for erasing first found value from container.

Returns
true if value was found and erased, false otherwise.
See also
EraseAll.

◆ FlagForFiltering()

constexpr void FlagForFiltering ( Contact contact)
constexprnoexcept

Flags the contact for filtering.

Postcondition
NeedsFiltering(contact) returns true.
See also
NeedsFiltering(const Contact &).

◆ FlagForUpdating()

constexpr void FlagForUpdating ( Contact contact)
constexprnoexcept

Flags the contact for updating.

Postcondition
NeedsUpdating(contact) returns true.
See also
NeedsUpdating(const Contact &).

◆ Free()

◆ GetCenter()

template<typename T , typename U = decltype(Interval<T>{}, ((T{} + T{}) / 2))>
constexpr auto GetCenter ( const Interval< T > &  v)
constexprnoexcept

Gets the center of the given interval.

Warning
Behavior is not specified if the difference between the given range's max and min values overflows the range of the Interval::value_type.

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

◆ GetFriction()

constexpr auto GetFriction ( const Contact contact)
constexprnoexcept

Gets the coefficient of friction.

See also
SetFriction.

◆ GetFwdPerpendicular()

template<class T >
constexpr auto playrho::GetFwdPerpendicular ( const Vector2< T > &  vector) -> Vector2<T>
constexprnoexcept

Gets a vector clockwise (forward-clockwise) perpendicular to the given vector.

This takes a vector of form (x, y) and returns the vector (y, -x).

Parameters
vectorVector to return a clockwise perpendicular equivalent for.
Returns
A clockwise 90-degree rotation of the given vector.
See also
GetRevPerpendicular.

◆ GetIdentity()

template<typename T >
constexpr std::enable_if_t<IsSquareMatrixV<T>, T> playrho::GetIdentity ( )
constexpr

Gets the identity matrix of the template type and size as given by the argument.

See also
https://en.wikipedia.org/wiki/Identity_matrix
Matrix, IsMatrix, IsSquareMatrix

◆ GetIdentityMatrix()

template<typename T , std::size_t N>
constexpr std::enable_if_t<!IsVectorV<T>, Matrix<T, N, N> > playrho::GetIdentityMatrix ( )
constexpr

Gets the identity matrix of the template type and size.

See also
https://en.wikipedia.org/wiki/Identity_matrix
Matrix, IsMatrix, IsSquareMatrix

◆ GetMovementConf()

MovementConf playrho::GetMovementConf ( const StepConf conf)
noexcept

Gets the movement configuration from the given value.

Returns
The maxTranslation and maxRotation fields of the given value respectively are returned.

◆ GetNumValidIndices()

constexpr std::size_t playrho::GetNumValidIndices ( IndexPair3  pairs)
constexprnoexcept

Gets the number of valid indices in the given collection of index pairs.

Note
Any element with a value of InvalidIndexPair is interpreted as being invalid in this context.
Returns
Value between 0 and 3 inclusive.

Referenced by empty(), and size().

◆ GetRestitution()

constexpr auto GetRestitution ( const Contact contact)
constexprnoexcept

Gets the coefficient of restitution.

See also
SetRestitution.

◆ GetRevPerpendicular()

template<class T >
constexpr auto playrho::GetRevPerpendicular ( const Vector2< T > &  vector) -> Vector2<T>
constexprnoexcept

Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector.

This takes a vector of form (x, y) and returns the vector (-y, x).

Parameters
vectorVector to return a counter-clockwise perpendicular equivalent for.
Returns
A counter-clockwise 90-degree rotation of the given vector.
See also
GetFwdPerpendicular.

◆ GetSize()

template<typename T , typename U = decltype(Interval<T>{}, (T{} - T{}))>
constexpr auto playrho::GetSize ( const Interval< T > &  v)
constexprnoexcept

Gets the size of the given interval.

Gets the difference between the max and min values.

Precondition
The difference between the given interval's max and min is representable by Interval::value_type.
Returns
Non-negative value unless the given interval is "unset" or invalid.

Referenced by playrho::detail::AABB< N >::GetDimensions(), and playrho::detail::AABB< N >::GetPerimeter().

◆ GetTangentSpeed()

constexpr auto GetTangentSpeed ( const Contact contact)
constexprnoexcept

Gets the desired tangent speed.

See also
SetTangentSpeed.

◆ GetToi()

constexpr auto GetToi ( const Contact contact)
constexprnoexcept

Gets the time of impact (TOI) as a fraction.

Returns
Time of impact fraction in the range of 0 to 1 if set (where 1 means no actual impact in current time slot), otherwise empty.
See also
HasValidToi, SetToi(Contact&, const std::optional<UnitIntervalFF<Real>>&).

◆ GetToiCount()

constexpr auto GetToiCount ( const Contact contact)
constexprnoexcept

Gets the time of impact count.

See also
SetToiCount.

◆ HasValidToi()

constexpr auto HasValidToi ( const Contact contact)
constexprnoexcept

Gets whether a TOI is set.

See also
GetToi.

◆ IsAccelerable()

bool playrho::IsAccelerable ( BodyType  type)
inline

Is "accelerable".

Whether or not the given type value is for a body which can have a non-zero acceleration associated with it.

Returns
true if the given type value represents an "accelerable" type value, false otherwise.
Note
Would be nice if the Doxygen "relatedalso BodyType" command worked for this but seems that doesn't work for scoped enumeration.
See also
IsSpeedable(BodyType).

Referenced by playrho::d2::Body::GetVelocity(), and playrho::d2::Body::operator==().

◆ IsDestroyed()

constexpr auto IsDestroyed ( const Contact c) -> bool
constexprnoexcept

Whether or not the given contact was destroyed.

See also
SetDestroyed, UnsetDestroyed.

Referenced by playrho::d2::Body::operator==().

◆ IsFor() [1/3]

constexpr bool IsFor ( const Contact c,
BodyID  bodyID,
ShapeID  shapeID 
)
constexprnoexcept

Is-for convenience function.

Returns
true if contact is for the identified body and shape, else false.

Referenced by playrho::Contact::IsFor().

◆ IsFor() [2/3]

constexpr bool IsFor ( const Contact c,
ShapeID  shapeID 
)
constexprnoexcept

Is-for convenience function.

Returns
true if contact is for the identified shape, else false.

◆ IsFor() [3/3]

constexpr bool playrho::IsFor ( const Contactable c,
BodyID  bodyID,
ShapeID  shapeID 
)
constexprnoexcept

Is-for convenience function.

Returns
true if contactable is for the identified body and shape, else false.

◆ IsImpenetrable()

constexpr bool IsImpenetrable ( const Contact contact)
constexprnoexcept

Whether the given contact is "impenetrable".

Note
This should be true whenever body A or body B are impenetrable.

Referenced by playrho::d2::Body::operator==().

◆ IsIntersecting()

template<typename T , typename U = decltype(Interval<T>{}, T{} < T{}, T{} >= T{})>
constexpr bool IsIntersecting ( const Interval< T > &  a,
const Interval< T > &  b 
)
constexprnoexcept

Checks whether two value ranges have any intersection/overlap at all.

Note
a intersects with b if and only if any value of a is also a value of b.

Referenced by playrho::detail::AABB< N >::TestOverlap().

◆ IsSpeedable()

bool playrho::IsSpeedable ( BodyType  type)
inline

Is "speedable".

Whether or not the given type value is for a body which can have a non-zero speed associated with it.

Returns
true if the given type value represents a "speedable" type value, false otherwise.
Note
Would be nice if the Doxygen "relatedalso BodyType" command worked for this but seems that doesn't work for scoped enumeration.
See also
IsAccelerable(BodyType).

Referenced by playrho::d2::Body::operator==().

◆ IsValid() [1/6]

◆ IsValid() [2/6]

constexpr auto playrho::IsValid ( const ContactID value) -> bool
constexprnoexcept

Determines validity of given value by comparing against playrho::InvalidContactID .

Returns
true if not equal to playrho::InvalidContactID , else false.
See also
ContactID, InvalidContactID.

◆ IsValid() [3/6]

constexpr auto playrho::IsValid ( const JointID value) -> bool
constexprnoexcept

Determines validity of given value by comparing against playrho::InvalidJointID .

Returns
true if not equal to playrho::InvalidJointID , else false.
See also
JointID, InvalidJointID.

◆ IsValid() [4/6]

constexpr auto playrho::IsValid ( const Mat22 value) -> bool
constexprnoexcept

Determines if the given value is valid.

Determines whether the given vector contains finite coordinates.

◆ IsValid() [5/6]

constexpr auto playrho::IsValid ( const ShapeID value) -> bool
constexprnoexcept

Determines validity of given value by comparing against playrho::InvalidShapeID .

Returns
true if not equal to playrho::InvalidShapeID , else false.
See also
ShapeID, InvalidShapeID.

◆ IsValid() [6/6]

template<typename T >
constexpr auto playrho::IsValid ( const T &  value) -> bool
constexprnoexcept

Determines if the given value is valid, using the equality operator.

Any value for which the comparison of that value with itself is true is considered valid by this function, and any value for which this comparison is false is said to be not valid. If this seems like an odd algorithm, be aware that this is essentially how floating point NaN (not-a-number) works.

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

◆ MakeUnsigned()

template<typename T >
constexpr auto playrho::MakeUnsigned ( const T &  arg) -> std::enable_if_t<std::is_signed_v<T>, std::make_unsigned_t<T>>
constexprnoexcept

Makes the given value into an unsigned value.

Note
If the given value is negative, this will result in an unsigned value which is the two's complement modulo-wrapped value.
This is different from std::make_unsigned in that this changes the value to the value in the type that's the unsigned type equivalent of the input value. std::make_unsigned merely provides the unsigned type equivalent.

Referenced by playrho::Island::Count().

◆ max_size()

constexpr auto playrho::max_size ( IndexPair3  pairs) -> decltype(pairs.max_size())
constexpr

Gets the maximum size of the given container of index pairs.

Returns
Always returns 3.

Referenced by playrho::ArrayList< T, MAXSIZE, SIZE_TYPE >::ArrayList(), and playrho::d2::RayCast().

◆ MixFriction()

auto playrho::MixFriction ( NonNegativeFF< Real friction1,
NonNegativeFF< Real friction2 
)
inline

Mixes friction.

Friction mixing formula. The idea is to allow either value to drive the resulting friction to zero. For example, anything slides on ice.

Parameters
friction1A zero or greater value.
friction2A zero or greater value.
Returns
Mixed friction result.

Referenced by playrho::d2::Shape::GetDefaultFriction().

◆ MixRestitution()

auto playrho::MixRestitution ( Real  restitution1,
Real  restitution2 
)
inlinenoexcept

Mixes restitution.

Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. For example, a super ball bounces on anything.

Returns
Mixed restitution result.

Referenced by playrho::d2::Shape::GetDefaultRestitution().

◆ operator!=()

template<typename T >
constexpr bool operator!= ( const Interval< T > &  a,
const Interval< T > &  b 
)
constexprnoexcept

Inequality operator.

Note
Satisfies the EqualityComparable named requirement for Interval objects.
See also
https://en.cppreference.com/w/cpp/named_req/EqualityComparable

◆ operator*() [1/5]

template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 > &&!IsVectorV< T1 >, Vector< OT, N > > operator* ( const T1 &  s,
const Vector< T2, N > &  a 
)
constexprnoexcept

Multiplication operator for non-vector times vector.

Note
Explicitly disabled for Vector * Vector to prevent this function from existing in that case and prevent errors like "use of overloaded operator '*' is ambiguous".

◆ operator*() [2/5]

template<typename T1 , typename T2 , std::size_t A, std::size_t B, typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t<IsMultipliableV<T1, T2> && !IsVectorV<T1>, Vector<OT, B> > playrho::operator* ( const Vector< T1, A > &  lhs,
const Vector< Vector< T2, B >, A > &  rhs 
)
constexprnoexcept

Multiplies an A-element vector by a A-by-B vector of vectors.

Note
This algorithm favors column major ordering of the vector of vectors.
This treats the left-hand-side argument as though it's a 1-by-A vector of vectors.
Parameters
lhsLeft-hand-side vector treated as if it were of type: Vector<Vector<T1, A>, 1>.
rhsRight-hand-side vector of vectors.
Returns
B-element vector product.

◆ operator*() [3/5]

template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 > &&!IsVectorV< T2 >, Vector< OT, N > > operator* ( const Vector< T1, N > &  a,
const T2 &  s 
)
constexprnoexcept

Multiplication operator for vector times non-vector.

Note
Explicitly disabled for Vector * Vector to prevent this function from existing in that case and prevent errors like "use of overloaded operator '*' is ambiguous".

◆ operator*() [4/5]

template<typename T1 , typename T2 , std::size_t A, std::size_t B, typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t<IsMultipliableV<T1, T2> && !IsVectorV<T2>, Vector<OT, B> > playrho::operator* ( const Vector< Vector< T1, A >, B > &  lhs,
const Vector< T2, A > &  rhs 
)
constexprnoexcept

Multiplies a B-by-A vector of vectors by an A-element vector.

Note
This algorithm favors row major ordering of the vector of vectors.
This treats the right-hand-side argument as though it's an A-by-1 vector of vectors.
Parameters
lhsLeft-hand-side vector of vectors.
rhsRight-hand-side vector treated as if it were of type: Vector<Vector<T2, 1>, A>.
Returns
B-element vector product.

◆ operator*() [5/5]

template<typename T1 , typename T2 , std::size_t A, std::size_t B, std::size_t C, typename OT = decltype(T1{} * T2{})>
constexpr std::enable_if_t< IsMultipliableV< T1, T2 >, Vector< Vector< OT, C >, A > > operator* ( const Vector< Vector< T1, B >, A > &  lhs,
const Vector< Vector< T2, C >, B > &  rhs 
)
constexprnoexcept

Calculates the matrix product of the two given vector of vectors (matrices).

Multiplies an A-by-B vector of vectors by a B-by-C vector of vectors returning an A-by-C vector of vectors.

Note
From Wikipedia:

Multiplication of two matrices is defined if and only if the number of columns of the left matrix is the same as the number of rows of the right matrix.

Matrix multiplication is not commutative.
Algorithmically speaking, this implementation is called the "naive" algorithm. For small matrices, like 3-by-3 or smaller matrices, its complexity shouldn't be an issue. The matrix dimensions are compile time constants anyway which can help compilers automatically identify loop unrolling and hardware level parallelism opportunities.
Parameters
lhsLeft-hand-side matrix.
rhsRight-hand-side matrix.
Returns
A-by-C matrix product of the left-hand-side matrix and the right-hand-side matrix.
See also
https://en.wikipedia.org/wiki/Matrix_multiplication
https://en.wikipedia.org/wiki/Matrix_multiplication_algorithm
https://en.wikipedia.org/wiki/Commutative_property

◆ operator+()

template<typename T , std::size_t M, std::size_t N>
constexpr auto playrho::operator+ ( const Matrix< T, M, N > &  lhs,
const Matrix< T, M, N > &  rhs 
)
constexprnoexcept

Matrix addition operator for two same-type, same-sized matrices.

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

◆ operator+=() [1/2]

template<typename T , std::size_t S>
constexpr ArrayList<T, S>& playrho::operator+= ( ArrayList< T, S > &  lhs,
rhs 
)
constexpr

Appends the given value onto back.

Returns
Reference to this instance.
Exceptions
LengthErrorif size() is not less than max_size().
Postcondition
size() is one greater than before.
empty() returns false.
See also
max_size.

◆ operator+=() [2/2]

template<typename T , std::size_t S, class U >
constexpr auto playrho::operator+= ( ArrayList< T, S > &  lhs,
U &&  rhs 
) -> decltype(rhs.begin(), rhs.end(), rhs.size(), lhs)
constexpr

Appends the given values onto back.

Returns
Reference to this instance.
Exceptions
LengthErrorif operation would exceed max_size().
Postcondition
size() is size(value) greater than before.
empty() returns false.
See also
max_size.

◆ operator-()

template<typename T , std::size_t M, std::size_t N>
constexpr auto playrho::operator- ( const Matrix< T, M, N > &  lhs,
const Matrix< T, M, N > &  rhs 
)
constexprnoexcept

Matrix subtraction operator for two same-type, same-sized matrices.

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

◆ operator<() [1/2]

template<typename T >
constexpr bool operator< ( const Interval< T > &  lhs,
const Interval< T > &  rhs 
)
constexprnoexcept

Less-than operator.

Note
Provides a "strict weak ordering" relation.
This is a lexicographical comparison.
Obeys the LessThanComparable named requirement: for all a, !(a < a); if (a < b) then !(b < a); if (a < b) and (b < c) then (a < c); with equiv = !(a < b) && !(b < a), if equiv(a, b) and equiv(b, c), then equiv(a, c).
See also
https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings
https://en.cppreference.com/w/cpp/named_req/LessThanComparable

◆ operator<() [2/2]

template<std::size_t N0, class T0 , std::size_t N1, class T1 >
constexpr bool operator< ( const Vector< T0, N0 > &  lhs,
const Vector< T1, N1 > &  rhs 
)
constexprnoexcept

Less than operator.

Note
Among other things, this also makes the Vector class usable with std::set.

◆ operator<=()

template<typename T >
constexpr bool operator<= ( const Interval< T > &  lhs,
const Interval< T > &  rhs 
)
constexprnoexcept

Less-than or equal-to operator.

Note
Provides a "strict weak ordering" relation.
This is a lexicographical comparison.
See also
https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings

◆ operator==()

template<typename T >
constexpr bool operator== ( const Interval< T > &  a,
const Interval< T > &  b 
)
constexprnoexcept

Equality operator.

Note
Satisfies the EqualityComparable named requirement for Interval objects.
See also
https://en.cppreference.com/w/cpp/named_req/EqualityComparable

◆ operator>()

template<typename T >
constexpr bool operator> ( const Interval< T > &  lhs,
const Interval< T > &  rhs 
)
constexprnoexcept

Greater-than operator.

Note
Provides a "strict weak ordering" relation.
This is a lexicographical comparison.
See also
https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings

◆ operator>=()

template<typename T >
constexpr bool operator>= ( const Interval< T > &  lhs,
const Interval< T > &  rhs 
)
constexprnoexcept

Greater-than or equal-to operator.

Note
Provides a "strict weak ordering" relation.
This is a lexicographical comparison.
See also
https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings

◆ Realloc()

void * playrho::Realloc ( void *  ptr,
std::size_t  size 
)

Reallocates memory.

Note
One can change this function to use ones own memory allocator. Be sure to conform to this function's interface: throw a std::bad_alloc exception if unable to allocate non-zero sized memory, return a null pointer if the requested size is zero, and free old memory if the new size is zero. This is done to ensure that the behavior is not implementation defined unlike std::realloc.
If the new size for memory is zero, then the old memory is freed.
Exceptions
std::bad_allocIf unable to reallocate non-zero sized memory. Pointer must be deallocated with Free(void*) or one of the Realloc functions.
Returns
Non-null pointer if size is not zero else nullptr.
See also
Alloc, Free.

Referenced by ReallocArray().

◆ ReallocArray()

template<typename T >
T* playrho::ReallocArray ( T *  ptr,
std::size_t  count 
)

Reallocates memory for an array.

Parameters
ptrPointer to the old memory.
countCount of elements to reallocate for. This value must be less than the value of std::numeric_limits<std::size_t>::max() / sizeof(T) or an exception will be thrown.
Note
If the new size for memory is zero, then the old memory is freed.
Exceptions
std::bad_allocIf unable to reallocate non-zero sized memory.
Returns
Non-null pointer if count is not zero else nullptr. Pointer must be deallocated with Free(void*) or one of the Realloc functions.
See also
Realloc, Free.

◆ Reverse()

template<typename T >
std::enable_if_t<IsReverseIterableV<T>, ReversionWrapper<T> > playrho::Reverse ( T &&  iterable)

Gets a reversed order iterated wrapper.

See also
https://stackoverflow.com/a/28139075/7410358

◆ SetDestroyed()

constexpr void SetDestroyed ( Contact c)
constexprnoexcept

Sets the destroyed property of the given contact.

Note
This is only meaningfully used by the world implementation.

◆ SetEnabled()

constexpr void SetEnabled ( Contact contact)
constexprnoexcept

Enables the contact.

Postcondition
IsEnabled(contact) returns true.
See also
IsEnabled(const Contact &).

◆ SetFriction()

constexpr void SetFriction ( Contact contact,
NonNegative< Real value 
)
constexprnoexcept

Sets the friction value for the identified contact.

Overrides the default friction mixture.

Note
This value persists until set or reset.
Parameters
contactThe contact whose friction should be set.
valueCo-efficient of friction value of zero or greater.
Precondition
friction must be greater-than or equal-to zero.
Postcondition
GetFriction(contact) returns the value set.
See also
GetFriction.

◆ SetImpenetrable()

constexpr void SetImpenetrable ( Contact contact)
constexprnoexcept

Sets the impenetrability of the given contact.

Attention
Call this if body A or body B are impenetrable.
Postcondition
IsImpenetrable(contact) returns true.
See also
IsImpenetrable(const Contact &).

◆ SetRestitution()

constexpr void SetRestitution ( Contact contact,
Real  value 
)
constexpr

Sets the restitution value for the identified contact.

This override the default restitution mixture.

Note
You can call this in "pre-solve" listeners.
The value persists until you set or reset.
Postcondition
GetRestitution(contact) returns the value set.
See also
GetRestitution.

◆ SetSensor()

constexpr void SetSensor ( Contact contact)
constexprnoexcept

Sets the sensor state of the given contact.

Attention
Call this if shape A or shape B is a sensor.
Postcondition
IsSensor(contact) returns true.
See also
IsSensor(const Contact &).

◆ SetTangentSpeed()

constexpr void SetTangentSpeed ( Contact contact,
LinearVelocity  value 
)
constexprnoexcept

Sets the desired tangent speed for a conveyor belt behavior.

Postcondition
GetTangentSpeed(contact) returns the value set.
See also
GetTangentSpeed.

◆ SetToi()

constexpr void SetToi ( Contact contact,
const std::optional< UnitIntervalFF< Real >> &  toi 
)
constexprnoexcept

Sets the time of impact (TOI).

Parameters
contactThe contact to update.
toiOptional time of impact as a fraction between 0 and 1 where 1 indicates no actual impact in the current time slot.
Postcondition
HasValidToi(contact) returns toi.has_value().
GetToi(const Contact&) returns the value set.
See also
HasValidToi, GetToi.

◆ SetToiCount()

constexpr void SetToiCount ( Contact contact,
Contact::substep_type  value 
)
constexprnoexcept

Sets the TOI count to the given value.

Postcondition
GetToiCount(contact) returns value.
See also
GetToiCount.

◆ size()

constexpr auto playrho::size ( IndexPair3  pairs) -> decltype(GetNumValidIndices(pairs))
constexpr

Gets the dynamic size of the given collection of index pairs.

Note
This just calls GetNumValidIndices.
See also
GetNumValidIndices

Referenced by Alloc(), AllocArray(), playrho::StackAllocator::Allocate(), playrho::StackAllocator::AllocateArray(), Average(), ComputeCentroid(), Dot(), GetAreaOfPolygon(), GetPolarMoment(), playrho::detail::IsFull(), and Realloc().

◆ StripUnit()

◆ to_underlying()

template<typename T >
constexpr auto playrho::to_underlying ( value) -> underlying_type_t<T>
constexprnoexcept

Converts the given value to the value as the underlying type.

Note
This is like std::to_underlying slated for C++23.
Examples
World.cpp.

Referenced by playrho::d2::VelocityConstraint::VelocityConstraint(), playrho::d2::At(), playrho::d2::GetSoonestContact(), playrho::d2::World::GetWorldIndex(), playrho::Contactable::operator<<(), and playrho::GaussSeidel::SolvePositionConstraint().

◆ UnflagForFiltering()

constexpr void UnflagForFiltering ( Contact contact)
constexprnoexcept

Unflags this contact for filtering.

Postcondition
NeedsFiltering(contact) returns false.
See also
NeedsFiltering(const Contact &).

◆ UnflagForUpdating()

constexpr void UnflagForUpdating ( Contact contact)
constexprnoexcept

Unflags this contact for updating.

Postcondition
NeedsUpdating(contact) returns false.
See also
NeedsUpdating(const Contact &).

◆ UnsetDestroyed()

constexpr void UnsetDestroyed ( Contact c)
constexprnoexcept

Unsets the destroyed property of the given contact.

Note
This is only meaningfully used by the world implementation.

◆ UnsetEnabled()

constexpr void playrho::UnsetEnabled ( Contact contact)
constexprnoexcept

Disables the identified contact.

Postcondition
IsEnabled(contact) returns false.
See also
IsEnabled(const Contact &).

◆ UnsetImpenetrable()

constexpr void UnsetImpenetrable ( Contact contact)
constexprnoexcept

Unsets the impenetrability of the given contact.

Attention
Call this if body A or body B are no longer impenetrable.
Postcondition
IsImpenetrable(contact) returns false.
See also
IsImpenetrable(const Contact &).

◆ UnsetSensor()

constexpr void UnsetSensor ( Contact contact)
constexprnoexcept

Unsets the sensor state of the given contact.

Postcondition
IsSensor(contact) returns false.
See also
IsSensor(const Contact &).
Examples
WorldContact.cpp.

◆ used()

template<typename T >
ObjectPool<T>::size_type playrho::used ( const ObjectPool< T > &  array)
noexcept

Gets the number of elements that are used in the specified structure.

Returns
Size of the specified structure minus the size of its free pool.

Variable Documentation

◆ DefaultAngularSleepTolerance

constexpr auto playrho::DefaultAngularSleepTolerance = Real((Pi * 2) / 180) * RadianPerSecond
constexpr

Default angular sleep tolerance.

A body cannot sleep if its angular velocity is above this amount.

See also
DefaultLinearSleepTolerance.

◆ DefaultAngularSlop

constexpr auto playrho::DefaultAngularSlop = (Pi * 2_rad) / Real(180)
constexpr

Default angular slop.

A small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.

See also
DefaultLinearSlop.

◆ DefaultCirclesRatio

constexpr auto playrho::DefaultCirclesRatio = Real(10)
constexpr

Default circles ratio.

Ratio used for switching between rounded-corner collisions and closest-face biased normal collisions.

◆ DefaultLinearSleepTolerance

constexpr auto playrho::DefaultLinearSleepTolerance = 0.01_mps
constexpr

Default linear sleep tolerance.

A body cannot sleep if the magnitude of its linear velocity is above this amount.

See also
DefaultAngularSleepTolerance.

◆ DefaultLinearSlop

constexpr auto playrho::DefaultLinearSlop = 0.005_m
constexpr

Default linear slop.

Length used as a collision and constraint tolerance. Usually chosen to be numerically significant, but visually insignificant. Lower or raise to decrease or increase respectively the minimum of space between bodies at rest.

Note
Smaller values relative to sizes of bodies increases the time it takes for bodies to come to rest.
The value used by Box2D 2.3.2's b2_linearSlop define is 0.005 (meters).
See also
DefaultAngularSlop.
Examples
Compositor.cpp.

Referenced by playrho::d2::PolygonShapeConf::Set().

◆ DefaultMaxAngularCorrection

constexpr auto playrho::DefaultMaxAngularCorrection = Real(8.0f / 180.0f) * Pi * 1_rad
constexpr

Default maximum angular correction.

Note
This value should be greater than the angular slop value.
See also
DefaultMaxLinearCorrection.

◆ DefaultMaxLinearCorrection

constexpr auto playrho::DefaultMaxLinearCorrection = 0.2_m
constexpr

Default maximum linear correction.

The maximum linear position correction used when solving constraints. This helps to prevent overshoot.

Note
This value should be greater than the linear slop value.
See also
DefaultMaxAngularCorrection.

◆ DefaultMaxRotation

constexpr auto playrho::DefaultMaxRotation = Angle{179_deg}
constexpr

Default maximum rotation per world step.

Warning
This value should always be less than 180 degrees - i.e. less than .5 * Pi * Radian.
Note
This limit is meant to prevent numerical problems. Adjusting this value isn't advised.
See also
DefaultMaxTranslation, StepConf::maxRotation.

◆ DefaultMaxSubSteps

constexpr auto playrho::DefaultMaxSubSteps = std::uint8_t{8}
constexpr

Default maximum number of sub steps.

This is the default maximum number of sub-steps per contact in continuous physics simulation. In other words, this is the default maximum number of times in a world step that a contact will have continuous collision resolution done for it.

Note
Used in the TOI phase of step processing.

◆ DefaultMaxTranslation

constexpr auto playrho::DefaultMaxTranslation = 2_m
constexpr

Default maximum translation amount.

See also
DefaultMaxRotation.

◆ DefaultMaxVertexRadius

constexpr auto playrho::DefaultMaxVertexRadius = 255_m
constexpr

Default maximum vertex radius.

Note
Recommend using 255_m or DefaultLinearSlop * 2 * 25500.
See also
DefaultMinVertexRadius, DefaultLinearSlop.
Examples
World.cpp.

◆ DefaultMinStillTimeToSleep

constexpr auto playrho::DefaultMinStillTimeToSleep = Time{1_s / 2}
constexpr

Default minimum still time to sleep.

The default minimum time bodies must be still for bodies to be put to sleep.

◆ DefaultMinVertexRadius

constexpr auto playrho::DefaultMinVertexRadius = 0.01_m
constexpr

Default minimum vertex radius.

Note
Recommend using 0.01_m or DefaultLinearSlop * Real(2).
See also
DefaultMaxVertexRadius, DefaultLinearSlop.

◆ DefaultRegMinMomentum

constexpr auto playrho::DefaultRegMinMomentum = Momentum{0_Ns / 100}
constexpr

Default regular-phase minimum momentum.

See also
DefaultToiMinMomentum.

◆ DefaultStepFrequency

constexpr auto playrho::DefaultStepFrequency = 60_Hz
constexpr

Default step frequency.

See also
DefaultStepTime.

◆ DefaultStepTime

constexpr auto playrho::DefaultStepTime = Time{1_s / 60}
constexpr

Default step time.

See also
DefaultStepFrequency.

◆ DefaultToiMinMomentum

constexpr auto playrho::DefaultToiMinMomentum = Momentum{0_Ns / 100}
constexpr

Default TOI-phase minimum momentum.

See also
DefaultRegMinMomentum.

◆ Invalid

template<class T , std::enable_if_t< std::numeric_limits< T >::has_signaling_NaN||std::numeric_limits< T >::has_quiet_NaN, int > = 0>
constexpr auto playrho::Invalid
constexpr
Initial value:
= std::numeric_limits<T>::has_signaling_NaN
? std::numeric_limits<T>::signaling_NaN()
: std::numeric_limits<T>::quiet_NaN()

Invalid value of the template's instantiated numeric type.

◆ InvalidBodyID

constexpr auto playrho::InvalidBodyID = BodyID{static_cast<BodyID::underlying_type>(-1)}
constexpr

Invalid body ID value.

A special, reserved value of a playrho::BodyID that represents/identifies an invalid body.

See also
BodyID, IsValid.
Examples
DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, Joint.cpp, MotorJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, World.cpp, and WorldBody.cpp.

Referenced by playrho::d2::World::FindClosestBody(), playrho::d2::World::GetAnchorA(), playrho::d2::World::GetAnchorB(), playrho::d2::DistanceJointConf::InitVelocity(), playrho::d2::FrictionJointConf::InitVelocity(), playrho::d2::GearJointConf::InitVelocity(), playrho::d2::MotorJointConf::InitVelocity(), playrho::d2::PrismaticJointConf::InitVelocity(), playrho::d2::PulleyJointConf::InitVelocity(), playrho::d2::RevoluteJointConf::InitVelocity(), playrho::d2::RopeJointConf::InitVelocity(), playrho::d2::TargetJointConf::InitVelocity(), playrho::d2::WeldJointConf::InitVelocity(), playrho::d2::WheelJointConf::InitVelocity(), playrho::d2::World::IsEnabled(), IsValid(), playrho::d2::World::SetAwake(), playrho::d2::DistanceJointConf::SolvePosition(), playrho::d2::GearJointConf::SolvePosition(), playrho::d2::PrismaticJointConf::SolvePosition(), playrho::d2::PulleyJointConf::SolvePosition(), playrho::d2::RevoluteJointConf::SolvePosition(), playrho::d2::RopeJointConf::SolvePosition(), playrho::d2::WeldJointConf::SolvePosition(), playrho::d2::WheelJointConf::SolvePosition(), playrho::d2::DistanceJointConf::SolveVelocity(), playrho::d2::FrictionJointConf::SolveVelocity(), playrho::d2::GearJointConf::SolveVelocity(), playrho::d2::MotorJointConf::SolveVelocity(), playrho::d2::PrismaticJointConf::SolveVelocity(), playrho::d2::PulleyJointConf::SolveVelocity(), playrho::d2::RevoluteJointConf::SolveVelocity(), playrho::d2::RopeJointConf::SolveVelocity(), playrho::d2::TargetJointConf::SolveVelocity(), playrho::d2::WeldJointConf::SolveVelocity(), and playrho::d2::WheelJointConf::SolveVelocity().

◆ InvalidContactID

constexpr auto playrho::InvalidContactID = ContactID{static_cast<ContactID::underlying_type>(-1)}
constexpr

Invalid contact ID value.

A special, reserved value of a playrho::ContactID that represents/identifies an invalid contact.

See also
ContactID, IsValid.

Referenced by playrho::d2::GetSoonestContact(), and IsValid().

◆ InvalidIndexPair

constexpr auto playrho::InvalidIndexPair
constexpr
Initial value:
}
constexpr auto InvalidVertex
Invalid vertex index.
Definition: Settings.hpp:89
std::pair< VertexCounter, VertexCounter > IndexPair
Index pair.
Definition: IndexPair.hpp:42

Invalid index-pair value.

Referenced by playrho::d2::DistanceProxy::Distance(), playrho::d2::GetIndexPairs(), and GetNumValidIndices().

◆ InvalidJointID

constexpr auto playrho::InvalidJointID = JointID{static_cast<JointID::underlying_type>(-1)}
constexpr

Invalid joint ID value.

A special, reserved value of a playrho::JointID that represents/identifies an invalid joint.

See also
JointID, IsValid.
Examples
DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, MotorJoint.cpp, PrismaticJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, and World.cpp.

Referenced by IsValid().

◆ InvalidShapeID

constexpr auto playrho::InvalidShapeID = ShapeID{static_cast<ShapeID::underlying_type>(-1)}
constexpr

Invalid shape ID value.

A special, reserved value of a playrho::ShapeID that represents/identifies an invalid shape.

See also
ShapeID, IsValid.
Examples
World.cpp, WorldBody.cpp, and WorldShape.cpp.

Referenced by playrho::d2::Body::Attach(), and IsValid().

◆ InvalidVertex

constexpr auto playrho::InvalidVertex = static_cast<VertexCounter>(-1)
constexpr

◆ MaxBodies

constexpr auto playrho::MaxBodies
constexpr
Initial value:
= static_cast<std::uint16_t>(std::numeric_limits<std::uint16_t>::max() -
std::uint16_t{1})

Maximum number of bodies in a world.

Note
This is 2^16 - 2, i.e. 65534, based off std::uint16_t and eliminating one value for the invalid body identifier (playrho::InvalidBodyID ).
See also
BodyCounter, BodyID, InvalidBodyID, MaxContacts, MaxJoints, MaxShapes.
Examples
World.cpp.

◆ MaxContacts

constexpr auto playrho::MaxContacts = ContactCounter{MaxBodies} * ContactCounter{MaxBodies - 1} / ContactCounter{2}
constexpr

Maximum number of contacts in a world (2147319811).

Uses the formula for the maximum number of edges in an unidirectional graph of playrho::MaxBodies nodes. This occurs when every possible body is connected to every other body.

See also
ContactCounter. ContactID, InvalidContactID, MaxBodies, MaxJoints, MaxShapes.

◆ MaxJoints

constexpr auto playrho::MaxJoints
constexpr
Initial value:
= static_cast<std::uint16_t>(std::numeric_limits<std::uint16_t>::max() -
std::uint16_t{1})

Maximum number of joints in a world.

Note
This is 2^16 - 2, i.e. 65534, based off std::uint16_t and eliminating one value for the invalid joint identifier (playrho::InvalidJointID ).
See also
JointCounter, JointID. InvalidJointID, MaxBodies, MaxContacts. MaxShapes.
Examples
World.cpp.

◆ MaxManifoldPoints

constexpr auto playrho::MaxManifoldPoints = std::uint8_t{2}
constexpr

Maximum manifold points.

This is the maximum number of contact points between two convex shapes. Do not change this value.

Note
For memory efficiency, this uses the smallest integral type that can hold the value.

Referenced by playrho::d2::ContactImpulsesList::AddEntry(), playrho::d2::Manifold::AddPoint(), playrho::d2::ContactImpulsesList::GetEntryNormal(), playrho::d2::ContactImpulsesList::GetEntryTanget(), playrho::d2::WorldManifold::GetImpulses(), playrho::d2::WorldManifold::GetPoint(), playrho::d2::VelocityConstraint::GetPointAt(), and playrho::d2::WorldManifold::GetSeparation().

◆ MaxShapes

constexpr auto playrho::MaxShapes
constexpr
Initial value:
= static_cast<std::uint16_t>(std::numeric_limits<std::uint16_t>::max() -
std::uint16_t{1})

Maximum number of shapes in a world.

Note
This is 65534 based off std::uint16_t and eliminating one value for the invalid shape identifier (playrho::InvalidShapeID ).
See also
ShapeCounter, ShapeID, InvalidShapeID, MaxBodies, MaxContacts, MaxJoints.

◆ MaxShapeVertices

constexpr auto playrho::MaxShapeVertices = std::uint8_t{254}
constexpr

Maximum number of vertices for any shape type.

Note
For memory efficiency, uses the smallest integral type that can hold the value minus one that's left out as a special, reserved value.
See also
VertexCounter, InvalidVertex.

Referenced by playrho::ToiOutput::GetToiViaSat().

◆ Pi

constexpr auto playrho::Pi = Real(3.14159265358979323846264338327950288L)
constexpr

Pi.

An "irrational number" that's defined as the ratio of a circle's circumference to its diameter.

Note
While the include file definition of M_PI may be a POSIX compliance requirement and initially attractive to use, it's apparently not a C++ standards requirement and casually including it pollutes the name space of all code that uses this library. Whatever the case, MSVC 2017 doesn't make it part of the cmath include without enabling _USE_MATH_DEFINES. So rather than add yet more C preprocessor macros to all sources that this library may be compiled with, it's simply hard-coded in here instead using a C++ mechanism that also keeps it with the enclosing name space.
Any narrowing is intentional.
See also
https://en.wikipedia.org/wiki/Pi
Examples
World.cpp.

Referenced by GetAreaOfCircle(), GetCircleVertices(), playrho::d2::ChainShapeConf::GetMassData(), playrho::d2::GetMassData(), GetNormalized(), playrho::d2::Position::GetPosition(), GetShortestDelta(), playrho::d2::DistanceJointConf::InitVelocity(), playrho::d2::TargetJointConf::InitVelocity(), playrho::d2::WeldJointConf::InitVelocity(), and playrho::d2::WheelJointConf::InitVelocity().

◆ SquareRootTwo

constexpr auto playrho::SquareRootTwo
constexpr
Initial value:
=
Real(1.414213562373095048801688724209698078569671875376948073176679737990732478462L)
float Real
Real-number type.
Definition: Real.hpp:69

Square root of two.

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

Referenced by playrho::d2::UnitVec::GetDownRight(), and playrho::d2::UnitVec::GetUpRight().