first commit
This commit is contained in:
78
include/platform/math/nmath.h
Normal file
78
include/platform/math/nmath.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NMATH__
|
||||
#define __NMATH__
|
||||
|
||||
|
||||
#include "unit/nunit.h"
|
||||
|
||||
|
||||
/*
|
||||
@short Math namespace.
|
||||
@author Emmanuel Julien (ejulien@gsworks.fr)
|
||||
*/
|
||||
namespace GS {
|
||||
namespace Math {
|
||||
|
||||
static const float Pi = 3.1415926535f;
|
||||
|
||||
/// Euler angles rotation order.
|
||||
enum rOrder
|
||||
{
|
||||
rOrder_ZYX = 0,
|
||||
rOrder_YZX,
|
||||
rOrder_ZXY,
|
||||
rOrder_XZY,
|
||||
rOrder_YXZ,
|
||||
rOrder_XYZ,
|
||||
rOrder_XY,
|
||||
|
||||
rOrder_Default = rOrder_YXZ // Y then X then Z.
|
||||
};
|
||||
|
||||
enum Axis
|
||||
{
|
||||
AxisX, // Do not modify X, Y and Z order.
|
||||
AxisY,
|
||||
AxisZ,
|
||||
AxisNone
|
||||
};
|
||||
|
||||
void Init();
|
||||
|
||||
/// Return the reverse rotation order from a given input order.
|
||||
rOrder ReverserRotationOrder(rOrder r);
|
||||
|
||||
float Sqrt(float v);
|
||||
|
||||
float TestEqual(float a, float b, float e = 0.000001f);
|
||||
bool EqualZero(float v, float e = 0.000001f);
|
||||
|
||||
float Pow(float v, float exp);
|
||||
|
||||
float Ceil(float);
|
||||
float Floor(float);
|
||||
float Mod(float);
|
||||
|
||||
float RangeAdjust(float v, float old_min, float old_max, float new_min, float new_max);
|
||||
|
||||
float Quantize(float v, float q);
|
||||
|
||||
float Sin(float);
|
||||
float ASin(float);
|
||||
float Cos(float);
|
||||
float ACos(float);
|
||||
float Tan(float);
|
||||
float ATan(float);
|
||||
|
||||
bool IsFinite(float);
|
||||
|
||||
} // Math
|
||||
} // GS
|
||||
|
||||
|
||||
#endif // __NMATH__
|
||||
Reference in New Issue
Block a user