ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
vector2.hpp File Reference

2D vector for game math and physics. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  toy::math::Vector2< T >
 2D vector with floating-point or fixed-point components for positions, movement, and physics. More...

Namespaces

namespace  toy
 Root namespace containing all engine modules.
namespace  toy::math
 Mathematical types, constants, and utilities: fixed-point, vectors, point.

Concepts

concept  toy::math::Vector2Component
 Concept satisfied when T is a component type allowed as toy::math::Vector2 template parameter.

Functions

template<Vector2Component T>
 toy::math::Vector2 (const T &, const T &) -> Vector2< T >
 Deduction guide: enables Vector2(x, y) without an explicit template argument when both arguments have the same toy::math::Vector2Component type.
template<Vector2Component T>
constexpr Vector2< T > toy::math::operator- (const Vector2< T > &vector) noexcept
 Unary minus: negated components.
template<Vector2Component T>
constexpr Vector2< T > toy::math::operator+ (const Vector2< T > &left, const Vector2< T > &right) noexcept
 Addition of two vectors.
template<Vector2Component T>
constexpr Vector2< T > toy::math::operator- (const Vector2< T > &left, const Vector2< T > &right) noexcept
 Subtraction of two vectors.
template<Vector2Component T>
constexpr Vector2< T > toy::math::operator* (const Vector2< T > &left, const T &right) noexcept
 Vector scaled by scalar.
template<Vector2Component T>
constexpr Vector2< T > toy::math::operator* (const T &left, const Vector2< T > &right) noexcept
 Vector scaled by scalar (scalar on the left).
template<Vector2Component T>
constexpr T toy::math::operator* (const Vector2< T > &left, const Vector2< T > &right) noexcept
 Dot product of two vectors.
template<Vector2Component T>
constexpr Vector2< T > toy::math::operator/ (const Vector2< T > &left, const T &right) noexcept
 Vector divided by scalar.
template<Vector2Component T>
constexpr bool toy::math::operator== (const Vector2< T > &left, const Vector2< T > &right) noexcept
 Exact equality of two vectors.
template<Vector2Component T>
constexpr bool toy::math::operator!= (const Vector2< T > &left, const Vector2< T > &right) noexcept
 Inequality of two vectors.
template<Vector2Component T>
constexpr T toy::math::cross (const Vector2< T > &left, const Vector2< T > &right) noexcept
 2D cross product (scalar result).

Detailed Description

2D vector for game math and physics.

Defines toy::math::Vector2.

Note
Included by math.hpp; do not include this file directly.