From 175f5cbc68fc076eb3893959faee12cfb28baf83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Sat, 15 Mar 2025 20:52:38 +0100 Subject: [PATCH] feat(vector3): added documentation for a few basic functions. --- include/math/vector3.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/math/vector3.h b/include/math/vector3.h index 21f7119..1dd373d 100644 --- a/include/math/vector3.h +++ b/include/math/vector3.h @@ -15,11 +15,51 @@ typedef struct { */ Vec3* vec3(float x, float y, float z); +/** + * @brief Adds two 3D vectors in a new 3D vector. + * @param v1 First vector. + * @param v2 Second vector. + * @return A pointer to a newly allocated 3D vector + * representing the sum of v1 and v2. + */ Vec3* vec3Add(Vec3* v1, Vec3* v2); + +/** + * @brief Subtracts two 3D vectors in a new 3D + * vector. + * @param v1 First vector. + * @param v2 Second vector. + * @return A pointer to a newly allocated 3D vector + * representing the subtraction of v1 and v2. + */ Vec3* vec3Sub(Vec3* v1, Vec3* v2); + +/** + * @brief Scales a 3D vector by a constant scalar in a + * new 3D vector. + * @param v 3D vector. + * @param scalar Constant. + * @return A pointer to a newly allocated 3D vector + * representing the multiplication of v1 and a + * scalar. + */ Vec3* vec3Scale(Vec3* v, float scalar); +/** + * @brief Computes the dot product of two 3D vectors + * @param a First vector. + * @param b Second vector. + * @return The dot product of a and b as a scalar value + */ float vec3Dot(Vec3* a, Vec3* b); + +/** + * @brief Computes the Length (magnitude) of a 3D + * vector + * @param v The 3D vector. + * @return The length (magnitude) of the vector v as a + * scalar value. + */ float vec3Len(Vec3* v); Vec3* vec3Norm(Vec3* v);