You.i Engine
YiMath.h File Reference
#include "framework/YiPredef.h"
#include "YiMathTables.h"
#include <math.h>

Go to the source code of this file.

Macros

#define YI_SIN   (float)sin
 
#define YI_COS   (float)cos
 
#define YI_FPOW(x, y)   pow((float)x, (float)y)
 
#define YI_SQRT(x)   sqrt(x)
 
#define YI_ITOFXW(x)   ((x) << 16)
 
#define YI_FXTOIW(x)   ((x) >> 16)
 
#define YI_DIVFXW(x, y)   ((y << 16) / (x))
 
#define YI_ITOFX(x)   ((x) << 16)
 
#define YI_FTOFX(x)   (int32_t)((x)*65536)
 
#define YI_DTOFX(x)   (int32_t)((x)*65536)
 
#define YI_FXTOI(x)   ((x) >> 16)
 
#define YI_FXTOF(x)   ((float)(x) / 65536)
 
#define YI_FXTOD(x)   ((double)(x) / 65536)
 
#define YI_MULFX(x, y)   (((y) * (x)) >> 16)
 
#define YI_MULFX2(x, y)   ((((y)>> 16) * ((x)>> 16)))
 
#define YI_DIVFX(x, y)   (((x) << 16) / (y))
 
#define YI_ABS(x)   (((x) < 0) ? -(x) : (x))
 
#define YI_FABS(x)   (((x) < 0) ? -(x) : (x))
 
#define YI_DABS(x)   (((x) < 0) ? -(x) : (x))
 
#define YI_SGN(x)   (((x) > 0 ) ? 1 : ((x) < 0) ? -1 : 0)
 
#define YI_FSGN(x)   (((x) > 0 ) ? 1 : ((x) < 0) ? -1 : 0)
 
#define YI_SGN2(x, y)   (((x) > y ) ? 1 : ((x) < y) ? -1 : 0)
 

Functions

YI_EXTERNINLINE int32_t YI_FLOOR (float fVal)
 
YI_EXTERNINLINE int32_t YI_FLOOR (double fVal)
 
YI_EXTERNINLINE int32_t YI_CEIL (float fVal)
 
YI_EXTERNINLINE int32_t YI_CEIL (double fVal)
 
YI_EXTERNINLINE int32_t YI_ROUND (float fval)
 
YI_EXTERNINLINE int32_t YI_ROUND (double fval)
 
YI_EXTERNINLINE int32_t YI_DIFF (int32_t x, int32_t y)
 
int32_t Log2 (int32_t a)
 
int32_t Atan2i (int32_t y, int32_t x)
 
int32_t AngleDiff (int32_t SrcAngle, int32_t TargetAngle)
 
int32_t YI_INTSQRT (int32_t l2)
 
int32_t YI_INTSQRT256 (int32_t l2)
 
int32_t YI_POW (int32_t P, int32_t z)
 

Variables

const int32_t YI_ANGLESHIFT
 
const int32_t YI_ANGLE2PI
 
const int32_t YI_ANGLEMASK
 
const float YI_PI
 
const int32_t YI_TRIG_SHIFT
 
const int32_t YI_TRIG_MUL
 
const int32_t YI_ATAN_SIZE
 
const int16_t g_sYISine [YI_ANGLE2PI]
 
const int16_t g_sYICosine [YI_ANGLE2PI]
 
const uint16_t g_usYIArctan [YI_ATAN_SIZE+1]
 
const uint16_t g_usYISqrt [256 *16]