diff options
author | jvech <jmvalenciae@unal.edu.co> | 2022-08-25 21:39:11 -0500 |
---|---|---|
committer | jvech <jmvalenciae@unal.edu.co> | 2022-08-25 21:39:11 -0500 |
commit | 3b24a477cf566296aa758058aaca96cf0c117141 (patch) | |
tree | f89b1e37d47edaff6b33968d26620e51923a8722 /src/linear.h | |
parent | 3bad7358dc55a969aec23bb5a5932c072d4beedd (diff) |
feat: linear library implemented
Diffstat (limited to 'src/linear.h')
-rw-r--r-- | src/linear.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/linear.h b/src/linear.h index e69de29..86b93d7 100644 --- a/src/linear.h +++ b/src/linear.h @@ -0,0 +1,38 @@ +#ifndef __LINEAR__ +#define __LINEAR__ + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +typedef struct { + float matrix[4][4]; +} mat4; + +typedef struct { + float vector[3]; +} vec3; + +mat4 linearTranslatev(vec3 translate_vector); //TODO +mat4 linearScalev(vec3 scale_vector); //TODO +mat4 linearTranslate(float translate_x, float translate_y, float translate_z); +mat4 linearScale(float scale_x, float scale_y, float scale_z); +mat4 linearRotate(float degree, vec3 rotation_axis); +mat4 linearPerspective(float FoV, float ratio, float near, float far); +mat4 linearLookAt(vec3 position, vec3 target, vec3 up); + +mat4 linearMat4Fill(float value); +mat4 linearMat4Identity(); +mat4 linearMat4Mul(mat4 x1, mat4 x2); +mat4 linearMat4Transpose(mat4 x); +mat4 linearMat4Inv(mat4 x); //TODO +mat4 linearMat4Add(mat4 x1, mat4 x2); //TODO +float linearMat4Det(mat4 x); //TODO + +vec3 linearVec3(float x, float y, float z); +vec3 linearVec3Normalize(vec3 vector); +vec3 linearVec3Add(vec3 vector1, vec3 vector2); +vec3 linearVec3ScalarMulp(vec3 vector, float scalar); +vec3 linearVec3CrossProduct(vec3 vector1, vec3 vector2); +float linearVec3DotProduct(vec3 vector1, vec3 vector2); +#endif |