soo
3D game math library
Loading...
Searching...
No Matches
soo

Deploy Document
Unit Test (Windows, MSVC)
Unit Test (macOS, AppleClang) Unit Test (macOS, clang)

soo is a simple 3D math library that provides essential features for game programming.

Features

  • 3D Vector
    soo::Vector3<double> vec1{1.0, 2.0, 3.0};
    soo::Vector3d vec2{3.0, 4.0, 5.0}; // Vector3d is the type alias for Vector3<double>.
    double dotProduct = vec1.dot(vec2);
    soo::Vector3d crossProduct = vec1.cross(vec2);
    vec1.normalize();
    3D vector class.
    Definition vector3.h:22
    T dot(const Vector3 &rhs) const noexcept
    Definition vector3.h:190
    void normalize()
    Definition vector3.h:165
    Vector3 cross(const Vector3 &rhs) const noexcept
    Definition vector3.h:198
    Vector3< double > Vector3d
    Definition vector3.h:228
  • Arbitrary-size Matrix
    // 2 X 3 Matrix
    {1, 2, 3},
    {4, 5, 6}
    };
    {7, 8},
    {9, 10},
    {11, 12}
    };
    auto mult = mat1 * mat2; // mult is a 2 X 2 matrix.
    auto transposed = mat1.transpose(); // transposed is a 3 X 2 matrix.
    // Vector multiplication is only available in 4 X 4 matrix (Affine transformation)
    soo::Vector3d vec1{1, 2, 3};
    soo::Matrix4d mat3{ // Matrix4d is the type alias for Matrix<double, 4, 4>.
    {0, -1, 0, 10},
    {1, 0, 0, 20},
    {0, 0, 1, 30},
    {0, 0, 0, 1}
    };
    auto transformed = mat3 * vec1;
    Matrix class.
    Definition matrix.h:21
    Matrix< T, Col, Row > transpose() const noexcept
    Definition matrix.h:265

Usage

  1. Copy include/soo directory to your project, then add its path to the include path.
  2. include header as below:
    #include "soo/soo.h"

Refer documentation for the implementation details.