SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::Math Namespace Reference

Vectors, matrices, quaternions, colors, AABBs, and random helpers. More...

Classes

struct  AABB
class  Color
class  Matrix
class  Quaternion
 Represents a quaternion for 3D rotations. More...
class  Random
 A class for generating random numbers and values. More...
class  Vector
class  Vector2D
class  Vector3D
class  Vector4D

Typedefs

using Matrix4 = Matrix<float, 4, 4>

Functions

template<typename T>
constexpr const T & Clamp (const T &value, T min, T max)
 Clamps value into [min, max].
template<typename T>
constexpr const T & Clamp (const T &value, Vector2D range)
 Clamps value into [range.x, range.y].
template<typename T>
constexpr T Lerp (const T &start, const T &end, float t)
 Linear interpolation from start to end; t is clamped to [0,1].
template<typename T>
constexpr const T & Max (const T &value1, const T &value2)
template<typename T>
constexpr const T & Min (const T &value1, const T &value2)
Vector3D operator* (const Quaternion &quat, const Vector3D &vec)
template<typename T, size_t N>
Vector< T, N > operator* (T scalar, const Vector< T, N > &vec)

Detailed Description

Vectors, matrices, quaternions, colors, AABBs, and random helpers.

Vector2D, Vector3D, and Vector4D are the value types nearly every other engine API accepts. Matrix4 uses the row-vector convention: a point is transformed as clip = point * viewProj.

Typedef Documentation

◆ Matrix4

using Sleak::Math::Matrix4 = Matrix<float, 4, 4>

Definition at line 413 of file Matrix.hpp.

Function Documentation

◆ Clamp() [1/2]

template<typename T>
const T & Sleak::Math::Clamp ( const T & value,
T min,
T max )
constexpr

Clamps value into [min, max].

Definition at line 15 of file Math.hpp.

◆ Clamp() [2/2]

template<typename T>
const T & Sleak::Math::Clamp ( const T & value,
Vector2D range )
constexpr

Clamps value into [range.x, range.y].

Definition at line 21 of file Math.hpp.

◆ Lerp()

template<typename T>
T Sleak::Math::Lerp ( const T & start,
const T & end,
float t )
constexpr

Linear interpolation from start to end; t is clamped to [0,1].

Definition at line 37 of file Math.hpp.

◆ Max()

template<typename T>
const T & Sleak::Math::Max ( const T & value1,
const T & value2 )
constexpr

Definition at line 31 of file Math.hpp.

◆ Min()

template<typename T>
const T & Sleak::Math::Min ( const T & value1,
const T & value2 )
constexpr

Definition at line 26 of file Math.hpp.

◆ operator*() [1/2]

Vector3D Sleak::Math::operator* ( const Quaternion & quat,
const Vector3D & vec )

Definition at line 181 of file Quaternion.cpp.

◆ operator*() [2/2]

template<typename T, size_t N>
Vector< T, N > Sleak::Math::operator* ( T scalar,
const Vector< T, N > & vec )

Definition at line 648 of file Vector.hpp.