C++ Mathematics library for Computer Graphics.
Documentation for nml is available here.
git clone https://github.com/Team-Nutshell/nml.git
This example has nml inside an external
directory:
add_subdirectory(external/nml)
target_include_directories(${PROJECT_NAME} PUBLIC external/nml)
target_link_libraries(${PROJECT_NAME} PUBLIC nml)
Examples with vec2
:
#include "external/nml/include/vec2.h"
#include "external/nml/include/vec3.h"
#include "external/nml/include/vec4.h"
int main() {
nml::vec2 i(1.0f, 2.0f); // Create a 2D vector with values x = 1.0 and y = 2.0
i = nml::normalize(i); // Get a normalized vector
nml::vec2 n(0.0f, -1.0f);
nml::vec2 r = nml::reflect(i, n); // Calculate the reflection direction from the incident vector i and the normal n
}