ivan0sokin / IOMath

IOMath is a simple header-only cross-platform math library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status License Latest Release

IOMath

About

IOMath is a fast header-only cross-platform math library. It's architecture is similar to GLM.

Using

Example:

#include <IOMath/Vectors.hpp>
#include <IOMath/Matrices.hpp>
using namespace IOMath;

constexpr unsigned SCREEN_WIDTH = 1920;
constexpr unsigned SCREEN_HEIGHT = 1080;

int main(int, char**)
{
    Matrix4 modelMatrix = Matrix4::Identity();    
    Translate(modelMatrix, Vector3(1.0f, 2.0f, 3.0f));
    Scale(modelMatrix, Vector3(3.0f, 3.0f, 1.5f));
    Rotate(modelMatrix, Vector3(1.0f, 0.0f, 0.0f), Radians(45.0f));

    Matrix4 viewMatrix = LookAtMatrix(Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, -1.0f), Vector3(0.0f, 1.0f, 0.0f));

    Matrix4 projectionMatrix = PerspectiveMatrix(90.0f, static_cast<float>(SCREEN_WIDTH) / SCREEN_HEIGHT, 0.1f, 1000.0f);

    Vector3 vertexPosition = Vector3(0.5f, -0.5f, 0.5f);
    Vector4 spacePosition = projectionMatrix * viewMatrix * modelMatrix * Vector4(vertexPosition, 0.0f);

    return 0;
}

Tests

To run test type followind in the command line:

cd tests/
cmake . -Wno-dev && cmake --build .
ctest --output-on-failure

Dependecies

Boost (only for testing)

License

IOMath is licensed under the MIT license.

About

IOMath is a simple header-only cross-platform math library.

License:MIT License


Languages

Language:C++ 99.9%Language:CMake 0.1%