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

#include <Sweep.hpp>

Public Member Functions

 Sweep ()=default
 Default constructor. More...
 
PLAYRHO_CONSTEXPR Sweep (const Sweep &copy)=default
 Copy constructor. More...
 
PLAYRHO_CONSTEXPR Sweep (const Position p0, const Position p1, const Length2 lc=Length2{0_m, 0_m}, Real a0=0) noexcept
 Initializing constructor. More...
 
PLAYRHO_CONSTEXPR Sweep (const Position p, const Length2 lc=Length2{0_m, 0_m})
 Initializing constructor. More...
 
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". More...
 
Position pos1
 Center world position and world angle at time "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...
 

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.

Note
This data structure is likely 36-bytes (at least on 64-bit platforms).

Definition at line 41 of file Sweep.hpp.

Constructor & Destructor Documentation

◆ Sweep() [1/4]

playrho::d2::Sweep::Sweep ( )
default

Default constructor.

◆ Sweep() [2/4]

PLAYRHO_CONSTEXPR playrho::d2::Sweep::Sweep ( const Sweep copy)
inlinedefault

Copy constructor.

◆ Sweep() [3/4]

PLAYRHO_CONSTEXPR playrho::d2::Sweep::Sweep ( const Position  p0,
const Position  p1,
const Length2  lc = Length2{0_m, 0_m},
Real  a0 = 0 
)
inlinenoexcept

Initializing constructor.

Definition at line 52 of file Sweep.hpp.

◆ Sweep() [4/4]

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

Initializing constructor.

Definition at line 62 of file Sweep.hpp.

Member Function Documentation

◆ GetLocalCenter()

Length2 playrho::d2::Sweep::GetLocalCenter ( ) const
inlinenoexcept

Gets the local center of mass position.

Note
This value can only be set via a sweep constructed using an initializing constructor.

Definition at line 72 of file Sweep.hpp.

◆ GetAlpha0()

Real playrho::d2::Sweep::GetAlpha0 ( ) const
inlinenoexcept

Gets the alpha 0 for this sweep.

Returns
Value between 0 and less than 1.

Definition at line 76 of file Sweep.hpp.

◆ Advance0()

void playrho::d2::Sweep::Advance0 ( Real  alpha)
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.

Parameters
alphaValid new time factor in [0,1) to update the sweep to. Behavior is undefined if value is invalid.

Definition at line 111 of file Sweep.hpp.

◆ ResetAlpha0()

void playrho::d2::Sweep::ResetAlpha0 ( )
inlinenoexcept

Resets the alpha 0 value back to zero.

Postcondition
Getting the alpha 0 value after calling this method will return zero.

Definition at line 123 of file Sweep.hpp.

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.

Definition at line 796 of file Math.hpp.

Member Data Documentation

◆ pos0

Position playrho::d2::Sweep::pos0

Center world position and world angle at time "0".

Definition at line 94 of file Sweep.hpp.

◆ pos1

Position playrho::d2::Sweep::pos1

Center world position and world angle at time "1".

Definition at line 97 of file Sweep.hpp.


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