Skip to content

Latest commit

 

History

233 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

math equations in c++

Vector2

  • A lightweight, header-only C++ class for handling 2D vectors. This class provides the basic functions to understand how the Vector2 class works with basic functions like distance and distance squared to dot product and similar

Quick Test

#include <iostream>
#include "vector2.hpp"

using vec2 = geom::Vector2;

inline void test_length()
{
    vec2 test_vec(3.0f, 4.0f);
    println("Test Length");
    print
    (
      "x: {:2.2f}\n" 
      "y: {:2.2f}\n"
      test_vec.x, test_vec.y
    );
    println("Length: {}", test_vec.length());
    println("Length Squared: {}", test_vec.length_squared());
}

int main()
{
    test_length();
    return 0;
}

compile and run

g++ -Wall -Wextra -Wpedantic -std=c++23 test_vector2.cpp -o run && ./run

Vector3

  • A lightweight, header-only C++ class for handling 3D vectors. This class provides the basic functions to understand how the Vector3 class works with basic functions like distance and distance squared to dot product and similar

Quick Test

#include <print>
#include <format>
#include "vector3.hpp"

inline void test_length()
{
    vec3 test_vec(3.0f, 4.0f, 1.0f);
    println("Test Length");
    print
    (
      "x: {:2.2f}\n" 
      "y: {:2.2f}\n"
      "z: {:2.2f}\n", 
      test_vec.x, test_vec.y, test_vec.z
    );
    println("Length: {}", test_vec.length());
    println("Length Squared: {}", test_vec.length_squared());
}

int main()
{
    test_length();
    return 0;
}

compile and run

g++ -Wall -Wextra -Wpedantic -std=c++23 test_vector3.cpp -o run && ./run

About

An educational Math library written in C++, made to learn real math equations, and how to use them.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages