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
| Type | Header | Components | Key Operations |
|---|---|---|---|
Vector2 | System/Numerics/Vector2.hpp | X, Y (float) | +, -, *, /, Dot, Normalize, Lerp, Clamp, Distance, Length, Zero, One, UnitX, UnitY |
Vector3 | System/Numerics/Vector3.hpp | X, Y, Z (float) | +, -, *, /, Dot, Cross, Normalize, Lerp, Zero, One, UnitX, UnitY, UnitZ, Forward, Up |
Vector4 | System/Numerics/Vector4.hpp | X, 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
| Type | Header | Description |
|---|---|---|
Matrix3x2 | System/Numerics/Matrix3x2.hpp | 2D transform matrix (3x2 floats) |
Matrix4x4 | System/Numerics/Matrix4x4.hpp | 4x4 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
| Type | Header | Key Operations |
|---|---|---|
Quaternion | System/Numerics/Quaternion.hpp | Slerp, CreateFromAxisAngle, CreateFromYawPitchRoll, CreateFromRotationMatrix, Conjugate, Inverse, Normalize, Dot, Identity |
Plane | System/Numerics/Plane.hpp | CreateFromVertices, Dot, DotCoordinate, DotNormal, Normalize, Transform |
BigInteger
include/System/Numerics/BigInteger.hpp | src/System/Numerics/BigInteger.cpp
Status: Done
Arbitrary-precision integer arithmetic:
- +, -, *, /, % operators
TryParse(string, BigInteger&)ToString()- Comparison operators
- Uses Knuth Algorithm D for division
Other Numeric Types
| Type | Header | Description |
|---|---|---|
Complex | System/Numerics/Complex.hpp | Complex number (real, imaginary) |
BFloat16 | System/Numerics/BFloat16.hpp | Brain floating-point 16-bit |
BitOperations | System/Numerics/BitOperations.hpp | PopCount, LeadingZeroCount, TrailingZeroCount, Log2, etc. |
DivisionRounding | System/Numerics/DivisionRounding.hpp | Integer division rounding modes |
Colors (System::Numerics::Colors)
| Type | Header | Description |
|---|---|---|
Argb | System/Numerics/Colors/Argb.hpp | ARGB 32-bit color |
Rgba | System/Numerics/Colors/Rgba.hpp | RGBA 32-bit color |
Colors | System/Numerics/Colors/Colors.hpp | Named color constants |
Math Utilities
| Type | Header | Description |
|---|---|---|
System::Math | System/Math.hpp | Abs, Sin, Cos, Sqrt, Pow, Floor, Ceiling, Round, Max, Min, PI, E, etc. |
System::MathF | System/MathF.hpp | Same as Math but for float |