template<typename T>
bpf::math::Transform2 class

Template parameters
T the type of number

Utility to represent a transformation in 2D space

Public types

class MatrixBuilder

Constructors, destructors, conversion operators

Transform2(const Vector2<T>& pos = Vector2<T>::Zero, const Vector2<T>& scale = Vector2<T>::Identity, const T& rotation = 0) explicit

Public functions

auto LocalToWorld(const Vector2<T>& local) -> Vector2<T>
auto WorldToLocal(const Vector2<T>& world) -> Vector2<T>
auto ToMatrix() const -> Matrix3<T> noexcept
void RotateArround(const Vector2<T>& pivot, const T& rotation)
auto operator+(const Transform2& other) const -> Transform2 noexcept
void operator+=(const Transform2& other)

Public variables

Vector2<T> Position
Vector2<T> Scale
T Rotation

Function documentation

template<typename T>
bpf::math::Transform2<T>::Transform2(const Vector2<T>& pos = Vector2<T>::Zero, const Vector2<T>& scale = Vector2<T>::Identity, const T& rotation = 0) explicit

Parameters
pos transform position
scale transform scale
rotation transform rotation

Constructs a 2D transform

template<typename T>
Vector2<T> bpf::math::Transform2<T>::LocalToWorld(const Vector2<T>& local)

Parameters
local 2D point to transform
Returns new transformed 2D point

Transforms a point

template<typename T>
Vector2<T> bpf::math::Transform2<T>::WorldToLocal(const Vector2<T>& world)

Parameters
world 2D point to revert transformation
Returns new de-transformed 2D point

Revert transformation from a point

template<typename T>
Matrix3<T> bpf::math::Transform2<T>::ToMatrix() const noexcept

Returns order 3 square matrix

Computes the matrix of this transform

template<typename T>
void bpf::math::Transform2<T>::RotateArround(const Vector2<T>& pivot, const T& rotation)

Parameters
pivot rotation origin
rotation angle in radians

Rotates this transform around a point

template<typename T>
Transform2 bpf::math::Transform2<T>::operator+(const Transform2& other) const noexcept

Parameters
other transform to add
Returns new transform

Adds two transforms

template<typename T>
void bpf::math::Transform2<T>::operator+=(const Transform2& other)

Parameters
other transform to add

Adds a transform to this transform

Variable documentation

template<typename T>
Vector2<T> bpf::math::Transform2<T>::Position

Transform position

template<typename T>
Vector2<T> bpf::math::Transform2<T>::Scale

Transform scale

template<typename T>
T bpf::math::Transform2<T>::Rotation

Transform rotation