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

Description of a "sweep" of motion in 2-D space. More...

#include <playrho/d2/Sweep.hpp>

Collaboration diagram for playrho::d2::Sweep:
[legend]

Public Member Functions

constexpr Sweep ()=default
 Default constructor. More...
 
constexpr Sweep (const Position &p, const Length2 &lc=Length2{0_m, 0_m})
 Initializing constructor. More...
 
constexpr Sweep (const Position &p0, const Position &p1, const Length2 &lc=Length2{0_m, 0_m}, ZeroToUnderOneFF< Real > a0={}) noexcept
 Initializing constructor. More...
 

Public Attributes

ZeroToUnderOneFF< Realalpha0
 Alpha 0 of this sweep. More...
 
Length2 localCenter = Length2{0_m, 0_m}
 Local center of mass position.
 
Position pos0 {}
 Center world position and world angle at time "0".
 
Position pos1 {}
 Center world position and world angle at time "1".
 

Related Functions

(Note that these are not member functions.)

Sweep GetNormalized (Sweep sweep) noexcept
 Gets a sweep with the given sweep's angles normalized. More...
 
constexpr auto IsValid (const d2::Sweep &value) noexcept -> bool
 Determines if the given value is valid.
 
constexpr bool operator!= (const Sweep &lhs, const Sweep &rhs)
 Not-equals operator.
 
constexpr bool operator== (const Sweep &lhs, const Sweep &rhs)
 Equals operator.
 
void SetLocalCenter (Sweep &sweep, const Length2 &value) noexcept
 Convenience function for setting the sweep's local center.
 

Detailed Description

Description of a "sweep" of motion in 2-D space.

This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may not coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.

Constructor & Destructor Documentation

◆ Sweep() [1/3]

constexpr playrho::d2::Sweep::Sweep ( )
constexprdefault

Default constructor.

Postcondition
pos0 is the value of Position{}.
pos1 is the value of Position{}.
localCenter is the value of Length2{}.
alpha0 is zero.

◆ Sweep() [2/3]

constexpr playrho::d2::Sweep::Sweep ( const Position p0,
const Position p1,
const Length2 lc = Length2{0_m, 0_m},
ZeroToUnderOneFF< Real a0 = {} 
)
inlineconstexprnoexcept

Initializing constructor.

Parameters
p0Value for position 0.
p1Value for position 1.
lcLocal center.
a0Alpha 0 for the sweep.
Postcondition
pos0 is the value of p0 .
pos1 is the value of p1 .
localCenter is the value of lc .
alpha0 is the value of a0 .

◆ Sweep() [3/3]

constexpr playrho::d2::Sweep::Sweep ( const Position p,
const Length2 lc = Length2{0_m, 0_m} 
)
inlineexplicitconstexpr

Initializing constructor.

Postcondition
pos0 is the value of p .
pos1 is the value of p .
localCenter is the value of lc .
alpha0 is zero.

Friends And Related Function Documentation

◆ GetNormalized()

Sweep GetNormalized ( Sweep  sweep)
related

Gets a sweep with the given sweep's angles normalized.

Parameters
sweepSweep to return with its angles normalized.
Returns
Sweep with its position 0 angle to be between -2 pi and 2 pi and its position 1 angle reduced by the amount the position 0 angle was reduced by.

Member Data Documentation

◆ alpha0

ZeroToUnderOneFF<Real> playrho::d2::Sweep::alpha0

Alpha 0 of this sweep.

Fraction of the current time step in the range [0,1)

Note
pos0.linear and pos0.angular are the positions at alpha0.

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


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