From a47cc44ef7191d03f8ca1b8d4e6b9dd34fba1807 Mon Sep 17 00:00:00 2001 From: realtradam Date: Fri, 16 Jun 2023 01:18:13 -0400 Subject: matrix math wrapper as well as various refactors for consistant and cleaner code --- include/rodeo/math/vec2.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/rodeo/math/vec2.h (limited to 'include/rodeo/math/vec2.h') diff --git a/include/rodeo/math/vec2.h b/include/rodeo/math/vec2.h new file mode 100644 index 0000000..88d524f --- /dev/null +++ b/include/rodeo/math/vec2.h @@ -0,0 +1,53 @@ +#pragma once + +// -- internal -- +// public +#include "rodeo/math/vec2_t.h" + +rodeo_math_vec2_t +rodeo_math_vec2_zero(void); + +rodeo_math_vec2_t +rodeo_math_vec2_one(void); + +float +rodeo_math_vec2_dot(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +float +rodeo_math_vec2_cross(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +rodeo_math_vec2_t +rodeo_math_vec2_add(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +rodeo_math_vec2_t +rodeo_math_vec2_subtract(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +rodeo_math_vec2_t +rodeo_math_vec2_multiply(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +rodeo_math_vec2_t +rodeo_math_vec2_scale(rodeo_math_vec2_t a, float b); + +rodeo_math_vec2_t +rodeo_math_vec2_divide(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +rodeo_math_vec2_t +rodeo_math_vec2_negate(rodeo_math_vec2_t a); + +rodeo_math_vec2_t +rodeo_math_vec2_normalize(rodeo_math_vec2_t a); + +rodeo_math_vec2_t +rodeo_math_vec2_rotate(rodeo_math_vec2_t a, float turns); + +float +rodeo_math_vec2_distance(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +float +rodeo_math_vec2_distanceSq(rodeo_math_vec2_t a, rodeo_math_vec2_t b); + +rodeo_math_vec2_t +rodeo_math_vec2_clamp(rodeo_math_vec2_t a, float minimum, float maximum); + +rodeo_math_vec2_t +rodeo_math_vec2_lerp(rodeo_math_vec2_t from, rodeo_math_vec2_t to, float t); -- cgit v1.2.3