feat: add vec4 functions

This commit is contained in:
2025-06-11 17:26:41 +02:00
parent 8e26c51370
commit e853d6d456
5 changed files with 140 additions and 71 deletions

View File

@@ -2,10 +2,19 @@
#include "math/vec4.h"
int main(void)
{
Vec4f_t vec = vec4(1.f, 2, 3, 4);
float vec_array[4] = {1, 2, 3, 4};
vec4f_add_r(&vec, vec4f_from_array(vec_array));
printf("%f\n", vec.data[1]);
}
{
Vec4f_t vec = vec4(1.f, 2.f, 8.f, 4.f);
printf("%f %f %f %f\n", vec.x, vec.y, vec.z, vec.w);
Vec4f_t vec2 = vec4f_clone(&vec);
printf("%f %f %f %f\n", vec2.x, vec2.y, vec2.z, vec2.w);
Vec4f_t vec3 = vec4f_add(vec, vec2);
printf("%f %f %f %f\n", vec3.x, vec3.y, vec3.z, vec3.w);
Vec4f_t vec4 = vec4f_sub(vec, vec3);
printf("%f %f %f %f\n", vec4.x, vec4.y, vec4.z, vec4.w);
Vec4f_t vec5 = vec4f_scale(vec4, 5.f);
printf("%f %f %f %f\n", vec5.x, vec5.y, vec5.z, vec5.w);
}