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

#include <UnitVec2.hpp>

Public Types

using data_type = RealNum
 

Public Member Functions

constexpr UnitVec2 () noexcept
 
 UnitVec2 (const Angle angle) noexcept
 
constexpr auto GetX () const noexcept
 
constexpr auto GetY () const noexcept
 
constexpr auto cos () const noexcept
 
constexpr auto sin () const noexcept
 
constexpr UnitVec2 FlipXY () const noexcept
 
constexpr UnitVec2 FlipX () const noexcept
 
constexpr UnitVec2 FlipY () const noexcept
 
constexpr UnitVec2 Rotate (UnitVec2 amount) const noexcept
 
constexpr UnitVec2 GetRevPerpendicular () const noexcept
 Gets a vector counter-clockwise (reverse-clockwise) perpendicular to this vector. More...
 
constexpr UnitVec2 GetFwdPerpendicular () const noexcept
 Gets a vector clockwise (forward-clockwise) perpendicular to this vector. More...
 
constexpr UnitVec2 operator- () const noexcept
 
constexpr UnitVec2 operator+ () const noexcept
 
constexpr UnitVec2 Absolute () const noexcept
 

Static Public Member Functions

static constexpr UnitVec2 GetRight () noexcept
 
static constexpr UnitVec2 GetLeft () noexcept
 
static constexpr UnitVec2 GetTop () noexcept
 
static constexpr UnitVec2 GetBottom () noexcept
 
static constexpr UnitVec2 GetZero () noexcept
 
static constexpr UnitVec2 GetDefaultFallback () noexcept
 
static UnitVec2 Get (const RealNum x, const RealNum y, RealNum &magnitude, const UnitVec2 fallback=GetDefaultFallback())
 

Member Typedef Documentation

◆ data_type

Constructor & Destructor Documentation

◆ UnitVec2() [1/2]

constexpr box2d::UnitVec2::UnitVec2 ( )
inlinenoexcept

◆ UnitVec2() [2/2]

UnitVec2::UnitVec2 ( const Angle  angle)
explicitnoexcept

Member Function Documentation

◆ Absolute()

constexpr UnitVec2 box2d::UnitVec2::Absolute ( ) const
inlinenoexcept

◆ cos()

constexpr auto box2d::UnitVec2::cos ( ) const
inlinenoexcept

◆ FlipX()

constexpr UnitVec2 box2d::UnitVec2::FlipX ( ) const
inlinenoexcept

◆ FlipXY()

constexpr UnitVec2 box2d::UnitVec2::FlipXY ( ) const
inlinenoexcept

◆ FlipY()

constexpr UnitVec2 box2d::UnitVec2::FlipY ( ) const
inlinenoexcept

◆ Get()

UnitVec2 UnitVec2::Get ( const RealNum  x,
const RealNum  y,
RealNum magnitude,
const UnitVec2  fallback = GetDefaultFallback() 
)
static

◆ GetBottom()

static constexpr UnitVec2 box2d::UnitVec2::GetBottom ( )
inlinestaticnoexcept

◆ GetDefaultFallback()

static constexpr UnitVec2 box2d::UnitVec2::GetDefaultFallback ( )
inlinestaticnoexcept

◆ GetFwdPerpendicular()

constexpr UnitVec2 box2d::UnitVec2::GetFwdPerpendicular ( ) const
inlinenoexcept

Gets a vector clockwise (forward-clockwise) perpendicular to this vector.

This returns the unit vector (y, -x).

Returns
A clockwise 90-degree rotation of this vector.
See also
GetRevPerpendicular.

◆ GetLeft()

static constexpr UnitVec2 box2d::UnitVec2::GetLeft ( )
inlinestaticnoexcept

◆ GetRevPerpendicular()

constexpr UnitVec2 box2d::UnitVec2::GetRevPerpendicular ( ) const
inlinenoexcept

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

This returns the unit vector (-y, x).

Returns
A counter-clockwise 90-degree rotation of this vector.
See also
GetFwdPerpendicular.

◆ GetRight()

static constexpr UnitVec2 box2d::UnitVec2::GetRight ( )
inlinestaticnoexcept

◆ GetTop()

static constexpr UnitVec2 box2d::UnitVec2::GetTop ( )
inlinestaticnoexcept

◆ GetX()

constexpr auto box2d::UnitVec2::GetX ( ) const
inlinenoexcept

◆ GetY()

constexpr auto box2d::UnitVec2::GetY ( ) const
inlinenoexcept

◆ GetZero()

static constexpr UnitVec2 box2d::UnitVec2::GetZero ( )
inlinestaticnoexcept

◆ operator+()

constexpr UnitVec2 box2d::UnitVec2::operator+ ( ) const
inlinenoexcept

◆ operator-()

constexpr UnitVec2 box2d::UnitVec2::operator- ( ) const
inlinenoexcept

◆ Rotate()

constexpr UnitVec2 box2d::UnitVec2::Rotate ( UnitVec2  amount) const
inlinenoexcept

◆ sin()

constexpr auto box2d::UnitVec2::sin ( ) const
inlinenoexcept

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