My Project
Static Public Member Functions | List of all members
ParaEngine::CMath Class Reference

Static Public Member Functions

static bool SmoothMoveFloat1 (float &src, const float dest, const float fMaxStep)
 change src from src to dest, by a maximum of fMaxStep. More...
 
static bool SmoothMoveAngle1 (float &src, const float dest, const float fMaxStep)
 change src from src to dest, by a maximum of fMaxStep. More...
 
static bool SmoothMoveVec3 (Vector3 *result, const Vector3 &vPosTarget, const Vector3 &vPos, FLOAT fIncrease, FLOAT fTolerance)
 linearly (smoothly) move vPos to vPosTarget by the amount fIncrease return true if we have reached the target. More...
 
static float ToStandardAngle (float fAngle)
 make sure that the angle is in the range (-Pi,Pi]
 
static bool MatchString (const std::string &matchPattern, const std::string &matchStr)
 check if the matchStr matches the string pattern in matchPattern More...
 
static bool ComputeFacingTarget (const Vector3 &target, const Vector3 &source, FLOAT &fFacing)
 facing target in xz plane fFacing: [out] it is in the range [0, 2PI] return true if target!=source(a valid facing can be computed)
 
static int Round (float fValue)
 get the closest integer near the specified float number. More...
 
static float MinVec3 (const Vector3 &v)
 Returns MIN(x, y, z);.
 
static float MaxVec3 (const Vector3 &v)
 Returns MAX(x, y, z);.
 
template<class T >
static bool CompareXZ (const T &a, const T &b)
 return true if equal. More...
 
template<class T >
static bool CompareXZ (const T &a, const T &b, float epsilon)
 return true if equal. More...
 
static void GetMatrixScaling (const Matrix4 &globalMat, float *fScalingX, float *fScalingY, float *fScalingZ)
 Get the scaling factor from globalMat. More...
 
static Matrix4CreateBillboardMatrix (Matrix4 *pOut, const Matrix4 *matModelview, const Vector3 *vBillboardPos, bool bAxisAligned=false)
 create a billboard matrix More...
 
static void CameraRotMatrixYawPitch (Matrix4 &out, float fYaw, float fPitch)
 

Member Function Documentation

§ CompareXZ() [1/2]

template<class T >
static bool ParaEngine::CMath::CompareXZ ( const T &  a,
const T &  b 
)
inlinestatic

return true if equal.

T is a 3D vector, such as Vector3

§ CompareXZ() [2/2]

template<class T >
static bool ParaEngine::CMath::CompareXZ ( const T &  a,
const T &  b,
float  epsilon 
)
inlinestatic

return true if equal.

T is a 3D vector, such as Vector3

§ CreateBillboardMatrix()

static Matrix4* ParaEngine::CMath::CreateBillboardMatrix ( Matrix4 pOut,
const Matrix4 matModelview,
const Vector3 vBillboardPos,
bool  bAxisAligned = false 
)
static

create a billboard matrix

Parameters
pOut[out], the output billboard matrix
matModelviewthe current model view matrix. if NULL, the current model and view matrix on the global stack is used
vBillboardPosthe billboard position in model space. if NULL, (0,0,0) is used.
bAxisAlignedif true, it will create a billboard with Y (up) axis fixed. Default to false.
Returns
pOut is returned.

§ GetMatrixScaling()

static void ParaEngine::CMath::GetMatrixScaling ( const Matrix4 globalMat,
float *  fScalingX,
float *  fScalingY,
float *  fScalingZ 
)
static

Get the scaling factor from globalMat.

since we need to create separate physics mesh with different scaling factors even for the same mesh model. it is assumed that components of globalMat satisfies the following equation: |(globalMat._11, globalMat._12, globalMat._13)| = 1; |(globalMat._21, globalMat._22, globalMat._23)| = 1; |(globalMat._31, globalMat._32, globalMat._33)| = 1;

Parameters
globalMatthe input matrix
fScalingX[out] maybe NULL
fScalingY[out] maybe NULL
fScalingZ[out] maybe NULL

§ MatchString()

static bool ParaEngine::CMath::MatchString ( const std::string &  matchPattern,
const std::string &  matchStr 
)
static

check if the matchStr matches the string pattern in matchPattern

Parameters
matchPatternthe match pattern. It may end with "*" in which case "*" will match any character(s). e.g "Li*" will match both "LiXizhi" and "LiTC", whereas "Li" will only match "Li"
matchStrthe match string.
Returns
: return true if the two string matches.

§ Round()

static int ParaEngine::CMath::Round ( float  fValue)
inlinestatic

get the closest integer near the specified float number.

E.g. Round(1.49)==1, Round(1.51)==2, ToInt(

§ SmoothMoveAngle1()

static bool ParaEngine::CMath::SmoothMoveAngle1 ( float &  src,
const float  dest,
const float  fMaxStep 
)
static

change src from src to dest, by a maximum of fMaxStep.

If dest has been reached, return true; otherwise return false.

§ SmoothMoveFloat1()

static bool ParaEngine::CMath::SmoothMoveFloat1 ( float &  src,
const float  dest,
const float  fMaxStep 
)
static

change src from src to dest, by a maximum of fMaxStep.

If dest has been reached, return true; otherwise return false.

§ SmoothMoveVec3()

static bool ParaEngine::CMath::SmoothMoveVec3 ( Vector3 result,
const Vector3 vPosTarget,
const Vector3 vPos,
FLOAT  fIncrease,
FLOAT  fTolerance 
)
static

linearly (smoothly) move vPos to vPosTarget by the amount fIncrease return true if we have reached the target.

if the distance between target and the pos is within fTolerance, result is set to target


The documentation for this class was generated from the following file: