40#define R_DEG 182.04444443623349541909523793743f
41#define R_RAD 10430.37835f
59 return fipr(vec1.
x, vec1.
y, vec1.
z, 0.0f,
60 vec2.
x, vec2.
y, vec2.
z, 0.0f);
102 return (
vec3f_t){ vec.
x * factor, vec.
y * factor, vec.
z * factor };
131 float c = cosf(angle);
132 float s = sinf(angle);
135 origin.
x + (vec.
x - origin.
x) * c - (vec.
y - origin.
y) * s,
136 origin.
y + (vec.
x - origin.
x) * s + (vec.
y - origin.
y) * c,
151 float c = cosf(angle);
152 float s = sinf(angle);
155 origin.
x + (vec.
x - origin.
x) * c - (vec.
z - origin.
z) * s,
157 origin.
z + (vec.
x - origin.
x) * s + (vec.
z - origin.
z) * c,
171 float c = cosf(angle);
172 float s = sinf(angle);
176 origin.
y + (vec.
y - origin.
y) * c + (vec.
z - origin.
z) * s,
177 origin.
z + (vec.
y - origin.
y) * s + (vec.
z - origin.
z) * c,
191 return vec_rotr_xy(vec, origin, angle * R_DEG / R_RAD);
204 return vec_rotr_xz(vec, origin, angle * R_DEG / R_RAD);
217 return vec_rotr_yz(vec, origin, angle * R_DEG / R_RAD);
222#define vec3f_dot(x1, y1, z1, x2, y2, z2, w) \
223 w = vec_dot((vec3f_t){ x1, y1, z1 }, (vec3f_t){ x2, y2, z2 })
225#define vec3f_length(x, y, z, w) \
226 w = vec_length((vec3f_t){ x, y, z })
228#define vec3f_distance(x1, y1, z1, x2, y2, z2, w) \
229 w = vec_distance((vec3f_t){ x1, y1, z1 }, (vec3f_t){ x2, y2, z2 })
231#define vec3f_normalize(__x, __y, __z) { \
232 vec3f_t vec = vec_normalize((vec3f_t){ __x, __y, __z }); \
233 __x = vec.x; __y = vec.y; __z = vec.z; \
236#define vec3f_sub_normalize(x1, y1, z1, x2, y2, z2, x3, y3, z3) { \
237 vec3f_t vec = vec_sub_normalize((vec3f_t){ x1, y1, z1 }, (vec3f_t){ x2, y2, z2 }); \
238 x3 = vec.x; y3 = vec.y; z3 = vec.z; \
241#define vec3f_rotr_xy(px, py, pz, cx, cy, cz, r) { \
242 vec3f_t vec = vec_rotr_xy((vec3f_t){ px, py, pz }, (vec3f_t){ cx, cy, cz }, r); \
243 px = vec.x; py = vec.y; pz = vec.z; \
246#define vec3f_rotr_xz(px, py, pz, cx, cy, cz, r) { \
247 vec3f_t vec = vec_rotr_xz((vec3f_t){ px, py, pz }, (vec3f_t){ cx, cy, cz }, r); \
248 px = vec.x; py = vec.y; pz = vec.z; \
251#define vec3f_rotr_yz(px, py, pz, cx, cy, cz, r) { \
252 vec3f_t vec = vec_rotr_yz((vec3f_t){ px, py, pz }, (vec3f_t){ cx, cy, cz }, r); \
253 px = vec.x; py = vec.y; pz = vec.z; \
256#define vec3f_rotd_xy(px, py, pz, cx, cy, cz, r) \
257 vec3f_rotr_xy(px, py, pz, cx, cy, cz, (r) * R_DEG / R_RAD)
259#define vec3f_rotd_xz(px, py, pz, cx, cy, cz, r) \
260 vec3f_rotr_xz(px, py, pz, cx, cy, cz, (r) * R_DEG / R_RAD)
262#define vec3f_rotd_yz(px, py, pz, cx, cy, cz, r) \
263 vec3f_rotr_yz(px, py, pz, cx, cy, cz, (r) * R_DEG / R_RAD)
Inline functions for the DC's special math instructions.
__FMINLINE float fipr_magnitude_sqr(float x, float y, float z, float w)
Floating point inner product w/self (square of vector magnitude)
Definition fmath.h:58
__FMINLINE float fipr(float x, float y, float z, float w, float a, float b, float c, float d)
Floating point inner product.
Definition fmath.h:49
static float vec_fipr(vec3f_t vec)
Definition vec3f.h:44
static float vec_length(vec3f_t vec)
Macro to return scalar Euclidean length of a 3d vector.
Definition vec3f.h:72
static vec3f_t vec_rotd_xz(vec3f_t vec, vec3f_t origin, float angle)
Macro to rotate a vector about its origin on the x, z plane.
Definition vec3f.h:203
static vec3f_t vec_rotr_yz(vec3f_t vec, vec3f_t origin, float angle)
Macro to rotate a vector about its origin on the y, z plane.
Definition vec3f.h:170
static vec3f_t vec_rotr_xy(vec3f_t vec, vec3f_t origin, float angle)
Macro to rotate a vector about its origin on the x, y plane.
Definition vec3f.h:130
static float vec_dot(vec3f_t vec1, vec3f_t vec2)
Function to return the scalar dot product of two 3d vectors.
Definition vec3f.h:58
static vec3f_t vec_normalize(vec3f_t vec)
Function to return the normalized version of a vector.
Definition vec3f.h:100
static vec3f_t vec_sub_normalize(vec3f_t vec1, vec3f_t vec2)
Function to return the normalized version of a vector minus another vector.
Definition vec3f.h:115
static vec3f_t vec_rotd_xy(vec3f_t vec, vec3f_t origin, float angle)
Macro to rotate a vector about its origin on the x, y plane.
Definition vec3f.h:190
static float vec_distance(vec3f_t vec1, vec3f_t vec2)
Function to return the Euclidean distance between two 3d vectors.
Definition vec3f.h:86
static vec3f_t vec_rotr_xz(vec3f_t vec, vec3f_t origin, float angle)
Macro to rotate a vector about its origin on the x, z plane.
Definition vec3f.h:150
static vec3f_t vec_rotd_yz(vec3f_t vec, vec3f_t origin, float angle)
Macro to rotate a vector about its origin on the y, z plane.
Definition vec3f.h:216
Prototypes for optimized math functions written in ASM.
3D floating-point vector
Definition vec3f.h:35
float y
Definition vec3f.h:36
float x
Definition vec3f.h:36
float z
Definition vec3f.h:36