Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Member Functions | Public Attributes | List of all members
box2d::Sweep Class Reference

Sweep. More...

#include <Math.hpp>

Public Member Functions

 Sweep ()=default
 Default constructor. More...
 
constexpr Sweep (const Sweep &copy)=default
 Copy constructor. More...
 
constexpr Sweep (const Position p0, const Position p1, const Length2D lc=Vec2_zero *Meter, RealNum a0=0) noexcept
 Initializing constructor. More...
 
constexpr Sweep (const Position p, const Length2D lc=Vec2_zero *Meter)
 Initializing constructor. More...
 
Length2D GetLocalCenter () const noexcept
 Gets the local center of mass position. More...
 
RealNum GetAlpha0 () const noexcept
 Gets the alpha0 for this sweep. More...
 
void Advance0 (RealNum alpha) noexcept
 Advances the sweep by a factor of the difference between the given time alpha and the sweep's alpha0. More...
 
void ResetAlpha0 () noexcept
 

Public Attributes

Position pos0
 Center world position and world angle at time "0". 12-bytes. More...
 
Position pos1
 Center world position and world angle at time "1". 12-bytes. More...
 

Detailed Description

Sweep.

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

Constructor & Destructor Documentation

◆ Sweep() [1/4]

box2d::Sweep::Sweep ( )
default

Default constructor.

◆ Sweep() [2/4]

constexpr box2d::Sweep::Sweep ( const Sweep copy)
default

Copy constructor.

◆ Sweep() [3/4]

constexpr box2d::Sweep::Sweep ( const Position  p0,
const Position  p1,
const Length2D  lc = Vec2_zero * Meter,
RealNum  a0 = 0 
)
inlinenoexcept

Initializing constructor.

◆ Sweep() [4/4]

constexpr box2d::Sweep::Sweep ( const Position  p,
const Length2D  lc = Vec2_zero * Meter 
)
inlineexplicit

Initializing constructor.

Member Function Documentation

◆ Advance0()

void box2d::Sweep::Advance0 ( RealNum  alpha)
inlinenoexcept

Advances the sweep by a factor of the difference between the given time alpha and the sweep's alpha0.

This advances position 0 (pos0) of the sweep towards position 1 (pos1) by a factor of the difference between the given alpha and the alpha0.

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

◆ GetAlpha0()

RealNum box2d::Sweep::GetAlpha0 ( ) const
inlinenoexcept

Gets the alpha0 for this sweep.

Returns
Value between 0 and less than 1.

◆ GetLocalCenter()

Length2D box2d::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.

◆ ResetAlpha0()

void box2d::Sweep::ResetAlpha0 ( )
inlinenoexcept

Member Data Documentation

◆ pos0

Position box2d::Sweep::pos0

Center world position and world angle at time "0". 12-bytes.

◆ pos1

Position box2d::Sweep::pos1

Center world position and world angle at time "1". 12-bytes.


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