Keos::CMath Class Reference

Class to provide access to common mathematical functions. More...

#include <KeosMath.h>

List of all members.

Public Member Functions

 CMath ()
 Default constructor.
 ~CMath ()
 Default destructor.

Static Public Member Functions

static uint NearestPowerOfTwo (uint nValue)
 Return the nearest powewer of two of a number.
static Real UnitRandom ()
 Return random number in [0,1].
static Real RangeRandom (Real fLow, Real fHigh)
 Return random number in [fLow,fHigh].
static Real SymmetricRandom ()
 Return random number in [-1,1].
static Real DegreesToRadians (Real degrees)
 Transform degrees to radians.
static Real RadiansToDegrees (Real radians)
 Transform radians to degrees.
static bool RealEqual (Real a, Real b, Real tolerance=std::numeric_limits< Real >::epsilon())
 Compare 2 reals, using tolerance for inaccuracies.
static TVector4F calculateFaceNormal (const TVector3F &v1, const TVector3F &v2, const TVector3F &v3)
 Calculate a face normal, including the w component which is the offset from the origin.
static TVector3F calculateBasicFaceNormal (const TVector3F &v1, const TVector3F &v2, const TVector3F &v3)
 Calculate a face normal, no w-information.
static TVector4F calculateFaceNormalWithoutNormalize (const TVector3F &v1, const TVector3F &v2, const TVector3F &v3)
 Calculate a face normal without normalize, including the w component which is the offset from the origin.
static TVector3F calculateBasicFaceNormalWithoutNormalize (const TVector3F &v1, const TVector3F &v2, const TVector3F &v3)
 Calculate a face normal without normalize, no w-information.

Static Public Attributes

static const Real POS_INFINITY
static const Real NEG_INFINITY
static const Real PI
static const Real TWO_PI
static const Real HALF_PI
static const Real fDeg2Rad
static const Real fRad2Deg


Detailed Description

Class to provide access to common mathematical functions.

Note:
Code copied from Ogre3D (http://www.ogre3d.org)

Definition at line 274 of file KeosMath.h.


Constructor & Destructor Documentation

Keos::CMath::CMath (  ) 

Default constructor.

Definition at line 40 of file KeosMath.cpp.

Keos::CMath::~CMath (  ) 

Default destructor.

Definition at line 44 of file KeosMath.cpp.


Member Function Documentation

uint Keos::CMath::NearestPowerOfTwo ( uint  nValue  )  [static]

Return the nearest powewer of two of a number.

Parameters:
nValue Number to test.
Returns:
The nearest power of two.

Definition at line 48 of file KeosMath.cpp.

Real Keos::CMath::UnitRandom (  )  [static]

Return random number in [0,1].

Definition at line 65 of file KeosMath.cpp.

Referenced by RangeRandom(), and SymmetricRandom().

Real Keos::CMath::RangeRandom ( Real  fLow,
Real  fHigh 
) [static]

Return random number in [fLow,fHigh].

Definition at line 71 of file KeosMath.cpp.

References UnitRandom().

Real Keos::CMath::SymmetricRandom (  )  [static]

Return random number in [-1,1].

Definition at line 77 of file KeosMath.cpp.

References UnitRandom().

static Real Keos::CMath::DegreesToRadians ( Real  degrees  )  [inline, static]

Transform degrees to radians.

Definition at line 306 of file KeosMath.h.

Referenced by Keos::CDegree::valueRadians().

static Real Keos::CMath::RadiansToDegrees ( Real  radians  )  [inline, static]

Transform radians to degrees.

Definition at line 313 of file KeosMath.h.

Referenced by Keos::CRadian::valueDegrees().

bool Keos::CMath::RealEqual ( Real  a,
Real  b,
Real  tolerance = std::numeric_limits< Real >::epsilon() 
) [static]

Compare 2 reals, using tolerance for inaccuracies.

Definition at line 83 of file KeosMath.cpp.

TVector4F Keos::CMath::calculateFaceNormal ( const TVector3F v1,
const TVector3F v2,
const TVector3F v3 
) [static]

Calculate a face normal, including the w component which is the offset from the origin.

Definition at line 92 of file KeosMath.cpp.

References calculateBasicFaceNormal(), Keos::VectorDot(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

TVector3F Keos::CMath::calculateBasicFaceNormal ( const TVector3F v1,
const TVector3F v2,
const TVector3F v3 
) [static]

Calculate a face normal, no w-information.

Definition at line 100 of file KeosMath.cpp.

References Keos::CVector3< T >::Normalize(), and Keos::VectorCross().

Referenced by calculateFaceNormal().

TVector4F Keos::CMath::calculateFaceNormalWithoutNormalize ( const TVector3F v1,
const TVector3F v2,
const TVector3F v3 
) [static]

Calculate a face normal without normalize, including the w component which is the offset from the origin.

Definition at line 108 of file KeosMath.cpp.

References calculateBasicFaceNormalWithoutNormalize(), Keos::VectorDot(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

TVector3F Keos::CMath::calculateBasicFaceNormalWithoutNormalize ( const TVector3F v1,
const TVector3F v2,
const TVector3F v3 
) [static]

Calculate a face normal without normalize, no w-information.

Definition at line 116 of file KeosMath.cpp.

References Keos::VectorCross().

Referenced by calculateFaceNormalWithoutNormalize().


Member Data Documentation

const Real Keos::CMath::POS_INFINITY [static]

Definition at line 339 of file KeosMath.h.

const Real Keos::CMath::NEG_INFINITY [static]

Definition at line 340 of file KeosMath.h.

const Real Keos::CMath::PI [static]

Definition at line 341 of file KeosMath.h.

Referenced by Keos::CMeshGen::MakeSphere().

const Real Keos::CMath::TWO_PI [static]

Definition at line 342 of file KeosMath.h.

Referenced by Keos::CMeshGen::MakeSphere().

const Real Keos::CMath::HALF_PI [static]

Definition at line 343 of file KeosMath.h.

const Real Keos::CMath::fDeg2Rad [static]

Definition at line 344 of file KeosMath.h.

const Real Keos::CMath::fRad2Deg [static]

Definition at line 345 of file KeosMath.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 9 14:29:25 2007 for Keos by  doxygen 1.5.1-p1