#include <K3dMath.h>
Public Member Functions | |
K3dMath () | |
~K3dMath () | |
Static Public Member Functions | |
static bool | IsOddNumber (int i) |
static float | ACos (const float fValue) |
static float | ASin (const float fValue) |
static float | ATan (const float fValue) |
static float | ATan2 (const float fY, const float fX) |
static float | Ceil (const float fValue) |
static float | Cos (const float fValue) |
static float | Exp (const float fValue) |
static float | FAbs (const float fValue) |
static float | Floor (const float fValue) |
static float | FMod (const float fX, const float fY) |
static float | InvSqrt (const float fValue) |
static float | Log (const float fValue) |
static float | Pow (const float fBase, const float fExponent) |
static float | Sin (const float fValue) |
static float | Sqr (const float fValue) |
static float | Sqrt (const float fValue) |
static float | Tan (const float fValue) |
static int | Sign (const int iValue) |
static int | Sign (const float fValue) |
static float | FastSin0 (const float fAngle) |
static float | FastSin1 (const float fAngle) |
static float | FastCos0 (const float fAngle) |
static float | FastCos1 (const float fAngle) |
static float | FastTan0 (const float fAngle) |
static float | FastTan1 (const float fAngle) |
static float | FastASin (const float fValue) |
static float | FastACos (const float fValue) |
static float | FastATan0 (const float fValue) |
static float | FastATan1 (const float fValue) |
static float | UnitRandom (const float fSeed=(float) 0.0) |
static float | SymmetricRandom (const float fSeed=(float) 0.0) |
static float | IntervalRandom (const float fMin, const float fMax, const float fSeed=(float) 0.0) |
static float | Positive (const float fValue) |
If value negative change to the positive. | |
static int | Positive (const int iValue) |
If value negative change to the positive. | |
static float | Negative (const float fValue) |
If value positive change to the negative. | |
static int | Negative (const int iValue) |
If value positive change to the negative. | |
static bool | EqualRange (const float _f0, const float _f1, const float _fRange) |
Is equal two values by range ? | |
Static Public Attributes | |
static const float | EPSILON |
Common constants. | |
static const float | MAX_REAL |
static const float | K_PI |
static const float | TWO_PI |
static const float | HALF_PI |
static const float | QUARTER_PI |
static const float | THREE_HALF_PI |
static const float | INV_PI |
static const float | INV_TWO_PI |
static const float | K_DEG_TO_RAD |
static const float | K_RAD_TO_DEG |
static const float | K_FI |
Fibonacci traditional value (Golden ratio). | |
Static Private Member Functions | |
static float | ConvertHalfPiSin (const float fAngle, bool &rbNeg) |
Convert to PI/2 for fast sin, cos functions bbb Kde se tohle zobrazi???? | |
static float | ConvertHalfPiCos (const float fAngle, bool &rbNeg) |
static float | ConvertTwoPi (const float fAngle) |
Definition at line 38 of file K3dMath.h.
K3dMath::K3dMath | ( | ) |
Definition at line 33 of file K3dMath.cpp.
K3dMath::~K3dMath | ( | ) |
Definition at line 37 of file K3dMath.cpp.
float K3dMath::ConvertHalfPiSin | ( | const float | fAngle, | |
bool & | rbNeg | |||
) | [inline, static, private] |
Convert to PI/2 for fast sin, cos functions bbb Kde se tohle zobrazi????
Definition at line 288 of file K3dMath.h.
References HALF_PI, K_PI, THREE_HALF_PI, and TWO_PI.
Referenced by FastSin0(), and FastSin1().
float K3dMath::ConvertHalfPiCos | ( | const float | fAngle, | |
bool & | rbNeg | |||
) | [inline, static, private] |
Definition at line 366 of file K3dMath.h.
References HALF_PI, K_PI, THREE_HALF_PI, and TWO_PI.
Referenced by FastCos0(), and FastCos1().
float K3dMath::ConvertTwoPi | ( | const float | fAngle | ) | [inline, static, private] |
Definition at line 445 of file K3dMath.h.
References TWO_PI.
Referenced by FastTan0(), and FastTan1().
static bool K3dMath::IsOddNumber | ( | int | i | ) | [inline, static] |
float K3dMath::ACos | ( | const float | fValue | ) | [inline, static] |
Wrappers to hide implementations of functions. The ACos and ASin functions clamp the input argument to [-1,1] to avoid NaN issues when the input is slightly larger than 1 or slightly smaller than -1. Other functions have the potential for using a fast and approximate algorithm rather than calling the standard math library functions.
Definition at line 161 of file K3dMath.h.
References K_PI.
Referenced by K3dVector3Work::Angle(), K3dVector3Work::AngleBetweenNormals(), K3dQuaternion::Log(), K3dQuaternion::Slerp(), K3dQuaternion::SlerpExtraSpins(), and K3dQuaternion::ToAxisAngle().
float K3dMath::ASin | ( | const float | fValue | ) | [inline, static] |
float K3dMath::ATan | ( | const float | fValue | ) | [inline, static] |
float K3dMath::ATan2 | ( | const float | fY, | |
const float | fX | |||
) | [inline, static] |
float K3dMath::Ceil | ( | const float | fValue | ) | [inline, static] |
float K3dMath::Cos | ( | const float | fValue | ) | [inline, static] |
Definition at line 206 of file K3dMath.h.
Referenced by K3dQuaternion::Exp(), and K3dQuaternion::FromAxisAngle().
float K3dMath::Exp | ( | const float | fValue | ) | [inline, static] |
float K3dMath::FAbs | ( | const float | fValue | ) | [inline, static] |
Definition at line 216 of file K3dMath.h.
Referenced by K3dQuaternion::Exp(), K3dQuaternion::Log(), K3dQuaternion::Slerp(), and K3dQuaternion::SlerpExtraSpins().
float K3dMath::Floor | ( | const float | fValue | ) | [inline, static] |
float K3dMath::FMod | ( | const float | fX, | |
const float | fY | |||
) | [inline, static] |
float K3dMath::InvSqrt | ( | const float | fValue | ) | [inline, static] |
float K3dMath::Log | ( | const float | fValue | ) | [inline, static] |
float K3dMath::Pow | ( | const float | fBase, | |
const float | fExponent | |||
) | [inline, static] |
float K3dMath::Sin | ( | const float | fValue | ) | [inline, static] |
Definition at line 246 of file K3dMath.h.
Referenced by K3dQuaternion::Exp(), K3dQuaternion::FromAxisAngle(), K3dQuaternion::Log(), K3dQuaternion::Slerp(), and K3dQuaternion::SlerpExtraSpins().
float K3dMath::Sqr | ( | const float | fValue | ) | [inline, static] |
float K3dMath::Sqrt | ( | const float | fValue | ) | [inline, static] |
Definition at line 256 of file K3dMath.h.
Referenced by K3dQuaternion::Exp(), and K3dQuaternion::FromRotationMatrix().
float K3dMath::Tan | ( | const float | fValue | ) | [inline, static] |
int K3dMath::Sign | ( | const int | iValue | ) | [inline, static] |
Return -1 if the input is negative, 0 if the input is zero, and +1 if the input is positive.
Definition at line 266 of file K3dMath.h.
Referenced by K3dDistance::DistLinePlane(), K3dIntrLinePlane::LinePlane(), and K3dIntersection::RayPlane().
float K3dMath::FastSin0 | ( | const float | fAngle | ) | [inline, static] |
Fast evaluation of sin(angle) by polynomial approximations. The angle must be in [0,pi/2]. The maximum absolute error is about 1.7e-04 for FastSin0 and about 2.3e-09 for FastSin1. The speed up is about 2 for FastSin0 and about 1.5 for FastSin1.
Definition at line 479 of file K3dMath.h.
References ConvertHalfPiSin(), and HALF_PI.
float K3dMath::FastSin1 | ( | const float | fAngle | ) | [inline, static] |
Definition at line 511 of file K3dMath.h.
References ConvertHalfPiSin(), and HALF_PI.
Referenced by FastTan0(), and FastTan1().
float K3dMath::FastCos0 | ( | const float | fAngle | ) | [inline, static] |
Fast evaluation of cos(angle) by polynomial approximations. The angle must be in [0,pi/2]. The maximum absolute error is about 1.2e-03 for FastCos0 and about 2.3e-09 for FastCos1. The speed up is about 2 for FastCos0 and about 1.5 for FastCos1.
Definition at line 549 of file K3dMath.h.
References ConvertHalfPiCos(), and HALF_PI.
float K3dMath::FastCos1 | ( | const float | fAngle | ) | [inline, static] |
Definition at line 581 of file K3dMath.h.
References ConvertHalfPiCos(), and HALF_PI.
Referenced by FastTan0(), and FastTan1().
float K3dMath::FastTan0 | ( | const float | fAngle | ) | [inline, static] |
Fast evaluation of tan(angle) by polynomial approximations. The angle must be in [0,pi/4]. The maximum absolute error is about 8.1e-04 for FastTan0 and about 1.9e-08 for FastTan1. The speed up is about 2.5 for FastTan0 and about 1.75 for FastTan1.
Definition at line 617 of file K3dMath.h.
References ConvertTwoPi(), FastCos1(), FastSin1(), QUARTER_PI, and TWO_PI.
float K3dMath::FastTan1 | ( | const float | fAngle | ) | [inline, static] |
Definition at line 660 of file K3dMath.h.
References ConvertTwoPi(), FastCos1(), FastSin1(), QUARTER_PI, and TWO_PI.
float K3dMath::FastASin | ( | const float | fValue | ) | [inline, static] |
float K3dMath::FastACos | ( | const float | fValue | ) | [inline, static] |
float K3dMath::FastATan0 | ( | const float | fValue | ) | [inline, static] |
Fast evaluation of atan(value) by polynomial approximations. The value must be in [-1,1]. The maximum absolute error is about 1.2e-05 for FastInvTan0 and about 1.43-08 for FastInvTan1. The speed up is about 2.2 for FastInvTan0 and about 1.5 for FastInvTan1.
Definition at line 775 of file K3dMath.h.
References HALF_PI.
float K3dMath::FastATan1 | ( | const float | fValue | ) | [inline, static] |
float K3dMath::UnitRandom | ( | const float | fSeed = (float) 0.0 |
) | [inline, static] |
float K3dMath::SymmetricRandom | ( | const float | fSeed = (float) 0.0 |
) | [inline, static] |
float K3dMath::IntervalRandom | ( | const float | fMin, | |
const float | fMax, | |||
const float | fSeed = (float) 0.0 | |||
) | [inline, static] |
float K3dMath::Positive | ( | const float | fValue | ) | [inline, static] |
If value negative change to the positive.
Definition at line 896 of file K3dMath.h.
Referenced by K3dVorBsp::CheckWeight(), and K3dVector3Work::EqualRange().
int K3dMath::Positive | ( | const int | iValue | ) | [inline, static] |
float K3dMath::Negative | ( | const float | fValue | ) | [inline, static] |
int K3dMath::Negative | ( | const int | iValue | ) | [inline, static] |
bool K3dMath::EqualRange | ( | const float | _f0, | |
const float | _f1, | |||
const float | _fRange | |||
) | [static] |
Is equal two values by range ?
_f0 | First value | |
_f1 | Second value | |
_fRange | Equal range |
bool | True if first and second value are equal by range |
Definition at line 47 of file K3dMath.cpp.
Referenced by K3dVector3Obj::operator==(), and K3dVector3::operator==().
const float K3dMath::EPSILON [static] |
Common constants.
Definition at line 144 of file K3dMath.h.
Referenced by K3dQuaternion::Exp(), K3dQuaternion::Log(), K3dQuaternion::Slerp(), K3dQuaternion::SlerpExtraSpins(), and K3dQuaternion::ToAxisAngle().
const float K3dMath::MAX_REAL [static] |
Definition at line 145 of file K3dMath.h.
Referenced by K3dQuaternion::operator/(), and K3dQuaternion::operator/=().
const float K3dMath::K_PI [static] |
Definition at line 146 of file K3dMath.h.
Referenced by ACos(), ConvertHalfPiCos(), ConvertHalfPiSin(), FastACos(), and K3dQuaternion::SlerpExtraSpins().
const float K3dMath::TWO_PI [static] |
Definition at line 147 of file K3dMath.h.
Referenced by ConvertHalfPiCos(), ConvertHalfPiSin(), ConvertTwoPi(), FastTan0(), and FastTan1().
const float K3dMath::HALF_PI [static] |
Definition at line 148 of file K3dMath.h.
Referenced by ASin(), ConvertHalfPiCos(), ConvertHalfPiSin(), FastASin(), FastATan0(), FastATan1(), FastCos0(), FastCos1(), FastSin0(), and FastSin1().
const float K3dMath::QUARTER_PI [static] |
const float K3dMath::THREE_HALF_PI [static] |
const float K3dMath::INV_PI [static] |
const float K3dMath::INV_TWO_PI [static] |
const float K3dMath::K_DEG_TO_RAD [static] |
const float K3dMath::K_RAD_TO_DEG [static] |
const float K3dMath::K_FI [static] |
Fibonacci traditional value (Golden ratio).
Definition at line 155 of file K3dMath.h.
Referenced by K3dCamera::RestrictCamView().