diff options
| author | Thomas Guillermo Albers Raviola <thomas@thomaslabs.org> | 2026-01-16 23:02:32 +0100 |
|---|---|---|
| committer | Thomas Guillermo Albers Raviola <thomas@thomaslabs.org> | 2026-01-16 23:02:32 +0100 |
| commit | 6b8af9cf83851c075c6c9514b1deaa931c2b19a4 (patch) | |
| tree | 428986b49c32e21d3f7a3c2dfa41858ae0153209 /09-september/tomcat/math/vector.h | |
Initial commit
Diffstat (limited to '09-september/tomcat/math/vector.h')
| -rw-r--r-- | 09-september/tomcat/math/vector.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/09-september/tomcat/math/vector.h b/09-september/tomcat/math/vector.h new file mode 100644 index 0000000..173fc11 --- /dev/null +++ b/09-september/tomcat/math/vector.h @@ -0,0 +1,47 @@ +#ifndef VECTOR4F_H +#define VECTOR4F_H + +#include <GL/glew.h> + +typedef struct _Vec4 +{ + GLfloat x, y, z, w; +} Vec4; + +extern Vec4 vec4_add(const Vec4 *a, const Vec4 *b); +extern Vec4 vec4_sub(const Vec4 *a, const Vec4 *b); +extern Vec4 vec4_scalar_mul(const Vec4 *a, GLfloat scalar); +extern GLfloat vec4_dot_mul(const Vec4 *a, const Vec4 *b); +extern GLfloat vec4_length(Vec4 *a); +extern GLfloat vec4_length2(Vec4 *a); +extern Vec4 vec4_normalize(Vec4 *a); + +typedef struct _Vec3 +{ + GLfloat x, y, z; +} Vec3; + +extern Vec3 vec3_add(const Vec3 *a, const Vec3 *b); +extern Vec3 vec3_sub(const Vec3 *a, const Vec3 *b); +extern Vec3 vec3_scalar_mul(const Vec3 *a, GLfloat scalar); +extern GLfloat vec3_dot_mul(const Vec3 *a, const Vec3 *b); +extern Vec3 vec3_cross_mul(const Vec3 *a, const Vec3 *b); +extern GLfloat vec3_length(Vec3 *a); +extern GLfloat vec3_length2(Vec3 *a); +extern Vec3 vec3_normalize(Vec3 *a); + +typedef struct _Vec2 +{ + GLfloat x, y; +} Vec2; + +extern Vec2 vec2_add(const Vec2 *a, const Vec2 *b); +extern Vec2 vec2_sub(const Vec2 *a, const Vec2 *b); +extern Vec2 vec2_scalar_mul(const Vec2 *a, GLfloat scalar); +extern GLfloat vec2_dot_mul(const Vec2 *a, const Vec2 *b); +extern Vec2 vec2_cross_mul(const Vec2 *a, const Vec2 *b); +extern GLfloat vec2_length(Vec2 *a); +extern GLfloat vec2_length2(Vec2 *a); +extern Vec2 vec2_normalize(Vec2 *a); + +#endif // VECTOR4F_H |
