KallistiOS
##version##
|
Basic matrix operations. More...
#include <sys/cdefs.h>
Go to the source code of this file.
Data Structures | |
struct | vec3f |
Macros | |
#define | R_DEG 182.04444443623349541909523793743 |
#define | R_RAD 10430.37835 |
#define | vec3f_dot(x1, y1, z1, x2, y2, z2, w) |
Macro to return the scalar dot product of two 3d vectors. More... | |
#define | vec3f_length(x, y, z, w) |
Macro to return scalar Euclidean length of a 3d vector. More... | |
#define | vec3f_distance(x1, y1, z1, x2, y2, z2, w) |
Macro to return the Euclidean distance between two 3d vectors. More... | |
#define | vec3f_normalize(x, y, z) |
Macro to return the normalized version of a vector. More... | |
#define | vec3f_sub_normalize(x1, y1, z1, x2, y2, z2, x3, y3, z3) |
Macro to return the normalized version of a vector minus another vector. More... | |
#define | vec3f_rotr_xy(px, py, pz, cx, cy, cz, r) |
Macro to rotate a vector about its origin on the x, y plane. More... | |
#define | vec3f_rotr_xz(px, py, pz, cx, cy, cz, r) |
Macro to rotate a vector about its origin on the x, z plane. More... | |
#define | vec3f_rotr_yz(px, py, pz, cx, cy, cz, r) |
Macro to rotate a vector about its origin on the y, z plane. More... | |
#define | vec3f_rotd_xy(px, py, pz, cx, cy, cz, r) |
Macro to rotate a vector about its origin on the x, y plane. More... | |
#define | vec3f_rotd_xz(px, py, pz, cx, cy, cz, r) |
Macro to rotate a vector about its origin on the x, z plane. More... | |
#define | vec3f_rotd_yz(px, py, pz, cx, cy, cz, r) |
Macro to rotate a vector about its origin on the y, z plane. More... | |
Typedefs | |
typedef struct vec3f | vec3f_t |
Basic matrix operations.
This file contains various basic vector math functionality for using the SH4's vector instructions. Higher level functionality in KGL is built off of these.
#define R_DEG 182.04444443623349541909523793743 |
#define R_RAD 10430.37835 |
#define vec3f_distance | ( | x1, | |
y1, | |||
z1, | |||
x2, | |||
y2, | |||
z2, | |||
w | |||
) |
Macro to return the Euclidean distance between two 3d vectors.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions, and returns a single-precision floating-point value.
x1 | The X coordinate of first vector. |
y1 | The Y coordinate of first vector. |
z1 | The Z coordinate of first vector. |
x2 | The X coordinate of second vector. |
y2 | The Y coordinate of second vector. |
z2 | The Z coordinate of second vector. |
w | The result of the calculation. |
#define vec3f_dot | ( | x1, | |
y1, | |||
z1, | |||
x2, | |||
y2, | |||
z2, | |||
w | |||
) |
Macro to return the scalar dot product of two 3d vectors.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions, and returns a single-precision floating-point value.
x1 | The X coordinate of first vector. |
y1 | The Y coordinate of first vector. |
z1 | The Z coordinate of first vector. |
x2 | The X coordinate of second vector. |
y2 | The Y coordinate of second vector. |
z2 | The Z coordinate of second vector. |
w | The result of the calculation. |
#define vec3f_length | ( | x, | |
y, | |||
z, | |||
w | |||
) |
Macro to return scalar Euclidean length of a 3d vector.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions, and returns a single-precision floating-point value.
x | The X coordinate of vector. |
y | The Y coordinate of vector. |
z | The Z coordinate of vector. |
w | The result of the calculation. |
#define vec3f_normalize | ( | x, | |
y, | |||
z | |||
) |
Macro to return the normalized version of a vector.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions to calculate a vector that is in the same direction as the input vector but with a Euclidean length of one. The input vector is modified by the operation as the resulting values.
x | The X coordinate of vector. |
y | The Y coordinate of vector. |
z | The Z coordinate of vector. |
#define vec3f_rotd_xy | ( | px, | |
py, | |||
pz, | |||
cx, | |||
cy, | |||
cz, | |||
r | |||
) |
Macro to rotate a vector about its origin on the x, y plane.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the first vertex parameter: x1, y1, and z1.
px | The X coordinate of vector to rotate. |
py | The Y coordinate of vector to rotate. |
pz | The Z coordinate of vector to rotate. |
cx | The X coordinate of origin vector. |
cy | The Y coordinate of origin vector. |
cz | The Z coordinate of origin vector. |
r | The angle (in degrees) of rotation. |
#define vec3f_rotd_xz | ( | px, | |
py, | |||
pz, | |||
cx, | |||
cy, | |||
cz, | |||
r | |||
) |
Macro to rotate a vector about its origin on the x, z plane.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the first vertex parameter: x1, y1, and z1.
px | The X coordinate of vector to rotate. |
py | The Y coordinate of vector to rotate. |
pz | The Z coordinate of vector to rotate. |
cx | The X coordinate of origin vector. |
cy | The Y coordinate of origin vector. |
cz | The Z coordinate of origin vector. |
r | The angle (in degrees) of rotation. |
#define vec3f_rotd_yz | ( | px, | |
py, | |||
pz, | |||
cx, | |||
cy, | |||
cz, | |||
r | |||
) |
Macro to rotate a vector about its origin on the y, z plane.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the first vertex parameter: x1, y1, and z1.
px | The X coordinate of vector to rotate. |
py | The Y coordinate of vector to rotate. |
pz | The Z coordinate of vector to rotate. |
cx | The X coordinate of origin vector. |
cy | The Y coordinate of origin vector. |
cz | The Z coordinate of origin vector. |
r | The angle (in degrees) of rotation. |
#define vec3f_rotr_xy | ( | px, | |
py, | |||
pz, | |||
cx, | |||
cy, | |||
cz, | |||
r | |||
) |
Macro to rotate a vector about its origin on the x, y plane.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the first vertex parameter: x1, y1, and z1.
px | The X coordinate of vector to rotate. |
py | The Y coordinate of vector to rotate. |
pz | The Z coordinate of vector to rotate. |
cx | The X coordinate of origin vector. |
cy | The Y coordinate of origin vector. |
cz | The Z coordinate of origin vector. |
r | The angle (in radians) of rotation. |
#define vec3f_rotr_xz | ( | px, | |
py, | |||
pz, | |||
cx, | |||
cy, | |||
cz, | |||
r | |||
) |
Macro to rotate a vector about its origin on the x, z plane.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the first vertex parameter: x1, y1, and z1.
px | The X coordinate of vector to rotate. |
py | The Y coordinate of vector to rotate. |
pz | The Z coordinate of vector to rotate. |
cx | The X coordinate of origin vector. |
cy | The Y coordinate of origin vector. |
cz | The Z coordinate of origin vector. |
r | The angle (in radians) of rotation. |
#define vec3f_rotr_yz | ( | px, | |
py, | |||
pz, | |||
cx, | |||
cy, | |||
cz, | |||
r | |||
) |
Macro to rotate a vector about its origin on the y, z plane.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the first vertex parameter: x1, y1, and z1.
px | The X coordinate of vector to rotate. |
py | The Y coordinate of vector to rotate. |
pz | The Z coordinate of vector to rotate. |
cx | The X coordinate of origin vector. |
cy | The Y coordinate of origin vector. |
cz | The Z coordinate of origin vector. |
r | The angle (in radians) of rotation. |
#define vec3f_sub_normalize | ( | x1, | |
y1, | |||
z1, | |||
x2, | |||
y2, | |||
z2, | |||
x3, | |||
y3, | |||
z3 | |||
) |
Macro to return the normalized version of a vector minus another vector.
This macro is an inline assembly operation using the SH4's fast (approximate) math instructions. The return vector is stored into the third vertex parameter: x3, y3, and z3.
x1 | The X coordinate of first vector. |
y1 | The Y coordinate of first vector. |
z1 | The Z coordinate of first vector. |
x2 | The X coordinate of second vector. |
y2 | The Y coordinate of second vector. |
z2 | The Z coordinate of second vector. |
x3 | The X coordinate of output vector. |
y3 | The Y coordinate of output vector. |
z3 | The Z coordinate of output vector. |