Numerics Module

Vectors, matrices, quaternions, BigInteger, and color types.

Overview

The System::Numerics namespace provides hardware-agnostic math types used by game engines and 3D graphics. All types are header-only value types.

Status: Done for all vector/matrix types.

Vector Types

TypeHeaderComponentsKey Operations
Vector2System/Numerics/Vector2.hppX, Y (float)+, -, *, /, Dot, Normalize, Lerp, Clamp, Distance, Length, Zero, One, UnitX, UnitY
Vector3System/Numerics/Vector3.hppX, Y, Z (float)+, -, *, /, Dot, Cross, Normalize, Lerp, Zero, One, UnitX, UnitY, UnitZ, Forward, Up
Vector4System/Numerics/Vector4.hppX, Y, Z, W (float)+, -, *, /, Dot, Normalize, Lerp, Zero, One
using namespace System::Numerics;

Vector2 a(1.0f, 0.0f);
Vector2 b(0.0f, 1.0f);
float dot = Vector2::Dot(a, b);     // 0.0
Vector2 lerp = Vector2::Lerp(a, b, 0.5f);  // (0.5, 0.5)
float len = a.Length();              // 1.0

Matrix Types

TypeHeaderDescription
Matrix3x2System/Numerics/Matrix3x2.hpp2D transform matrix (3x2 floats)
Matrix4x4System/Numerics/Matrix4x4.hpp4x4 transform matrix; full transforms, Invert, Identity, CreateTranslation, CreateRotation, CreateScale, CreatePerspective, CreateLookAt
using namespace System::Numerics;

Matrix4x4 translate = Matrix4x4::CreateTranslation(1.0f, 2.0f, 3.0f);
Matrix4x4 rotate = Matrix4x4::CreateRotationY(3.14159f / 4.0f);
Matrix4x4 combined = translate * rotate;

Matrix4x4 inv;
bool ok = Matrix4x4::Invert(combined, inv);

Rotation

TypeHeaderKey Operations
QuaternionSystem/Numerics/Quaternion.hppSlerp, CreateFromAxisAngle, CreateFromYawPitchRoll, CreateFromRotationMatrix, Conjugate, Inverse, Normalize, Dot, Identity
PlaneSystem/Numerics/Plane.hppCreateFromVertices, Dot, DotCoordinate, DotNormal, Normalize, Transform

BigInteger

include/System/Numerics/BigInteger.hpp | src/System/Numerics/BigInteger.cpp

Status: Done

Arbitrary-precision integer arithmetic:

Other Numeric Types

TypeHeaderDescription
ComplexSystem/Numerics/Complex.hppComplex number (real, imaginary)
BFloat16System/Numerics/BFloat16.hppBrain floating-point 16-bit
BitOperationsSystem/Numerics/BitOperations.hppPopCount, LeadingZeroCount, TrailingZeroCount, Log2, etc.
DivisionRoundingSystem/Numerics/DivisionRounding.hppInteger division rounding modes

Colors (System::Numerics::Colors)

TypeHeaderDescription
ArgbSystem/Numerics/Colors/Argb.hppARGB 32-bit color
RgbaSystem/Numerics/Colors/Rgba.hppRGBA 32-bit color
ColorsSystem/Numerics/Colors/Colors.hppNamed color constants

Math Utilities

TypeHeaderDescription
System::MathSystem/Math.hppAbs, Sin, Cos, Sqrt, Pow, Floor, Ceiling, Round, Max, Min, PI, E, etc.
System::MathFSystem/MathF.hppSame as Math but for float