Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Types | Public Member Functions | Public Attributes | List of all members
box2d::Vector2D< TYPE > Struct Template Reference

Vector 2D. More...

#include <Vec2.hpp>

Public Types

using size_type = size_t
 
using data_type = TYPE
 

Public Member Functions

 Vector2D ()=default
 Default constructor does nothing (for performance). More...
 
 Vector2D (const Vector2D &copy)=default
 
constexpr Vector2D (data_type x_, data_type y_) noexcept
 Construct using coordinates. More...
 
constexpr auto operator- () const noexcept
 Negate this vector. More...
 
constexpr size_type max_size () const noexcept
 Maximum size. More...
 
auto operator[] (size_type i) const
 Accesses element by index. More...
 
auto & operator[] (size_type i)
 Accesses element by index. More...
 

Public Attributes

data_type x
 
data_type y
 

Detailed Description

template<typename TYPE>
struct box2d::Vector2D< TYPE >

Vector 2D.

Member Typedef Documentation

◆ data_type

template<typename TYPE>
using box2d::Vector2D< TYPE >::data_type = TYPE

◆ size_type

template<typename TYPE>
using box2d::Vector2D< TYPE >::size_type = size_t

Constructor & Destructor Documentation

◆ Vector2D() [1/3]

template<typename TYPE>
box2d::Vector2D< TYPE >::Vector2D ( )
default

Default constructor does nothing (for performance).

◆ Vector2D() [2/3]

template<typename TYPE>
box2d::Vector2D< TYPE >::Vector2D ( const Vector2D< TYPE > &  copy)
default

◆ Vector2D() [3/3]

template<typename TYPE>
constexpr box2d::Vector2D< TYPE >::Vector2D ( data_type  x_,
data_type  y_ 
)
inlinenoexcept

Construct using coordinates.

Member Function Documentation

◆ max_size()

template<typename TYPE>
constexpr size_type box2d::Vector2D< TYPE >::max_size ( ) const
inlinenoexcept

Maximum size.

This is this vector type's dimensionality.

◆ operator-()

template<typename TYPE>
constexpr auto box2d::Vector2D< TYPE >::operator- ( ) const
inlinenoexcept

Negate this vector.

◆ operator[]() [1/2]

template<typename TYPE>
auto box2d::Vector2D< TYPE >::operator[] ( size_type  i) const
inline

Accesses element by index.

Parameters
iIndex (0 for x, 1 for y).

◆ operator[]() [2/2]

template<typename TYPE>
auto& box2d::Vector2D< TYPE >::operator[] ( size_type  i)
inline

Accesses element by index.

Parameters
iIndex (0 for x, 1 for y).

Member Data Documentation

◆ x

template<typename TYPE>
data_type box2d::Vector2D< TYPE >::x

◆ y

template<typename TYPE>
data_type box2d::Vector2D< TYPE >::y

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