fbxsdk/core/math/fbxmath.h File Reference
 
 
 
fbxsdk/core/math/fbxmath.h File Reference

File Description

Definition in file fbxmath.h.

Classes

class   FbxEuler

Defines

#define  FBXSDK_PI   3.1415926535897932384626433832795028841971693993751
#define  FBXSDK_PI_DIV_2   1.5707963267948966192313216916397514420985846996875
#define  FBXSDK_PI_DIV_180   0.017453292519943295769236907684886127134428718885417
#define  FBXSDK_180_DIV_PI   57.295779513082320876798154814105170332405472466565
#define  FBXSDK_1_DIV_LN2   1.4426950408889634073599246810018921374266459541530
#define  FBXSDK_DEG_TO_RAD   FBXSDK_PI_DIV_180
  Degree to Radian.
#define  FBXSDK_RAD_TO_DEG   FBXSDK_180_DIV_PI
  Radian to Degree.
#define  FBXSDK_IN_TO_CM   2.54
  Inch to Centimeter.
#define  FBXSDK_CM_TO_IN   0.393700787
  Centimeter to Inch.
#define  FBXSDK_IN_TO_MM   25.4
  Inch to Millimeter.
#define  FBXSDK_MM_TO_IN   0.0393700787
  Millimeter to Inch.
#define  FBXSDK_FT_TO_M   0.3048
  Feet to Meter.
#define  FBXSDK_M_TO_FT   3.2808399
  Meter to Feet.
#define  FBXSDK_YD_TO_FT   3
  Yard to Feet.
#define  FBXSDK_FT_TO_YD   0.333333333
  Feet to Yard.
#define  FBXSDK_KM_TO_MILE   0.621371192
  Kilometer to Mile.
#define  FBXSDK_MILE_TO_KM   1.609344
  Mile to Kilometer.
#define  FBXSDK_YD_TO_M   0.9144
  Yard to Meter.
#define  FBXSDK_M_TO_YD   1.0936133
  Meter to Yard.
#define  EulerOrder(EAxis, EParity, ERepeat)   (((EAxis) << 2) | (EParity) | (ERepeat))

Enumerations

enum   EFbxRotationOrder {
  eEulerXYZ, eEulerXZY, eEulerYZX, eEulerYXZ,
  eEulerZXY, eEulerZYX, eSphericXYZ
}
  Rotation order flags. More...
enum   EFbxQuatInterpMode {
  eQuatInterpOff, eQuatInterpClassic, eQuatInterpSlerp, eQuatInterpCubic,
  eQuatInterpTangentDependent, eQuatInterpCount
}
  Quaternion interpolation modes. More...

Functions

float  FbxFloor (const float x)
double  FbxFloor (const double x)
float  FbxCeil (const float x)
double  FbxCeil (const double x)
template<class T >
FbxSign (const T x)
template<class T >
FbxRound (const T x)
FbxUChar  FbxAbs (const FbxUChar x)
FbxUShort  FbxAbs (const FbxUShort x)
FbxUInt  FbxAbs (const FbxUInt x)
FbxULong  FbxAbs (const FbxULong x)
FbxULongLong  FbxAbs (const FbxULongLong x)
FbxFloat  FbxAbs (const FbxFloat x)
FbxDouble  FbxAbs (const FbxDouble x)
template<class T >
FbxAbs (const T x)
template<class T >
FbxAbs (const T x, const T y)
template<class T >
FbxClamp (const T value, const T min, const T max)
template<class T >
bool  FbxEqual (const T x, const T y, const T e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxDouble2 &x, const FbxDouble2 &y, const double e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxDouble3 &x, const FbxDouble3 &y, const double e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxDouble4 &x, const FbxDouble4 &y, const double e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxVector2 &x, const FbxVector2 &y, const double e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxVector4 &x, const FbxVector4 &y, const double e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxMatrix &x, const FbxMatrix &y, const double e=FBXSDK_TOLERANCE)
bool  FbxEqual (const FbxAMatrix &x, const FbxAMatrix &y, const double e=FBXSDK_TOLERANCE)
template<class T >
FbxReciprocal (const T x)
double  FbxSqrt (const double x)
float  FbxSqrt (const float x)
template<class T >
FbxSqrt (const T x)
float  FbxExp (const float x)
double  FbxExp (const double x)
template<class T >
FbxPow (const T x, const T y)
float  FbxLog (const float x)
double  FbxLog (const double x)
template<class T >
FbxLog2 (const T x)
float  FbxSin (const float x)
double  FbxSin (const double x)
float  FbxCos (const float x)
double  FbxCos (const double x)
float  FbxTan (const float x)
double  FbxTan (const double x)
template<class T >
FbxCos (const T x)
template<class T >
FbxSinCos (const T x, T *y)
template<class T >
FbxSinCosd (const T x, T *y)
double  FbxASin (const double x)
template<class T >
FbxASind (const T x)
template<class T >
FbxACosd (const T x)
float  FbxATan (const float x)
double  FbxATan (const double x)
template<class T >
FbxATand (const T x)
float  FbxATan (const float y, const float x)
double  FbxATan (const double y, const double x)
template<class T >
FbxATand (const T y, const T x)
template<class T >
FbxNorm (const T x, const T y)
template<class T >
FbxNorm (const T x, const T y, const T z)
template<class T >
FbxNorm (const T w, const T x, const T y, const T z)
template<class T >
FbxHypot (const T x, const T y)
template<class T >
FbxHypot (const T x, const T y, const T z)
template<class T >
FbxHypot (const T w, const T x, const T y, const T z)
float  FbxASin (const float x)
float  FbxACos (const float x)
double  FbxACos (const double x)
template<class T >
int  FbxBitCount (const T x)
template<class T >
void  FbxFixInfinite (T &x)
template<class T >
FbxExp (const T x)
template<class T >
FbxLog (const T x)
template<class T >
FbxSin (const T x)
template<class T >
FbxASin (const T x)
template<class T >
FbxACos (const T x)
template<class T >
FbxATan (const T x)
template<class T >
FbxATan (const T y, const T x)

Variables

FBXSDK_DLL const double  FbxIdentityMatrix [4][4]
FBXSDK_DLL const FbxVector4  FbxZeroVector4

Define Documentation

#define FBXSDK_PI   3.1415926535897932384626433832795028841971693993751

Definition at line 42 of file fbxmath.h.

#define FBXSDK_PI_DIV_2   1.5707963267948966192313216916397514420985846996875

Definition at line 43 of file fbxmath.h.

#define FBXSDK_PI_DIV_180   0.017453292519943295769236907684886127134428718885417
Examples:
ViewScene/SetCamera.cxx.

Definition at line 44 of file fbxmath.h.

#define FBXSDK_180_DIV_PI   57.295779513082320876798154814105170332405472466565
Examples:
ViewScene/SetCamera.cxx.

Definition at line 45 of file fbxmath.h.

#define FBXSDK_1_DIV_LN2   1.4426950408889634073599246810018921374266459541530

Definition at line 46 of file fbxmath.h.

#define FBXSDK_DEG_TO_RAD   FBXSDK_PI_DIV_180

Degree to Radian.

Definition at line 50 of file fbxmath.h.

#define FBXSDK_RAD_TO_DEG   FBXSDK_180_DIV_PI

Radian to Degree.

Definition at line 51 of file fbxmath.h.

#define FBXSDK_IN_TO_CM   2.54

Inch to Centimeter.

Definition at line 52 of file fbxmath.h.

#define FBXSDK_CM_TO_IN   0.393700787

Centimeter to Inch.

Definition at line 53 of file fbxmath.h.

#define FBXSDK_IN_TO_MM   25.4

Inch to Millimeter.

Definition at line 54 of file fbxmath.h.

#define FBXSDK_MM_TO_IN   0.0393700787

Millimeter to Inch.

Definition at line 55 of file fbxmath.h.

#define FBXSDK_FT_TO_M   0.3048

Feet to Meter.

Definition at line 56 of file fbxmath.h.

#define FBXSDK_M_TO_FT   3.2808399

Meter to Feet.

Definition at line 57 of file fbxmath.h.

#define FBXSDK_YD_TO_FT   3

Yard to Feet.

Definition at line 58 of file fbxmath.h.

#define FBXSDK_FT_TO_YD   0.333333333

Feet to Yard.

Definition at line 59 of file fbxmath.h.

#define FBXSDK_KM_TO_MILE   0.621371192

Kilometer to Mile.

Definition at line 60 of file fbxmath.h.

#define FBXSDK_MILE_TO_KM   1.609344

Mile to Kilometer.

Definition at line 61 of file fbxmath.h.

#define FBXSDK_YD_TO_M   0.9144

Yard to Meter.

Definition at line 62 of file fbxmath.h.

#define FBXSDK_M_TO_YD   1.0936133

Meter to Yard.

Definition at line 63 of file fbxmath.h.

#define EulerOrder (   EAxis,
  EParity,
  ERepeat 
)    (((EAxis) << 2) | (EParity) | (ERepeat))

Definition at line 74 of file fbxmath.h.


Enumeration Type Documentation

Rotation order flags.

Each rotate order produces a different end orientation. For example, if the rotation order for an object is set to XYZ, the object first rotates about its X-axis, then its Y-axis, and finally its Z-axis.

Enumerator:
eEulerXYZ 
eEulerXZY 
eEulerYZX 
eEulerYXZ 
eEulerZXY 
eEulerZYX 
eSphericXYZ 

Definition at line 100 of file fbxmath.h.

Quaternion interpolation modes.

Enumerator:
eQuatInterpOff 

Do not evaluate using quaternion interpolation.

eQuatInterpClassic 

Legacy quaternion interpolation mode.

eQuatInterpSlerp 

Spherical linear interpolation.

eQuatInterpCubic 

Cubic interpolation.

eQuatInterpTangentDependent 

Mix between Slerp and cubic interpolation, depending on the specified tangents for each key.

eQuatInterpCount 

Number of quaternion interpolation modes.

Mark the end of this enum.

Definition at line 112 of file fbxmath.h.


Function Documentation

float FbxFloor ( const float  x ) [inline]

Definition at line 125 of file fbxmath.h.

{
        return float(floor(x));
}
double FbxFloor ( const double  x ) [inline]

Definition at line 130 of file fbxmath.h.

{
        return floor(x);
}
float FbxCeil ( const float  x ) [inline]

Definition at line 135 of file fbxmath.h.

{
        return float(ceil(x));
}
double FbxCeil ( const double  x ) [inline]

Definition at line 140 of file fbxmath.h.

{
        return ceil(x);
}
T FbxSign ( const T  x ) [inline]

Definition at line 145 of file fbxmath.h.

{
        return (x < 0) ? T(-1) : T(1);
}
T FbxRound ( const T  x ) [inline]

Definition at line 150 of file fbxmath.h.

{
        T y = FbxFloor(x);
        return (x - y < T(0.5)) ? y : y + T(1);
}
FbxUChar FbxAbs ( const FbxUChar  x ) [inline]

Definition at line 156 of file fbxmath.h.

{
        return x;
}
FbxUShort FbxAbs ( const FbxUShort  x ) [inline]

Definition at line 161 of file fbxmath.h.

{
        return x;
}
FbxUInt FbxAbs ( const FbxUInt  x ) [inline]

Definition at line 166 of file fbxmath.h.

{
        return x;
}
FbxULong FbxAbs ( const FbxULong  x ) [inline]

Definition at line 172 of file fbxmath.h.

        {
                return x;
        }
FbxULongLong FbxAbs ( const FbxULongLong  x ) [inline]

Definition at line 178 of file fbxmath.h.

{
        return x;
}
FbxFloat FbxAbs ( const FbxFloat  x ) [inline]

Definition at line 183 of file fbxmath.h.

{
        return fabs(x);
}
FbxDouble FbxAbs ( const FbxDouble  x ) [inline]

Definition at line 188 of file fbxmath.h.

{
        return fabs(x);
}
T FbxAbs ( const T  x ) [inline]

Definition at line 193 of file fbxmath.h.

{
        return (x >= 0) ? x : ((x > FbxMin(x)) ? -x : FbxMax(x));
}
T FbxAbs ( const T  x,
const T  y 
) [inline]

Definition at line 198 of file fbxmath.h.

{
        T ax, ay;
        if( x )
        {
                if( ax = FbxAbs(x), y )
                {
                        return ( ax > (ay = FbxAbs(y)) ) ? ay * FbxSqrt(T(1) + kSq(x / y)) : ax * FbxSqrt(T(1) + kSq(y / x));
                }
                else
                {
                        return ax;
                }
        }
        else
        {
                return FbxAbs(y);
        }
}
T FbxClamp ( const T  value,
const T  min,
const T  max 
) [inline]

Definition at line 218 of file fbxmath.h.

{
        return (value < min) ? min : ((value > max) ? max : value);
}
bool FbxEqual ( const T  x,
const T  y,
const T  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 223 of file fbxmath.h.

{
        return FbxAbs(x - y) <= e;
}
bool FbxEqual ( const FbxDouble2 x,
const FbxDouble2 y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 228 of file fbxmath.h.

{
        return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) );
}
bool FbxEqual ( const FbxDouble3 x,
const FbxDouble3 y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 233 of file fbxmath.h.

{
        return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) && FbxEqual(x.mData[2], y.mData[2], e) );
}
bool FbxEqual ( const FbxDouble4 x,
const FbxDouble4 y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 238 of file fbxmath.h.

{
        return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) && FbxEqual(x.mData[2], y.mData[2], e) && FbxEqual(x.mData[3], y.mData[3], e) );
}
bool FbxEqual ( const FbxVector2 x,
const FbxVector2 y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 248 of file fbxmath.h.

{
        return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) );
}
bool FbxEqual ( const FbxVector4 x,
const FbxVector4 y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 253 of file fbxmath.h.

{
        return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) && FbxEqual(x.mData[2], y.mData[2], e) && FbxEqual(x.mData[3], y.mData[3], e) );
}
bool FbxEqual ( const FbxMatrix x,
const FbxMatrix y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 258 of file fbxmath.h.

{
        return ( FbxEqual(x[0], y[0], e) && FbxEqual(x[1], y[1], e) && FbxEqual(x[2], y[2], e) && FbxEqual(x[3], y[3], e) );
}
bool FbxEqual ( const FbxAMatrix x,
const FbxAMatrix y,
const double  e = FBXSDK_TOLERANCE 
) [inline]

Definition at line 263 of file fbxmath.h.

{
        return ( FbxEqual(x[0], y[0], e) && FbxEqual(x[1], y[1], e) && FbxEqual(x[2], y[2], e) && FbxEqual(x[3], y[3], e) );
}
T FbxReciprocal ( const T  x ) [inline]

Definition at line 268 of file fbxmath.h.

{
        return T(1) / x;
}
double FbxSqrt ( const double  x ) [inline]

Definition at line 273 of file fbxmath.h.

{
        return sqrt(x);
}
float FbxSqrt ( const float  x ) [inline]

Definition at line 278 of file fbxmath.h.

{
        return sqrtf(x);
}
T FbxSqrt ( const T  x ) [inline]

Definition at line 283 of file fbxmath.h.

{
        if( x > 1 )
        {
                T z, y = x >> 1; 
                do 
                { 
                        z = y; 
                        y = (y + (x / y)) >> 1; 
                }
                while(y < z); 

                return z;
        }
        else
        {
                return x;
        }
}
float FbxExp ( const float  x ) [inline]

Definition at line 303 of file fbxmath.h.

{
        return expf(x);
}
double FbxExp ( const double  x ) [inline]

Definition at line 308 of file fbxmath.h.

{
        return exp(x);
}
T FbxPow ( const T  x,
const T  y 
) [inline]

Definition at line 313 of file fbxmath.h.

{
        return FbxExp(y * FbxLog(x));
}
float FbxLog ( const float  x ) [inline]

Definition at line 318 of file fbxmath.h.

{
        return float(log(x));
}
double FbxLog ( const double  x ) [inline]

Definition at line 323 of file fbxmath.h.

{
        return log(x);
}
T FbxLog2 ( const T  x ) [inline]

Definition at line 328 of file fbxmath.h.

{
        return FbxLog(x) * T(FBXSDK_1_DIV_LN2);
}
float FbxSin ( const float  x ) [inline]

Definition at line 333 of file fbxmath.h.

{
        return sinf(x);
}
double FbxSin ( const double  x ) [inline]

Definition at line 338 of file fbxmath.h.

{
        return sin(x);
}
float FbxCos ( const float  x ) [inline]

Definition at line 343 of file fbxmath.h.

{
        return cosf(x);
}
double FbxCos ( const double  x ) [inline]

Definition at line 348 of file fbxmath.h.

{
        return cos(x);
}
float FbxTan ( const float  x ) [inline]

Definition at line 353 of file fbxmath.h.

{
        return tanf(x);
}
double FbxTan ( const double  x ) [inline]

Definition at line 358 of file fbxmath.h.

{
        return tan(x);
}
T FbxCos ( const T  x ) [inline]
T FbxSinCos ( const T  x,
T *  y 
) [inline]

Definition at line 366 of file fbxmath.h.

{
        return *y = FbxCos(x), FbxSin(x);
}
T FbxSinCosd ( const T  x,
T *  y 
) [inline]

Definition at line 372 of file fbxmath.h.

{
        return FbxSinCos(T(x * FBXSDK_PI_DIV_180), y);
}
double FbxASin ( const double  x ) [inline]

Definition at line 377 of file fbxmath.h.

{
        return asin(x);
}
T FbxASind ( const T  x ) [inline]

Definition at line 382 of file fbxmath.h.

{
        return FbxASin(x) * FBXSDK_180_DIV_PI;
}
T FbxACosd ( const T  x ) [inline]

Definition at line 387 of file fbxmath.h.

{
        return FbxACos(x) * FBXSDK_180_DIV_PI;
}
float FbxATan ( const float  x ) [inline]

Definition at line 392 of file fbxmath.h.

{
        return atanf(x);
}
double FbxATan ( const double  x ) [inline]

Definition at line 397 of file fbxmath.h.

{
        return atan(x);
}
T FbxATand ( const T  x ) [inline]

Definition at line 402 of file fbxmath.h.

{
        return FbxATan(x) * FBXSDK_180_DIV_PI;
}
float FbxATan ( const float  y,
const float  x 
) [inline]

Definition at line 407 of file fbxmath.h.

{
        return atan2f(y, x);
}
double FbxATan ( const double  y,
const double  x 
) [inline]

Definition at line 412 of file fbxmath.h.

{
        return atan2(y, x);
}
T FbxATand ( const T  y,
const T  x 
) [inline]

Definition at line 417 of file fbxmath.h.

{
        return FbxATan(y, x) * FBXSDK_180_DIV_PI;
}
T FbxNorm ( const T  x,
const T  y 
) [inline]

Definition at line 422 of file fbxmath.h.

{
        return FbxSqrt(x * x + y * y);
}
T FbxNorm ( const T  x,
const T  y,
const T  z 
) [inline]

Definition at line 427 of file fbxmath.h.

{
        return FbxSqrt(x * x + y * y + z * z);
}
T FbxNorm ( const T  w,
const T  x,
const T  y,
const T  z 
) [inline]

Definition at line 432 of file fbxmath.h.

{
        return FbxSqrt(w * w + x * x + y * y + z * z);
}
T FbxHypot ( const T  x,
const T  y 
) [inline]

Definition at line 437 of file fbxmath.h.

{
        return FbxSqrt(x * x + y * y);
}
T FbxHypot ( const T  x,
const T  y,
const T  z 
) [inline]

Definition at line 442 of file fbxmath.h.

{
        return FbxSqrt(x * x + y * y + z * z);
}
T FbxHypot ( const T  w,
const T  x,
const T  y,
const T  z 
) [inline]

Definition at line 447 of file fbxmath.h.

{
        return FbxSqrt(w * w + x * x + y * y + z * z);
}
float FbxASin ( const float  x ) [inline]

Definition at line 452 of file fbxmath.h.

{
        return asinf(x);
}
float FbxACos ( const float  x ) [inline]

Definition at line 457 of file fbxmath.h.

{
        return acosf(x);
}
double FbxACos ( const double  x ) [inline]

Definition at line 462 of file fbxmath.h.

{
        return acos(x);
}
int FbxBitCount ( const T  x ) [inline]

Definition at line 467 of file fbxmath.h.

{
        int n = 0;
        T c = x;
        while( c )
        {
                n += int(c & 1);
                c = (c >> 1);
        }
        return n;
}
void FbxFixInfinite ( T &  x ) [inline]

Definition at line 479 of file fbxmath.h.

{
        if( x != x || x > FbxMax(x) || x < -FbxMax(x) )
        {
                x = T(0);
        }
}
T FbxExp ( const T  x ) [inline]
T FbxLog ( const T  x ) [inline]
T FbxSin ( const T  x ) [inline]
T FbxASin ( const T  x ) [inline]
T FbxACos ( const T  x ) [inline]
T FbxATan ( const T  x ) [inline]
T FbxATan ( const T  y,
const T  x 
) [inline]

Variable Documentation

FBXSDK_DLL const double FbxIdentityMatrix[4][4]

Go to the source code of this file.