Files
ASCIIRenderer/include/vec3.h

34 lines
682 B
C

#ifndef ASCII3D_VEC3_H
#define ASCII3D_VEC3_H
#ifdef __cplusplus
extern "C" {
#endif
// A standard 3-component float vector
typedef struct Vec3 {
float x;
float y;
float z;
} Vec3;
Vec3 vec3_create(float x, float y, float z);
Vec3 vec3_add(Vec3 a, Vec3 b);
Vec3 vec3_sub(Vec3 a, Vec3 b);
Vec3 vec3_scale(Vec3 v, float s);
float vec3_dot(Vec3 a, Vec3 b);
Vec3 vec3_cross(Vec3 a, Vec3 b);
float vec3_length(Vec3 v);
Vec3 vec3_normalize(Vec3 v);
// Rotating points through standard Euler coordinate transformations
Vec3 vec3_rotate_x(Vec3 v, float angle);
Vec3 vec3_rotate_y(Vec3 v, float angle);
Vec3 vec3_rotate_z(Vec3 v, float angle);
#ifdef __cplusplus
}
#endif
#endif