![]() |
Jo Engine
2024.04.28
Jo Sega Saturn Engine
|
Jo Engine Math tools. More...
Go to the source code of this file.
Macros | |
#define | JO_PI |
PI value. More... | |
#define | JO_PI_2 |
PI/2 value. More... | |
#define | JO_MULT_BY_2(X) |
Multiply a variable by 2. More... | |
#define | JO_MULT_BY_4(X) |
Multiply a variable by 4. More... | |
#define | JO_MULT_BY_8(X) |
Multiply a variable by 8. More... | |
#define | JO_MULT_BY_16(X) |
Multiply a variable by 16. More... | |
#define | JO_MULT_BY_32(X) |
Multiply a variable by 32. More... | |
#define | JO_MULT_BY_64(X) |
Multiply a variable by 64. More... | |
#define | JO_MULT_BY_128(X) |
Multiply a variable by 128. More... | |
#define | JO_MULT_BY_256(X) |
Multiply a variable by 256. More... | |
#define | JO_MULT_BY_1024(X) |
Multiply a variable by 1024. More... | |
#define | JO_MULT_BY_2048(X) |
Multiply a variable by 2048. More... | |
#define | JO_MULT_BY_4096(X) |
Multiply a variable by 4096. More... | |
#define | JO_MULT_BY_32768(X) |
Multiply a variable by 32768. More... | |
#define | JO_MULT_BY_65536(X) |
Multiply a variable by 65536. More... | |
#define | JO_DIV_BY_2(X) |
Devide a variable by 2. More... | |
#define | JO_DIV_BY_4(X) |
Devide a variable by 4. More... | |
#define | JO_DIV_BY_8(X) |
Devide a variable by 8. More... | |
#define | JO_DIV_BY_16(X) |
Devide a variable by 16. More... | |
#define | JO_DIV_BY_32(X) |
Devide a variable by 32. More... | |
#define | JO_DIV_BY_64(X) |
Devide a variable by 64. More... | |
#define | JO_DIV_BY_1024(X) |
Devide a variable by 1024. More... | |
#define | JO_DIV_BY_32768(X) |
Devide a variable by 32768. More... | |
#define | JO_DIV_BY_65536(X) |
Devide a variable by 65536. More... | |
#define | JO_DIV_BY_2147483648(X) |
Devide a variable by 2147483648. More... | |
#define | JO_ZERO(X) |
Set a variable to zero. More... | |
#define | JO_MOD_POW2(N, M) |
Fast modulo of a power of 2. More... | |
#define | JO_ABS(X) |
Get the absolute value of X. More... | |
#define | JO_FABS(X) |
Get the absolute value of X. More... | |
#define | JO_MIN(A, B) |
Get the smaller value between A and B. More... | |
#define | JO_MAX(A, B) |
Get the bigger value between A and B. More... | |
#define | JO_CHANGE_SIGN(X) |
Change the sign of X. More... | |
#define | JO_FLOAT_EPSILON |
Float minimum positive value. More... | |
#define | JO_FLOAT_NEARLY_EQUALS(A, B) |
Check if A and B is nearly the same value. More... | |
#define | JO_IS_FLOAT_NULL(A) |
Check if A nearly equals zero. More... | |
#define | JO_RAD_TO_DEG(A) |
Convert radians to degrees. More... | |
#define | JO_DEG_TO_RAD(A) |
Convert degrees to radians. More... | |
#define | JO_IS_ODD(A) |
Check if A is odd. More... | |
#define | JO_SWAP(A, B) |
Swap A and B values. More... | |
#define | JO_PERCENT_USED(TOTAL, FREE) |
Compute percent (100 / TOTAL * (TOTAL - FREE)) More... | |
#define | JO_SQUARE(A) |
Square computation (x²) More... | |
#define | JO_BCD_INT(BCD) |
BCD to integer. More... | |
#define | JO_SET_FLAGS(BYTEFIELD, FLAGS) |
Set flags in bytefield. More... | |
#define | JO_SET_ALL_FLAGS(BYTEFIELD) |
Set all flags in bytefield. More... | |
#define | JO_ADD_FLAG(BYTEFIELD, FLAG) |
Add flag in bytefield. More... | |
#define | JO_REMOVE_FLAG(BYTEFIELD, FLAG) |
Remove flag in bytefield. More... | |
#define | JO_REMOVE_ALL_FLAGS(BYTEFIELD) |
Remove all flags in bytefield. More... | |
#define | JO_HAS_FLAG(BYTEFIELD, FLAG) |
Check if flag is checked in bytefield. More... | |
#define | JO_FIXED_0 |
Fixed floating point value for 0. More... | |
#define | JO_FIXED_1_DIV_2 |
Fixed floating point value for 0.5. More... | |
#define | JO_FIXED_1 |
Fixed floating point value for 1. More... | |
#define | JO_FIXED_2 |
Fixed floating point value for 2. More... | |
#define | JO_FIXED_4 |
Fixed floating point value for 4. More... | |
#define | JO_FIXED_8 |
Fixed floating point value for 8. More... | |
#define | JO_FIXED_16 |
Fixed floating point value for 16. More... | |
#define | JO_FIXED_32 |
Fixed floating point value for 32. More... | |
#define | JO_FIXED_120 |
Fixed floating point value for 120. More... | |
#define | JO_FIXED_150 |
Fixed floating point value for 150. More... | |
#define | JO_FIXED_180 |
Fixed floating point value for 180. More... | |
#define | JO_FIXED_360 |
Fixed floating point value for 360. More... | |
#define | JO_FIXED_MIN |
Fixed floating point value for -32767.99998. More... | |
#define | JO_FIXED_MAX |
Fixed floating point value for +32767.99998. More... | |
#define | JO_FIXED_EPSILON |
Jo Fixed minimum positive value. More... | |
#define | JO_FIXED_OVERFLOW |
Indicate an overflow error. More... | |
#define | JO_FIXED_PI |
Fixed value of PI. More... | |
#define | JO_FIXED_PI_2 |
Fixed value of 2 PI. More... | |
#define | JO_FIXED_180_DIV_PI |
Fixed value of 180/PI. More... | |
#define | JO_FIXED_PI_DIV_180 |
Fixed value of PI/180. More... | |
#define | JO_FIXED_PI_DIV_2 |
Fixed value of PI/2. More... | |
#define | JO_FIXED_1_DIV |
Fixed value of 1/65536. More... | |
#define | JO_INT_TO_FIXED(X) |
Convert int to jo_fixed. More... | |
#define | JO_FIXED_TO_INT(X) |
Convert jo_fixed to int. More... | |
#define | __JO_DEG_TO_ANGLE_MAGIC |
See https://github.com/johannes-fetz/joengine/issues/42. More... | |
Functions | |
static __jo_force_inline jo_fixed | jo_int2fixed (const int x) |
Convert int to jo engine fixed. More... | |
static __jo_force_inline int | jo_fixed2int (const jo_fixed x) |
Convert jo engine fixed to int. More... | |
static __jo_force_inline jo_fixed | jo_float2fixed (const float x) |
Convert float to jo engine fixed (avoid usage of GCC Soft Float) More... | |
static __jo_force_inline float | jo_fixed2float (const jo_fixed x) |
Convert jo engine fixed to float. More... | |
static __jo_force_inline jo_fixed | jo_fixed_wrap_to_pi (jo_fixed rad) |
Wrap rad in [−pi pi]. More... | |
static __jo_force_inline jo_fixed | jo_fixed_wrap_to_180 (jo_fixed deg) |
Wrap deg in [-180 180]. More... | |
jo_fixed | jo_fixed_pow (jo_fixed x, jo_fixed y) |
x raised to the power of the integer part of y More... | |
jo_fixed | jo_fixed_mult (jo_fixed x, jo_fixed y) |
Multiply to fixed number. More... | |
jo_fixed | jo_fixed_dot (jo_fixed ptA[3], jo_fixed ptB[3]) |
Dot product two fixed 3D points. More... | |
jo_fixed | jo_fixed_div (jo_fixed dividend, jo_fixed divisor) |
Divide fixed-point numbers (expresses dividend / divisor) More... | |
static __jo_force_inline jo_fixed | jo_fixed_deg2rad (const jo_fixed deg) |
Convert fixed degree to fixed radian. More... | |
static __jo_force_inline jo_fixed | jo_fixed_rad2deg (const jo_fixed rad) |
Convert fixed radian to fixed degree. More... | |
static __jo_force_inline jo_fixed | jo_fixed_ceil (const jo_fixed x) |
Returns the smallest (fixed) integer value greater than or equal to x. More... | |
static __jo_force_inline jo_fixed | jo_fixed_floor (const jo_fixed x) |
Returns the largest (fixed) integer value less than or equal to x. More... | |
int | jo_random (int max) |
Get a random number. More... | |
static __jo_force_inline int | jo_random_using_multiple (int max, int multiple) |
Get a random number with a specific multiple. More... | |
jo_fixed | jo_fixed_sqrt (jo_fixed value) |
Fast Square root using fixed number. More... | |
unsigned int | jo_sqrt (unsigned int value) |
Fast square root. More... | |
static __jo_force_inline float | jo_sqrtf (float value) |
Fast Square root using floating number. More... | |
jo_fixed | jo_fixed_rsqrt (jo_fixed value) |
Fast Reciprocal Square root using fixed number. More... | |
float | jo_rsqrt (float value) |
Fast Reciprocal Square root using floating number. More... | |
static __jo_force_inline ANGLE | jo_DEGtoANG (const float deg) |
Replacement for DEGtoANG using floating number. More... | |
static __jo_force_inline ANGLE | jo_DEGtoANG_int (const int deg) |
Replacement for DEGtoANG using interger. More... | |
static __jo_force_inline ANGLE | jo_fixed_rad2ANGLE (const jo_fixed rad) |
Convert fixed radian to SGL ANGLE. More... | |
static __jo_force_inline ANGLE | jo_fixed_deg2ANGLE (const jo_fixed deg) |
Convert fixed degree to SGL ANGLE. More... | |
jo_fixed | jo_fixed_sin (jo_fixed rad) |
Fast sinus computation using fixed number. More... | |
static __jo_force_inline jo_fixed | jo_sin (const int deg) |
Fast sinus computation. More... | |
static __jo_force_inline float | jo_sinf (const int deg) |
Sinus computation. More... | |
static __jo_force_inline jo_fixed | jo_sin_rad (const float rad) |
Sinus computation. More... | |
static __jo_force_inline float | jo_sin_radf (const float rad) |
Sinus computation. More... | |
static __jo_force_inline int | jo_sin_mult (const int value, const int deg) |
Fast sinus multiplication. More... | |
static __jo_force_inline float | jo_sinf_mult (const float value, const int deg) |
Fast sinus multiplication. More... | |
jo_fixed | jo_fixed_cos (jo_fixed rad) |
Fast cosinus computation using fixed number. More... | |
static __jo_force_inline jo_fixed | jo_cos (const int deg) |
Fast cosinus computation. More... | |
static __jo_force_inline float | jo_cosf (const int deg) |
Cosinus computation. More... | |
static __jo_force_inline jo_fixed | jo_cos_rad (const float rad) |
Cosinus computation. More... | |
static __jo_force_inline float | jo_cos_radf (const float rad) |
Cosinus computation. More... | |
static __jo_force_inline int | jo_cos_mult (const int value, const int deg) |
Fast cosinus multiplication. More... | |
static __jo_force_inline float | jo_cosf_mult (const float value, const int deg) |
Fast cosinus multiplication. More... | |
static __jo_force_inline jo_fixed | jo_tan (const int deg) |
Fast tangent computation. More... | |
static __jo_force_inline float | jo_tanf (const float deg) |
Tangent computation. More... | |
static __jo_force_inline jo_fixed | jo_tan_rad (const float rad) |
Tangent computation. More... | |
static __jo_force_inline float | jo_tan_radf (const float rad) |
Tangent computation. More... | |
static __jo_force_inline float | jo_acos_radf (const float angle) |
Fast Arc Cosinus computation. More... | |
float | jo_atan2f_rad (const float y, const float x) |
Fast ATAN2 computation in radian. More... | |
static __jo_force_inline int | jo_atan2f (const float y, const float x) |
Fast ATAN2 computation in degree. More... | |
void | jo_vector_fixed_compute_bezier_point (const jo_fixed t, jo_vector_fixed p0, jo_vector_fixed p1, jo_vector_fixed p2, jo_vector_fixed p3, jo_vector_fixed *result) |
Compute cubic bezier curve point for vectors (using fixed numbers) More... | |
static __jo_force_inline void | jo_vector_fixed_add (const jo_vector_fixed *const a, const jo_vector_fixed *const b, jo_vector_fixed *const result) |
Add 2 vectors (using fixed numbers) More... | |
static __jo_force_inline void | jo_vector_fixed_muls (const jo_vector_fixed *const a, const jo_fixed s, jo_vector_fixed *const result) |
Multiply value to vector (using fixed numbers) More... | |
static __jo_force_inline void | jo_vector4_fixed_add (const jo_vector4_fixed *const a, const jo_vector4_fixed *const b, jo_vector4_fixed *const result) |
Add 2 vectors4 (using fixed numbers) More... | |
static __jo_force_inline void | jo_vector4_fixed_sub (const jo_vector4_fixed *const a, const jo_vector4_fixed *const b, jo_vector4_fixed *const result) |
Substract 2 vectors4 (using fixed numbers) More... | |
static __jo_force_inline void | jo_vector4_fixed_cross (const jo_vector4_fixed *const a, const jo_vector4_fixed *const b, jo_vector4_fixed *const result) |
Cross product of 2 vectors4 (using fixed numbers) More... | |
static __jo_force_inline jo_fixed | jo_vector4_fixed_dot (const jo_vector4_fixed *const a, const jo_vector4_fixed *const b) |
Dot product of 2 vectors4 (using fixed numbers) More... | |
static __jo_force_inline void | jo_vector4_swap (jo_vector4_fixed *const a, jo_vector4_fixed *const b) |
Dot product of 2 vectors4 (using fixed numbers) More... | |
void | jo_vectorf_compute_bezier_point (const float t, jo_vectorf p0, jo_vectorf p1, jo_vectorf p2, jo_vectorf p3, jo_vectorf *result) |
Compute cubic bezier curve point for vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_add (const jo_vectorf *const a, const jo_vectorf *const b, jo_vectorf *const result) |
Add 2 vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_adds (const jo_vectorf *const a, const float s, jo_vectorf *const result) |
Add value to vector (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_sub (const jo_vectorf *const a, const jo_vectorf *const b, jo_vectorf *const result) |
Subtract 2 vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_subs (const jo_vectorf *const a, const float s, jo_vectorf *const result) |
Subtract value to vector (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_mul (const jo_vectorf *const a, const jo_vectorf *const b, jo_vectorf *const result) |
Multiply 2 vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_muls (const jo_vectorf *const a, const float s, jo_vectorf *const result) |
Multiply value to vector (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_div (const jo_vectorf *const a, const jo_vectorf *const b, jo_vectorf *const result) |
Divide 2 vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_divs (const jo_vectorf *const a, const float s, jo_vectorf *const result) |
Divide value to vector (using floating numbers) More... | |
static __jo_force_inline float | jo_vectorf_length (const jo_vectorf *const a) |
Get the length of a vector (using floating numbers) More... | |
static __jo_force_inline float | jo_vectorf_dot (const jo_vectorf *const a, const jo_vectorf *const b) |
Get the dot product of 2 vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_normalize (const jo_vectorf *const a, jo_vectorf *const result) |
Normalize a vector (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_proj (const jo_vectorf *const v, const jo_vectorf *const onto, jo_vectorf *const result) |
Compute projection vector (using floating numbers) More... | |
static __jo_force_inline void | jo_vectorf_cross (const jo_vectorf *const a, const jo_vectorf *const b, jo_vectorf *const result) |
Cross 2 vectors (using floating numbers) More... | |
static __jo_force_inline float | jo_vectorf_angle_between_radf (const jo_vectorf *const a, const jo_vectorf *const b) |
Get the angle between 2 vectors (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_identity (jo_matrix *const result) |
Creates the identity matrix (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_identity (jo_matrixf *const result) |
Creates the identity matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_translation (const jo_vector_fixed *const offset, jo_matrix *const result) |
Creates translation matrix (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_translation (const jo_vectorf *const offset, jo_matrixf *const result) |
Creates translation matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_scaling (const jo_vector_fixed *const scale, jo_matrix *const result) |
Creates scaling matrix (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_scaling (const jo_vectorf *const scale, jo_matrixf *const result) |
Creates scaling matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_rotation_x_rad (const float angle_in_rad, jo_matrix *const result) |
Creates rotating matrix (X axis) (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_rotation_x_rad (const float angle_in_rad, jo_matrixf *const result) |
Creates rotating matrix (X axis) (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_rotation_y_rad (const float angle_in_rad, jo_matrix *const result) |
Creates rotating matrix (Y axis) (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_rotation_y_rad (const float angle_in_rad, jo_matrixf *const result) |
Creates rotating matrix (Y axis) (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_rotation_z_rad (const float angle_in_rad, jo_matrix *const result) |
Creates rotating matrix (Z axis) (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_rotation_z_rad (const float angle_in_rad, jo_matrixf *const result) |
Creates rotating matrix (Z axis) (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_transpose (const jo_matrix *const matrix, jo_matrix *const result) |
Creates transpose matrix (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_transpose (const jo_matrixf *const matrix, jo_matrixf *const result) |
Creates transpose matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrix_mul_vector4 (const jo_matrix *const m, const jo_vector4_fixed *const v, jo_vector4_fixed *const result) |
Multiply a matrix by a vector4 (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrix_mul (const jo_matrix *const a, const jo_matrix *const b, jo_matrix *const result) |
Multiply 2 matrix (using fixed numbers) More... | |
static __jo_force_inline void | jo_matrixf_mul (const jo_matrixf *const a, const jo_matrixf *const b, jo_matrixf *const result) |
Multiply 2 matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_rotation (const float angle_in_rad, const jo_vectorf *const axis, jo_matrixf *const result) |
Creates a matrix to rotate around an axis by a given angle in radiant (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_ortho (const float left, const float right, const float bottom, const float top, const float back, const float front, jo_matrixf *const result) |
Creates an orthographic projection matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_perspective (const float vertical_field_of_view_in_deg, const float aspect_ratio, const float near_view_distance, const float far_view_distance, jo_matrixf *const result) |
Creates a perspective projection matrix for a camera (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_look_at (const jo_vectorf *const from, const jo_vectorf *const to, const jo_vectorf *const up, jo_matrixf *const result) |
Builds a transformation matrix for a camera (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_invert_affine (const jo_matrixf *const matrix, jo_matrixf *const result) |
Inverts an affine transformation matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_mul_pos (const jo_matrixf *const matrix, const jo_vectorf *const position, jo_vectorf *const result) |
Multiplies a 4x4 matrix with a 3D vector representing a point in 3D space (using floating numbers) More... | |
static __jo_force_inline void | jo_matrixf_mul_dir (const jo_matrixf *const matrix, const jo_vectorf *const direction, jo_vectorf *const result) |
Multiplies a 4x4 matrix with a 3D vector representing a direction in 3D space (using floating numbers) More... | |
static __jo_force_inline jo_fixed | jo_lerp (const jo_fixed v0, const jo_fixed v1, const jo_fixed t) |
Linear interpolation which guarantees v = v1 when t = 1. More... | |
static __jo_force_inline bool | jo_is_float_equals_zero (const float f) |
Check if float almost equals 0. More... | |
static __jo_force_inline bool | jo_square_intersect (const int x1, const int y1, const int w1, const int h1, const int x2, const int y2, const int w2, const int h2) |
Fast method to get if two square intersects (HitBox processing) More... | |
int | jo_gcd (int a, int b) |
Get the greatest common divisor. More... | |
void | jo_planar_rotate (const jo_pos2D *const point, const jo_pos2D *const origin, const int angle, jo_pos2D *const result) |
Rotate a point on the plan with a specific origin. More... | |
static __jo_force_inline short | jo_direction_to_angle (const jo_8_directions direction) |
Convert jo_8_directions to angle in degree. More... | |
Variables | |
int | jo_random_seed |
Get or set current random seed. More... | |
#define __JO_DEG_TO_ANGLE_MAGIC |
#define JO_ABS | ( | X | ) |
Get the absolute value of X.
X | Variable name |
#define JO_ADD_FLAG | ( | BYTEFIELD, | |
FLAG | |||
) |
Add flag in bytefield.
BYTEFIELD | Bytefield |
FLAG | Flag |
#define JO_BCD_INT | ( | BCD | ) |
BCD to integer.
BCD | BCD |
#define JO_CHANGE_SIGN | ( | X | ) |
Change the sign of X.
X | Variable name |
#define JO_DEG_TO_RAD | ( | A | ) |
Convert degrees to radians.
A | operand |
#define JO_DIV_BY_1024 | ( | X | ) |
Devide a variable by 1024.
X | Variable name |
#define JO_DIV_BY_16 | ( | X | ) |
Devide a variable by 16.
X | Variable name |
#define JO_DIV_BY_2 | ( | X | ) |
Devide a variable by 2.
X | Variable name |
#define JO_DIV_BY_2147483648 | ( | X | ) |
Devide a variable by 2147483648.
X | Variable name |
#define JO_DIV_BY_32 | ( | X | ) |
Devide a variable by 32.
X | Variable name |
#define JO_DIV_BY_32768 | ( | X | ) |
Devide a variable by 32768.
X | Variable name |
#define JO_DIV_BY_4 | ( | X | ) |
Devide a variable by 4.
X | Variable name |
#define JO_DIV_BY_64 | ( | X | ) |
Devide a variable by 64.
X | Variable name |
#define JO_DIV_BY_65536 | ( | X | ) |
Devide a variable by 65536.
X | Variable name |
#define JO_DIV_BY_8 | ( | X | ) |
Devide a variable by 8.
X | Variable name |
#define JO_FABS | ( | X | ) |
Get the absolute value of X.
X | Variable name |
#define JO_FIXED_0 |
Fixed floating point value for 0.
#define JO_FIXED_1 |
Fixed floating point value for 1.
#define JO_FIXED_120 |
Fixed floating point value for 120.
#define JO_FIXED_150 |
Fixed floating point value for 150.
#define JO_FIXED_16 |
Fixed floating point value for 16.
#define JO_FIXED_180 |
Fixed floating point value for 180.
#define JO_FIXED_180_DIV_PI |
Fixed value of 180/PI.
#define JO_FIXED_1_DIV |
Fixed value of 1/65536.
#define JO_FIXED_1_DIV_2 |
Fixed floating point value for 0.5.
#define JO_FIXED_2 |
Fixed floating point value for 2.
#define JO_FIXED_32 |
Fixed floating point value for 32.
#define JO_FIXED_360 |
Fixed floating point value for 360.
#define JO_FIXED_4 |
Fixed floating point value for 4.
#define JO_FIXED_8 |
Fixed floating point value for 8.
#define JO_FIXED_EPSILON |
Jo Fixed minimum positive value.
#define JO_FIXED_MAX |
Fixed floating point value for +32767.99998.
#define JO_FIXED_MIN |
Fixed floating point value for -32767.99998.
#define JO_FIXED_OVERFLOW |
Indicate an overflow error.
#define JO_FIXED_PI |
Fixed value of PI.
#define JO_FIXED_PI_2 |
Fixed value of 2 PI.
#define JO_FIXED_PI_DIV_180 |
Fixed value of PI/180.
#define JO_FIXED_PI_DIV_2 |
Fixed value of PI/2.
#define JO_FIXED_TO_INT | ( | X | ) |
Convert jo_fixed to int.
X | operand |
#define JO_FLOAT_EPSILON |
Float minimum positive value.
#define JO_FLOAT_NEARLY_EQUALS | ( | A, | |
B | |||
) |
Check if A and B is nearly the same value.
A | First operand |
B | Second operand |
#define JO_HAS_FLAG | ( | BYTEFIELD, | |
FLAG | |||
) |
Check if flag is checked in bytefield.
BYTEFIELD | Bytefield |
FLAG | Flag |
#define JO_INT_TO_FIXED | ( | X | ) |
Convert int to jo_fixed.
X | operand |
#define JO_IS_FLOAT_NULL | ( | A | ) |
Check if A nearly equals zero.
A | operand |
#define JO_IS_ODD | ( | A | ) |
Check if A is odd.
A | operand |
#define JO_MAX | ( | A, | |
B | |||
) |
Get the bigger value between A and B.
A | First operand |
B | Second operand |
#define JO_MIN | ( | A, | |
B | |||
) |
Get the smaller value between A and B.
A | First operand |
B | Second operand |
#define JO_MOD_POW2 | ( | N, | |
M | |||
) |
Fast modulo of a power of 2.
N | Number |
M | Modulo |
#define JO_MULT_BY_1024 | ( | X | ) |
Multiply a variable by 1024.
X | Variable name |
#define JO_MULT_BY_128 | ( | X | ) |
Multiply a variable by 128.
X | Variable name |
#define JO_MULT_BY_16 | ( | X | ) |
Multiply a variable by 16.
X | Variable name |
#define JO_MULT_BY_2 | ( | X | ) |
Multiply a variable by 2.
X | Variable name |
#define JO_MULT_BY_2048 | ( | X | ) |
Multiply a variable by 2048.
X | Variable name |
#define JO_MULT_BY_256 | ( | X | ) |
Multiply a variable by 256.
X | Variable name |
#define JO_MULT_BY_32 | ( | X | ) |
Multiply a variable by 32.
X | Variable name |
#define JO_MULT_BY_32768 | ( | X | ) |
Multiply a variable by 32768.
X | Variable name |
#define JO_MULT_BY_4 | ( | X | ) |
Multiply a variable by 4.
X | Variable name |
#define JO_MULT_BY_4096 | ( | X | ) |
Multiply a variable by 4096.
X | Variable name |
#define JO_MULT_BY_64 | ( | X | ) |
Multiply a variable by 64.
X | Variable name |
#define JO_MULT_BY_65536 | ( | X | ) |
Multiply a variable by 65536.
X | Variable name |
#define JO_MULT_BY_8 | ( | X | ) |
Multiply a variable by 8.
X | Variable name |
#define JO_PERCENT_USED | ( | TOTAL, | |
FREE | |||
) |
Compute percent (100 / TOTAL * (TOTAL - FREE))
TOTAL | Total |
FREE | Free |
#define JO_PI |
PI value.
#define JO_PI_2 |
PI/2 value.
#define JO_RAD_TO_DEG | ( | A | ) |
Convert radians to degrees.
A | operand |
#define JO_REMOVE_ALL_FLAGS | ( | BYTEFIELD | ) |
Remove all flags in bytefield.
BYTEFIELD | Bytefield |
#define JO_REMOVE_FLAG | ( | BYTEFIELD, | |
FLAG | |||
) |
Remove flag in bytefield.
BYTEFIELD | Bytefield |
FLAG | Flag |
#define JO_SET_ALL_FLAGS | ( | BYTEFIELD | ) |
Set all flags in bytefield.
BYTEFIELD | Bytefield |
#define JO_SET_FLAGS | ( | BYTEFIELD, | |
FLAGS | |||
) |
Set flags in bytefield.
BYTEFIELD | Bytefield |
FLAGS | Flags |
#define JO_SQUARE | ( | A | ) |
Square computation (x²)
A | operand |
#define JO_SWAP | ( | A, | |
B | |||
) |
Swap A and B values.
A | operand |
B | operand |
#define JO_ZERO | ( | X | ) |
Set a variable to zero.
X | Variable name |
|
static |
Fast Arc Cosinus computation.
angle | Angle in radian |
|
static |
Fast ATAN2 computation in degree.
y | First value |
x | Second value |
float jo_atan2f_rad | ( | const float | y, |
const float | x | ||
) |
Fast ATAN2 computation in radian.
y | First value |
x | Second value |
|
static |
Fast cosinus computation.
deg | Angle in degree |
|
static |
Fast cosinus multiplication.
deg | Angle in degree |
value | Value |
|
static |
Cosinus computation.
rad | Angle in radian |
|
static |
Cosinus computation.
rad | Angle in radian |
|
static |
Cosinus computation.
deg | Angle in degree |
|
static |
Fast cosinus multiplication.
deg | Angle in degree |
value | Value |
|
static |
Replacement for DEGtoANG using floating number.
deg | Degree |
|
static |
Replacement for DEGtoANG using interger.
deg | Degree |
|
static |
Convert jo_8_directions to angle in degree.
direction | Direction |
|
static |
Convert jo engine fixed to float.
x | Fixed to convert |
|
static |
Convert jo engine fixed to int.
x | Fixed |
|
static |
Returns the smallest (fixed) integer value greater than or equal to x.
x | Fixed value |
Fast cosinus computation using fixed number.
rad | Fixed angle in radian |
|
static |
Convert fixed degree to SGL ANGLE.
deg | Jo Engine fixed degree |
|
static |
Convert fixed degree to fixed radian.
deg | Fixed angle in degree |
Divide fixed-point numbers (expresses dividend / divisor)
dividend | (first operand) |
divisor | (second operand) |
Dot product two fixed 3D points.
ptA | Point A (first operand) |
ptB | Point B (second operand) |
|
static |
Returns the largest (fixed) integer value less than or equal to x.
x | Fixed value |
Multiply to fixed number.
x | First operand |
y | Second operand |
x raised to the power of the integer part of y
x | First operand |
y | Second operand |
|
static |
Convert fixed radian to SGL ANGLE.
rad | Jo Engine fixed radian |
|
static |
Convert fixed radian to fixed degree.
rad | Fixed angle in radian |
Fast Reciprocal Square root using fixed number.
value | Value |
Fast sinus computation using fixed number.
rad | Fixed angle in radian |
Fast Square root using fixed number.
value | Value |
|
static |
Wrap deg in [-180 180].
deg | Fixed degree |
|
static |
Wrap rad in [−pi pi].
rad | Fixed radian |
|
static |
Convert float to jo engine fixed (avoid usage of GCC Soft Float)
x | Float to convert |
int jo_gcd | ( | int | a, |
int | b | ||
) |
Get the greatest common divisor.
a | First value (> 0) |
b | Second value (> 0) |
|
static |
Convert int to jo engine fixed.
x | Float to convert |
|
static |
Check if float almost equals 0.
f | floating point number |
|
static |
Linear interpolation which guarantees v = v1 when t = 1.
v0 | First value |
v1 | Second value |
t | T [0, 1] |
|
static |
Creates the identity matrix (using fixed numbers)
result | Result matrix |
|
static |
Multiply 2 matrix (using fixed numbers)
a | First matrix |
b | Second matrix |
result | Result matrix |
|
static |
Multiply a matrix by a vector4 (using fixed numbers)
m | Matrix |
v | Vector4 |
result | Result vector4 |
|
static |
Creates rotating matrix (X axis) (using fixed numbers)
angle_in_rad | Angle in radiant |
result | Result matrix |
|
static |
Creates rotating matrix (Y axis) (using fixed numbers)
angle_in_rad | Angle in radiant |
result | Result matrix |
|
static |
Creates rotating matrix (Z axis) (using fixed numbers)
angle_in_rad | Angle in radiant |
result | Result matrix |
|
static |
Creates scaling matrix (using fixed numbers)
scale | Scale vector |
result | Result matrix |
|
static |
Creates translation matrix (using fixed numbers)
offset | Offset vector |
result | Result matrix |
|
static |
Creates transpose matrix (using fixed numbers)
matrix | Input matrix |
result | Result matrix |
|
static |
Creates the identity matrix (using floating numbers)
result | Result matrix |
|
static |
Inverts an affine transformation matrix (using floating numbers)
matrix | Matrix |
result | Result matrix |
|
static |
Builds a transformation matrix for a camera (using floating numbers)
from | Viewpoint |
to | target |
up | Defines the direction that's upwards for the camera |
result | Result matrix |
|
static |
Multiply 2 matrix (using floating numbers)
a | First matrix |
b | Second matrix |
result | Result matrix |
|
static |
Multiplies a 4x4 matrix with a 3D vector representing a direction in 3D space (using floating numbers)
matrix | Matrix |
direction | Direction |
result | Result matrix |
|
static |
Multiplies a 4x4 matrix with a 3D vector representing a point in 3D space (using floating numbers)
matrix | Matrix |
position | Position |
result | Result matrix |
|
static |
Creates an orthographic projection matrix (using floating numbers)
left | Left (Cube) |
right | Right (Cube) |
bottom | Bottom (Cube) |
top | Top (Cube) |
back | Back (Cube) |
front | Front (Cube) |
result | Result matrix |
|
static |
Creates a perspective projection matrix for a camera (using floating numbers)
vertical_field_of_view_in_deg | Specifies the field of view angle, in degrees, in the y direction. |
aspect_ratio | Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). |
near_view_distance | Specifies the distance from the viewer to the near clipping plane (always positive). |
far_view_distance | Specifies the distance from the viewer to the far clipping plane (always positive). |
result | Result matrix |
|
static |
Creates a matrix to rotate around an axis by a given angle in radiant (using floating numbers)
angle_in_rad | Angle in radiant |
axis | Axis |
result | Result matrix |
|
static |
Creates rotating matrix (X axis) (using floating numbers)
angle_in_rad | Angle in radiant |
result | Result matrix |
|
static |
Creates rotating matrix (Y axis) (using floating numbers)
angle_in_rad | Angle in radiant |
result | Result matrix |
|
static |
Creates rotating matrix (Z axis) (using floating numbers)
angle_in_rad | Angle in radiant |
result | Result matrix |
|
static |
Creates scaling matrix (using floating numbers)
scale | Scale vector |
result | Result matrix |
|
static |
Creates translation matrix (using floating numbers)
offset | Offset vector |
result | Result matrix |
|
static |
Creates transpose matrix (using floating numbers)
matrix | Input matrix |
result | Result matrix |
void jo_planar_rotate | ( | const jo_pos2D *const | point, |
const jo_pos2D *const | origin, | ||
const int | angle, | ||
jo_pos2D *const | result | ||
) |
Rotate a point on the plan with a specific origin.
point | Point to rotate |
origin | Rotation origin |
angle | Angle in degrees |
result | The new point coordinate |
int jo_random | ( | int | max | ) |
Get a random number.
max | maximum value |
|
static |
Get a random number with a specific multiple.
max | maximum value |
multiple | multiple |
float jo_rsqrt | ( | float | value | ) |
Fast Reciprocal Square root using floating number.
value | Value |
|
static |
Fast sinus computation.
deg | Angle in degree |
|
static |
Fast sinus multiplication.
deg | Angle in degree |
value | Value |
|
static |
Sinus computation.
rad | Angle in radian |
|
static |
Sinus computation.
rad | Angle in radian |
|
static |
Sinus computation.
deg | Angle in degree |
|
static |
Fast sinus multiplication.
deg | Angle in degree |
value | Value |
unsigned int jo_sqrt | ( | unsigned int | value | ) |
Fast square root.
value | Value |
|
static |
Fast Square root using floating number.
value | Value |
|
static |
Fast method to get if two square intersects (HitBox processing)
x1 | Horizontal position of the first square |
y1 | Vertical position of the first square |
w1 | Width of the first square |
h1 | Height of the first square |
x2 | Horizontal position of the second square |
y2 | Vertical position of the second square |
w2 | Width of the second square |
h2 | Height of the second square |
|
static |
Fast tangent computation.
deg | Angle in degree |
|
static |
Tangent computation.
rad | Angle in radian |
|
static |
Tangent computation.
rad | Angle in radian |
|
static |
Tangent computation.
deg | Angle in degree |
|
static |
Add 2 vectors4 (using fixed numbers)
a | First vector4 |
b | Second vector4 |
result | output vector4 |
|
static |
Cross product of 2 vectors4 (using fixed numbers)
a | First vector4 |
b | Second vector4 |
result | output vector4 |
|
static |
Dot product of 2 vectors4 (using fixed numbers)
a | First vector4 |
b | Second vector4 |
|
static |
Substract 2 vectors4 (using fixed numbers)
a | First vector4 |
b | Second vector4 |
result | output vector4 |
|
static |
Dot product of 2 vectors4 (using fixed numbers)
a | First vector4 |
b | Second vector4 |
|
static |
Add 2 vectors (using fixed numbers)
a | First vector |
b | Second vector |
result | output vector |
void jo_vector_fixed_compute_bezier_point | ( | const jo_fixed | t, |
jo_vector_fixed | p0, | ||
jo_vector_fixed | p1, | ||
jo_vector_fixed | p2, | ||
jo_vector_fixed | p3, | ||
jo_vector_fixed * | result | ||
) |
Compute cubic bezier curve point for vectors (using fixed numbers)
t | Value of the function on the curve [0 to JO_FIXED_1] |
p0 | First vector |
p1 | Second vector |
p2 | Third vector |
p3 | Fourth vector |
result | output vector |
|
static |
Multiply value to vector (using fixed numbers)
a | Vector |
s | Constant |
result | output vector |
|
static |
Add 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
result | output vector |
|
static |
Add value to vector (using floating numbers)
a | Vector |
s | Constant |
result | output vector |
|
static |
Get the angle between 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
void jo_vectorf_compute_bezier_point | ( | const float | t, |
jo_vectorf | p0, | ||
jo_vectorf | p1, | ||
jo_vectorf | p2, | ||
jo_vectorf | p3, | ||
jo_vectorf * | result | ||
) |
Compute cubic bezier curve point for vectors (using floating numbers)
t | Value of the function on the curve [0.0f to 1.0f] |
p0 | First vector |
p1 | Second vector |
p2 | Third vector |
p3 | Fourth vector |
result | output vector |
|
static |
Cross 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
result | output vector |
|
static |
Divide 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
result | output vector |
|
static |
Divide value to vector (using floating numbers)
a | Vector |
s | Constant |
result | output vector |
|
static |
Get the dot product of 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
|
static |
Get the length of a vector (using floating numbers)
a | Vector |
|
static |
Multiply 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
result | output vector |
|
static |
Multiply value to vector (using floating numbers)
a | Vector |
s | Constant |
result | output vector |
|
static |
Normalize a vector (using floating numbers)
a | Vector |
result | output vector |
|
static |
Compute projection vector (using floating numbers)
v | Vector |
onto | Vector |
result | output vector |
|
static |
Subtract 2 vectors (using floating numbers)
a | First vector |
b | Second vector |
result | output vector |
|
static |
Subtract value to vector (using floating numbers)
a | Vector |
s | Constant |
result | output vector |
int jo_random_seed |
Get or set current random seed.