Claude Chappe' Curse - A C Game
Logo Institut d'Informatique Claude Chappe Logo Université de Le Mans Logo Raeptor Production
 
Loading...
Searching...
No Matches
math_util.h File Reference

Go to the source code of this file.

Macros

#define sqr(x)   ((x)*(x))
 Computes the square of a number.
 
#define cube(x)   ((x)*(x)*(x))
 Computes the cube of a number.
 
#define PI   3.14159265358979323846264338327
 The mathematical constant π (pi).
 
#define MIN(x, y)   ((x < y) ? x : y)
 Computes the minimum of two values.
 
#define MAX(x, y)   ((x > y) ? x : y)
 Computes the maximum of two values.
 
#define CLAMP(x, y, z)   (MIN(MAX(x,y),z))
 Clamps a value between a minimum and maximum range.
 

Functions

f32 frsqrt (f32 number)
 Computes the fast inverse square root of a given number using the "Fast Inverse Square Root" algorithm.
 
f32 to_radians (f32 angle)
 Converts an angle from degrees to radians.
 
f32 to_degrees (f32 angle)
 Converts an angle from radians to degrees.
 
f32 float_approach (f32 *const origin, const f32 dest, const f32 factor)
 Approaches a target float by a given factor.
 
float * vec3_approach (float *origin, float *dest, const f32 factor)
 Approaches a target vector by a given factor.