Description of a "sweep" of motion in 2-D space. More...
#include <Sweep.hpp>
Public Member Functions | |
Sweep ()=default | |
Default constructor. | |
constexpr | Sweep (const Sweep ©)=default |
Copy constructor. | |
constexpr | Sweep (const Position p0, const Position p1, const Length2 lc=Length2{0_m, 0_m}, Real a0=0) noexcept |
Initializing constructor. | |
constexpr | Sweep (const Position p, const Length2 lc=Length2{0_m, 0_m}) |
Initializing constructor. | |
Length2 | GetLocalCenter () const noexcept |
Gets the local center of mass position. More... | |
Real | GetAlpha0 () const noexcept |
Gets the alpha 0 for this sweep. More... | |
void | Advance0 (Real alpha) noexcept |
Advances the sweep by a factor of the difference between the given time alpha and the sweep's alpha 0. More... | |
void | ResetAlpha0 () noexcept |
Resets the alpha 0 value back to zero. More... | |
Public Attributes | |
Position | pos0 |
Center world position and world angle at time "0". | |
Position | pos1 |
Center world position and world angle at time "1". | |
Private Attributes | |
Length2 | localCenter = Length2{0_m, 0_m} |
Local center of mass position. More... | |
Real | alpha0 = 0 |
Fraction of the current time step in the range [0,1]. More... | |
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 bool | operator== (const Sweep &lhs, const Sweep &rhs) |
Equals operator. | |
constexpr bool | operator!= (const Sweep &lhs, const Sweep &rhs) |
Not-equals operator. | |
template<> | |
constexpr bool | IsValid (const d2::Sweep &value) noexcept |
Determines if the given value is valid. | |
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.
|
inlinenoexcept |
Advances the sweep by a factor of the difference between the given time alpha and the sweep's alpha 0.
This advances position 0 (pos0
) of the sweep towards position 1 (pos1
) by a factor of the difference between the given alpha and the alpha 0.
alpha | Valid new time factor in [0,1) to update the sweep to. Behavior is undefined if value is invalid. |
Referenced by playrho::d2::Body::Advance(), and playrho::d2::Body::Advance0().
|
inlinenoexcept |
Gets the alpha 0 for this sweep.
Referenced by playrho::d2::GetToiViaSat(), and playrho::d2::operator==().
|
inlinenoexcept |
Gets the local center of mass position.
Referenced by playrho::d2::operator==().
|
inlinenoexcept |
Resets the alpha 0 value back to zero.
Referenced by playrho::d2::Body::ResetAlpha0().
|
private |
Fraction of the current time step in the range [0,1].
pos0.linear
and pos0.angular
are the positions at alpha0
. Referenced by GetAlpha0(), and ResetAlpha0().