#include "flGlobal.h"
#include <math.h>
Go to the source code of this file.
Defines | |
#define | mathVect3fRotateX(inView, inAngle) mathVect3fRotate(inView, { 1.0f, 0.0f, 0.0f }, inAngle) |
#define | mathVect3fRotateY(inView, inAngle) mathVect3fRotate(inView, { 0.0f, 1.0f, 0.0f }, inAngle) |
#define | mathVect3fRotateZ(inView, inAngle) mathVect3fRotate(inView, { 0.0f, 0.0f, 1.0f }, inAngle) |
#define | mathSign(inValue) ((inValue) < 0 ? -1 : 1) |
#define | mathSignf(inValue) ((inValue) < 0.0f ? -1.0f : 1.0f) |
#define | mathSigni(inValue) mathSign(inValue) |
#define | mathAbsf(inValue) fabsf(inValue) |
#define | mathLogef(inValue) mathLnf(inValue) |
#define | mathSqrtf(inValue) sqrtf(inValue) |
#define | mathDegreesToRadians(inDeg) mathDegToRad(inDeg) |
#define | mathRadiansToDegrees(inRad) mathRadToDeg(inRad) |
Functions | |
void | mathInit () |
This is called by flInitialize(), it initializes the maths system, by seeding the random number generator and if trigcaching is used then it creates the cache. | |
void | mathRandSeed (u32 inSeed) |
This function reseeds the random number generator. | |
float | mathRandf (float inSize) |
This function returns a pseudo random number between 0 and inSize. | |
float | mathRandFractf () |
This function returns a pseudo random number between 0 and 1. | |
unsigned int | mathRandi (unsigned int inSize) |
This function returns a pseudo random integer between 0 and inSize - 1, for example mathRandi(10) would return a number from 0 to 9. | |
s64 | mathRandl (s64 inSize) |
This function returns a pseudo random integer between 0 and inSize - 1, this function is the same as mathRandi() however it uses double accuracy signed integers. | |
float | mathFixDegRange (float inDeg) |
Fixes numbers to be within the standard range for degrees which is 0 to 360. | |
float | mathFixRadRange (float inRad) |
Fixes numbers to be within the standard range for radians which is 0 to 2pi. | |
float | mathDegToRad (float inDeg) |
Converts a degree value to radians (e.g 180 would return pi). | |
float | mathRadToDeg (float inRad) |
Converts a radian value to degrees (e.g pi/2 would return 90). | |
float | mathSinf (float inAngle) |
This is basically a wrapper for sinf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process. | |
float | mathCosf (float inAngle) |
This is basically a wrapper for cosf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process. | |
float | mathACosf (float inAngle) |
This is basically a wrapper for acosf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process. | |
float | mathATanf (float inAngle) |
This is basically a wrapper for atanf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process. | |
float | mathExpnf (float inValue) |
This is basically a wrapper for expf from libmath, it returns the natural exponent of a number. | |
float | mathLnf (float inValue) |
This is basically a wrapper for logf from libmath, it returns the natural logarithm of a number. | |
float | mathPythag2f (float inX, float inY) |
This returns the the square root of inX^2 + inY^2. | |
float | mathPythag3f (float inX, float inY, float inZ) |
This returns the the square root of inX^2 + inY^2 + inZ^2. | |
float | mathDotProdN (float *inValue0, float *inValue1, u8 inCount) |
This returns the dot product of inCount sets of values. | |
float | mathQuatLength (quat4f inQuat) |
quat4f * | mathQuatNormalize (quat4f *inQuat) |
quat4f | mathQuatNormal (quat4f inQuat) |
quat4f * | mathQuatNegate (quat4f *inQuat) |
quat4f | mathQuatNegation (quat4f inQuat) |
quat4f | mathQuatMult (quat4f inQuat0, quat4f inQuat1) |
vect3f | mathVect3fRotate (vect3f inVect, vect3f inAxis, float inAngle) |
This function is meant to rotate a direction vector around an axix by inAngle. | |
vect3f | mathVect3fCrossProd (vect3f inVect0, vect3f inVect1) |
float | mathVect3fLength (vect3f inVect) |
vect3f * | mathVect3fNormalize (vect3f *inVect) |
vect3f | mathVect3fNormal (vect3f inVect) |
#define mathSignf | ( | inValue | ) | ((inValue) < 0.0f ? -1.0f : 1.0f) |
#define mathVect3fRotateX | ( | inView, | |||
inAngle | ) | mathVect3fRotate(inView, { 1.0f, 0.0f, 0.0f }, inAngle) |
#define mathVect3fRotateY | ( | inView, | |||
inAngle | ) | mathVect3fRotate(inView, { 0.0f, 1.0f, 0.0f }, inAngle) |
#define mathVect3fRotateZ | ( | inView, | |||
inAngle | ) | mathVect3fRotate(inView, { 0.0f, 0.0f, 1.0f }, inAngle) |
float mathACosf | ( | float | inAngle | ) |
This is basically a wrapper for acosf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process.
inAngle | The angle whose arc-cosine will be calculated. |
float mathATanf | ( | float | inAngle | ) |
This is basically a wrapper for atanf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process.
inAngle | The angle whose arc-tangent will be calculated. |
Definition at line 266 of file flMath.c.
Referenced by spriteDraw2dFrame().
float mathCosf | ( | float | inAngle | ) |
This is basically a wrapper for cosf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process.
inAngle | The angle whose cosine will be calculated. |
Definition at line 222 of file flMath.c.
Referenced by camMoveStrafe(), camViewCalc(), graphics2dDrawEllipse(), graphics2dDrawEllipseFilledGrad(), graphics2dDrawSpheroidShaded(), graphics3dDrawSphere(), graphics3dDrawSphereTextured(), and spriteDraw2dFrame().
float mathDegToRad | ( | float | inDeg | ) |
Converts a degree value to radians (e.g 180 would return pi).
inDeg | The degree value that is to be converted. |
Definition at line 157 of file flMath.c.
References MATH_PI, and mathFixDegRange().
float mathDotProdN | ( | float * | inValue0, | |
float * | inValue1, | |||
u8 | inCount | |||
) |
This returns the dot product of inCount sets of values.
inValue0 | An array of floats of length inCount to be dotted with inValue1. | |
inValue1 | An array of floats of length inCount to be dotted with inValue0. | |
inCount | The number of elements in the arrays passed. |
float mathExpnf | ( | float | inValue | ) |
float mathFixDegRange | ( | float | inDeg | ) | [inline] |
Fixes numbers to be within the standard range for degrees which is 0 to 360.
inDeg | The value whose range needs to be fixed. |
Definition at line 141 of file flMath.c.
Referenced by mathDegToRad().
float mathFixRadRange | ( | float | inRad | ) | [inline] |
Fixes numbers to be within the standard range for radians which is 0 to 2pi.
inRad | The value whose range needs to be fixed. |
Definition at line 149 of file flMath.c.
References MATH_PI.
Referenced by mathRadToDeg().
void mathInit | ( | ) |
This is called by flInitialize(), it initializes the maths system, by seeding the random number generator and if trigcaching is used then it creates the cache.
Definition at line 25 of file flMath.c.
References mathRandSeed().
Referenced by flInitialize().
float mathLnf | ( | float | inValue | ) |
float mathPythag2f | ( | float | inX, | |
float | inY | |||
) |
This returns the the square root of inX^2 + inY^2.
inX | The length of side A of a right angle triangle. | |
inY | The length of side B of a right angle triangle. |
Definition at line 332 of file flMath.c.
Referenced by spriteDraw2dFrame().
float mathPythag3f | ( | float | inX, | |
float | inY, | |||
float | inZ | |||
) |
This returns the the square root of inX^2 + inY^2 + inZ^2.
inX | Size 0. | |
inY | Side 1. | |
inZ | Side 2 |
float mathQuatLength | ( | quat4f | inQuat | ) |
Definition at line 415 of file flMath.c.
References mathQuatLength().
Referenced by mathQuatNormal().
float mathRadToDeg | ( | float | inRad | ) |
Converts a radian value to degrees (e.g pi/2 would return 90).
inRad | The radian value that is to be converted. |
Definition at line 176 of file flMath.c.
References MATH_PI, and mathFixRadRange().
float mathRandf | ( | float | inSize | ) |
This function returns a pseudo random number between 0 and inSize.
inSize | The range of the random number returned. |
Definition at line 50 of file flMath.c.
References FL_MATH_RANDOMSEED_FREQUENCY.
float mathRandFractf | ( | ) |
This function returns a pseudo random number between 0 and 1.
Definition at line 80 of file flMath.c.
References FL_MATH_RANDOMSEED_FREQUENCY.
unsigned int mathRandi | ( | unsigned int | inSize | ) |
This function returns a pseudo random integer between 0 and inSize - 1, for example mathRandi(10) would return a number from 0 to 9.
inSize | One more than the maximum integer that will be returned. |
Definition at line 108 of file flMath.c.
References FL_MATH_RANDOMSEED_FREQUENCY.
Referenced by colorRandom8888(), and mathRandl().
s64 mathRandl | ( | s64 | inSize | ) |
This function returns a pseudo random integer between 0 and inSize - 1, this function is the same as mathRandi() however it uses double accuracy signed integers.
inSize | One more than the maximum integer that will be returned. |
Definition at line 135 of file flMath.c.
References mathRandi().
void mathRandSeed | ( | u32 | inSeed | ) |
This function reseeds the random number generator.
inSeed | The seed to use for random number generation. |
Definition at line 35 of file flMath.c.
Referenced by mathInit().
float mathSinf | ( | float | inAngle | ) |
This is basically a wrapper for sinf from libmath, however if FL_MATH_VFPU is enabled then it will use the VFPU ro speed up the process.
inAngle | The angle whose sine will be calculated. |
Definition at line 195 of file flMath.c.
Referenced by camMoveStrafe(), camViewCalc(), graphics2dDrawEllipse(), graphics2dDrawEllipseFilledGrad(), graphics2dDrawSpheroidShaded(), graphics3dDrawSphere(), graphics3dDrawSphereTextured(), and spriteDraw2dFrame().
float mathVect3fLength | ( | vect3f | inVect | ) |
Definition at line 624 of file flMath.c.
References mathVect3fLength().
Referenced by mathVect3fNormal().
This function is meant to rotate a direction vector around an axix by inAngle.
inVect | The vector to be rotated. | |
inAxis | The axis to rotate around. | |
inAngle | The angle to rotate by. |
Definition at line 523 of file flMath.c.
References mathQuatMult(), and mathQuatNegate().