#include <OgreMath.h>
Public Types | |
enum | AngleUnit { AU_DEGREE, AU_RADIAN } |
The angular units used by the API. More... | |
Public Methods | |
Math (unsigned int trigTableSize=4096) | |
Default constructor. | |
~Math () | |
Default destructor. | |
Static Public Methods | |
int | IAbs (int iValue) |
int | ICeil (float fValue) |
int | IFloor (float fValue) |
int | ISign (int iValue) |
Real | Abs (Real fValue) |
Real | ACos (Real fValue) |
Real | ASin (Real fValue) |
Real | ATan (Real fValue) |
Real | ATan2 (Real fY, Real fX) |
Real | Ceil (Real fValue) |
Real | Cos (Real fValue, bool useTables=false) |
Cosine function. | |
Real | Exp (Real fValue) |
Real | Floor (Real fValue) |
Real | Log (Real fValue) |
Real | Pow (Real fBase, Real fExponent) |
Real | Sign (Real fValue) |
Real | Sin (Real fValue, bool useTables=false) |
Sine function. | |
Real | Sqr (Real fValue) |
Real | Sqrt (Real fValue) |
Real | InvSqrt (Real fValue) |
Inverse square root i.e. | |
Real | UnitRandom () |
Real | RangeRandom (Real fLow, Real fHigh) |
Real | SymmetricRandom () |
Real | Tan (Real fValue, bool useTables=false) |
Tangent function. | |
Real | DegreesToRadians (Real degrees) |
Real | RadiansToDegrees (Real radians) |
void | setAngleUnit (AngleUnit unit) |
Sets the native angle units (radians or degrees) expected by and returned by the Ogre API. | |
AngleUnit | getAngleUnit (void) |
Get the unit being used for angles. | |
Real | AngleUnitsToRadians (Real units) |
Convert from the units the engine is currently using to radians. | |
Real | RadiansToAngleUnits (Real radians) |
Convert from radians to the units the engine is currently using . | |
bool | pointInTri2D (Real px, Real pz, Real ax, Real az, Real bx, Real bz, Real cx, Real cz) |
Checks wether a given point is inside a triangle, in a 2-dimensional (Cartesian) space. | |
std::pair< bool, Real > | intersects (const Ray &ray, const Plane &plane) |
Ray / plane intersection, returns boolean result and distance. | |
std::pair< bool, Real > | intersects (const Ray &ray, const Sphere &sphere) |
Ray / sphere intersection, returns boolean result and distance. | |
std::pair< bool, Real > | intersects (const Ray &ray, const AxisAlignedBox &sphere) |
Ray / box intersection, returns boolean result and distance. | |
bool | intersects (const Sphere &sphere, const AxisAlignedBox &box) |
Sphere / box intersection test. | |
bool | intersects (const Plane &plane, const AxisAlignedBox &box) |
Plane / box intersection test. | |
bool | intersects (const Sphere &sphere, const Plane &plane) |
Sphere / plane intersection test. | |
bool | RealEqual (Real a, Real b, Real tolerance=std::numeric_limits< Real >::epsilon()) |
Compare 2 reals, using tolerance for inaccuracies. | |
Vector3 | calculateTangentSpaceVector (const Vector3 &position1, const Vector3 &position2, const Vector3 &position3, Real u1, Real v1, Real u2, Real v2, Real u3, Real v3) |
Calculates the tangent space vector for a given set of positions / texture coords. | |
Matrix4 | buildReflectionMatrix (const Plane &p) |
Build a reflection matrix for the passed in plane. | |
Static Public Attributes | |
const Real | POS_INFINITY = std::numeric_limits<Real>::infinity() |
const Real | NEG_INFINITY = -std::numeric_limits<Real>::infinity() |
const Real | PI = Real( 4.0 * atan( 1.0 ) ) |
const Real | TWO_PI = Real( 2.0 * PI ) |
const Real | HALF_PI = Real( 0.5 * PI ) |
const Real | fDeg2Rad = PI / Real(180.0) |
const Real | fRad2Deg = Real(180.0) / PI |
Protected Methods | |
void | buildTrigTables () |
Private function to build trig tables. | |
Static Protected Methods | |
Real | SinTable (Real fValue) |
Real | TanTable (Real fValue) |
Static Protected Attributes | |
AngleUnit | msAngleUnit |
int | mTrigTableSize |
Size of the trig tables as determined by constructor. | |
Real | mTrigTableFactor |
Radian -> index factor value ( mTrigTableSize / 2 * PI ). | |
Real * | mSinTable = NULL |
Real * | mTanTable = NULL |
Definition at line 42 of file OgreMath.h.
|
The angular units used by the API.
Definition at line 49 of file OgreMath.h. |
|
Default constructor.
Definition at line 55 of file OgreMath.cpp. References AU_DEGREE, buildTrigTables(), msAngleUnit, mSinTable, mTanTable, mTrigTableFactor, mTrigTableSize, and Ogre::Real. |
|
Default destructor.
Definition at line 72 of file OgreMath.cpp. |
|
Definition at line 90 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 122 of file OgreMath.cpp. References PI, and Ogre::Real. |
|
Convert from the units the engine is currently using to radians.
Definition at line 196 of file OgreMath.cpp. References AU_DEGREE, fDeg2Rad, msAngleUnit, and Ogre::Real. |
|
Definition at line 137 of file OgreMath.cpp. References HALF_PI, and Ogre::Real. |
|
Definition at line 93 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 94 of file OgreMath.h. References Ogre::Real. |
|
Build a reflection matrix for the passed in plane.
Definition at line 565 of file OgreMath.cpp. References Ogre::Plane::d, Ogre::Plane::normal, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. |
|
Private function to build trig tables.
Definition at line 79 of file OgreMath.cpp. References mSinTable, mTanTable, mTrigTableSize, and Ogre::Real. Referenced by Math(). |
|
Calculates the tangent space vector for a given set of positions / texture coords.
Definition at line 527 of file OgreMath.cpp. References Ogre::Vector3::crossProduct(), Ogre::Vector3::dotProduct(), Ogre::Vector3::normalise(), and Ogre::Real. |
|
Definition at line 95 of file OgreMath.h. References Ogre::Real. |
|
Cosine function.
Definition at line 104 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 155 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 108 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 110 of file OgreMath.h. References Ogre::Real. |
|
Get the unit being used for angles.
Definition at line 191 of file OgreMath.cpp. References msAngleUnit. |
|
Definition at line 85 of file OgreMath.h. |
|
Definition at line 86 of file OgreMath.h. |
|
Definition at line 87 of file OgreMath.h. |
|
Sphere / plane intersection test.
Definition at line 520 of file OgreMath.cpp. References Ogre::Vector3::dotProduct(), Ogre::Sphere::getCenter(), Ogre::Sphere::getRadius(), and Ogre::Plane::normal. |
|
Plane / box intersection test.
Definition at line 497 of file OgreMath.cpp. References Ogre::AxisAlignedBox::getAllCorners(), Ogre::Plane::getSide(), and Ogre::AxisAlignedBox::isNull(). |
|
Sphere / box intersection test.
Definition at line 448 of file OgreMath.cpp. References Ogre::Sphere::getCenter(), Ogre::AxisAlignedBox::getMaximum(), Ogre::AxisAlignedBox::getMinimum(), Ogre::Sphere::getRadius(), Ogre::AxisAlignedBox::isNull(), Ogre::Real, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. |
|
Ray / box intersection, returns boolean result and distance.
Definition at line 321 of file OgreMath.cpp. References Ogre::Ray::getDirection(), Ogre::AxisAlignedBox::getMaximum(), Ogre::AxisAlignedBox::getMinimum(), Ogre::Ray::getOrigin(), Ogre::AxisAlignedBox::isNull(), Ogre::Real, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. |
|
Ray / sphere intersection, returns boolean result and distance.
Definition at line 282 of file OgreMath.cpp. References Ogre::Vector3::dotProduct(), Ogre::Sphere::getCenter(), Ogre::Ray::getDirection(), Ogre::Ray::getOrigin(), Ogre::Sphere::getRadius(), Ogre::Real, and Ogre::Vector3::squaredLength(). |
|
Ray / plane intersection, returns boolean result and distance.
Definition at line 264 of file OgreMath.cpp. References Ogre::Plane::d, Ogre::Vector3::dotProduct(), Ogre::Ray::getDirection(), Ogre::Ray::getOrigin(), Ogre::Plane::normal, and Ogre::Real. |
|
Inverse square root i.e. 1 / Sqrt(x), good for vector normalisation. Definition at line 163 of file OgreMath.cpp. References Ogre::Real. |
|
Definition at line 117 of file OgreMath.cpp. |
|
Definition at line 112 of file OgreMath.h. References Ogre::Real. |
|
Checks wether a given point is inside a triangle, in a 2-dimensional (Cartesian) space.
Definition at line 214 of file OgreMath.cpp. References Ogre::Real. |
|
Definition at line 114 of file OgreMath.h. References Ogre::Real. |
|
Convert from radians to the units the engine is currently using .
Definition at line 205 of file OgreMath.cpp. References AU_DEGREE, fRad2Deg, msAngleUnit, and Ogre::Real. |
|
Definition at line 156 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 174 of file OgreMath.cpp. References Ogre::Real, and UnitRandom(). |
|
Compare 2 reals, using tolerance for inaccuracies.
Definition at line 255 of file OgreMath.cpp. References Ogre::Real. |
|
Sets the native angle units (radians or degrees) expected by and returned by the Ogre API.
Definition at line 186 of file OgreMath.cpp. References msAngleUnit. |
|
Definition at line 152 of file OgreMath.cpp. References Ogre::Real. |
|
Sine function.
Definition at line 125 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 94 of file OgreMath.cpp. References mSinTable, mTrigTableFactor, mTrigTableSize, and Ogre::Real. |
|
Definition at line 129 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 131 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 180 of file OgreMath.cpp. References Ogre::Real, and UnitRandom(). |
|
Tangent function.
Definition at line 151 of file OgreMath.h. References Ogre::Real. |
|
Definition at line 110 of file OgreMath.cpp. References mTanTable, mTrigTableFactor, mTrigTableSize, and Ogre::Real. |
|
Definition at line 168 of file OgreMath.cpp. References Ogre::Real. Referenced by RangeRandom(), and SymmetricRandom(). |
|
Definition at line 44 of file OgreMath.cpp. Referenced by AngleUnitsToRadians(). |
|
Definition at line 45 of file OgreMath.cpp. Referenced by RadiansToAngleUnits(). |
|
Definition at line 43 of file OgreMath.cpp. Referenced by ASin(). |
|
Definition at line 48 of file OgreMath.cpp. Referenced by AngleUnitsToRadians(), getAngleUnit(), Math(), RadiansToAngleUnits(), and setAngleUnit(). |
|
Definition at line 51 of file OgreMath.cpp. Referenced by buildTrigTables(), Math(), SinTable(), and ~Math(). |
|
Definition at line 52 of file OgreMath.cpp. Referenced by buildTrigTables(), Math(), TanTable(), and ~Math(). |
|
Radian -> index factor value ( mTrigTableSize / 2 * PI ).
Definition at line 50 of file OgreMath.cpp. |
|
Size of the trig tables as determined by constructor.
Definition at line 47 of file OgreMath.cpp. Referenced by buildTrigTables(), Math(), SinTable(), and TanTable(). |
|
Definition at line 40 of file OgreMath.cpp. |
|
Definition at line 41 of file OgreMath.cpp. Referenced by ACos(). |
|
Definition at line 39 of file OgreMath.cpp. |
|
Definition at line 42 of file OgreMath.cpp. |
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:18:07 2004