Program that converts geometric and animation 3D scene data, from a COLLADA "*.dae" file to a binary file, with a custom format.
#ifndef MATH_FUNCTIONS_H_
#define MATH_FUNCTIONS_H_
#include "./constants.h"
namespace math
{
//absolute value
int fABS(const int n);
float fFABS(const float x);
//universal functions
template <typename T>
inline const T& min(const T &a, const T &b) {
return a < b ? a : b;
}
template <typename T>
inline const T& min(const T &a, const T &b, const T &c) {
return (a < b && a < c) ? a : ((b < a && b < c) ? b : c);
}
template <class T>
inline const T& max(const T &a, const T &b) {
return a > b ? a : b;
}
template <typename T>
inline const T& max(const T &a, const T &b, const T &c) {
return (a > b && a > c) ? a : ((b > a && b > c) ? b : c);
}
template <class T>
inline const T& clamp(const T &x, const T &a, const T &b) {
return x < a ? a : (x > b ? b : x);
}
template <class T>
inline const int sign(const T &x) {
return x > 0 ? 1 : (x < 0 ? -1 : 0);
}
template <class T>
inline void swap(T &a, T &b) {
T tmp = a;
a = b;
b = tmp;
}
extern int vRSEED;
void fRAND_SEED(const int seed);
int fRAND();
float fRANDF();
//newton-raphson sqrtf
float fSQRTF(const float x);
//fast sin/cos/tan functions
extern float* cos_look;
extern float* sin_look;
extern float* tan_look;
void fBUILD_ANGLE_TABLES();
float fFAST_ANGLE(const float theta, float* table);
float fFAST_SIN(const float theta);
float fFAST_COS(const float theta);
float fFAST_TAN(const float theta);
void fFAST_SINCOS(const float theta, float* sin, float* cos);
}
#endif