Loading...
Searching...
No Matches
Ogre::Math Class Reference
Core » Math

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

`#include <OgreMath.h>`

## Classes

class | RandomValueProvider
| This class is used to provide an external random value provider. More...

## Public Types

enum | AngleUnit { AU_DEGREE , AU_RADIAN }
| The angular units used by the API. More...

## Public Member Functions

| Math (unsigned int trigTableSize=4096)
| Default constructor.
| ~Math ()
| Default destructor.

## Static Public Member Functions

static Degree | Abs (const Degree &dValue)
| Absolute value function.
static Radian | Abs (const Radian &rValue)
| Absolute value function.
static Real | Abs (Real fValue)
| Absolute value function.
static Radian | ACos (Real fValue)
| Arc cosine function.
static float | AngleUnitsToDegrees (float units)
| Convert from the current AngleUnit to degrees.
static float | AngleUnitsToRadians (float units)
| Convert from the current AngleUnit to radians.
static Radian | ASin (Real fValue)
| Arc sine function.
static Radian | ATan (float fValue)
| Arc tangent function.
static Radian | ATan2 (float fY, float fX)
| Arc tangent between two values function.
static Real | boundingRadiusFromAABB (const AxisAlignedBox &aabb)
| Get the radius of the origin-centered bounding sphere from the bounding box.
static Real | boundingRadiusFromAABBCentered (const AxisAlignedBox &aabb)
| Get the radius of the bbox-centered bounding sphere from the bounding box.
static Affine3 | buildReflectionMatrix (const Plane &p)
| Build a reflection matrix for the passed in plane.
static Vector3 | calculateBasicFaceNormal (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
| Calculate a face normal, no w-information.
static Vector3 | calculateBasicFaceNormalWithoutNormalize (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
| Calculate a face normal without normalize, no w-information.
static Vector4 | calculateFaceNormal (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
| Calculate a face normal, including the w component which is the offset from the origin.
static Vector4 | calculateFaceNormalWithoutNormalize (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
| Calculate a face normal without normalize, including the w component which is the offset from the origin.
static Vector3 | calculateTangentSpaceVector (const Vector3 &position1, const Vector3 &position2, const Vector3 &position3, Real u1, Real v1, Real u2, Real v2, Real u3, Real v3)
static Real | Ceil (Real fValue)
| Ceiling function Returns the smallest following integer.
template<typename T>
static T | Clamp (T val, T minval, T maxval)
| Clamp a value within an inclusive range.
static float | Cos (const Radian &fValue, bool useTables=false)
| Cosine function.
static float | Cos (float fValue, bool useTables=false)
| Cosine function.
static float | DegreesToAngleUnits (float degrees)
| Convert from degrees to the current AngleUnit.
static float | DegreesToRadians (float degrees)
static Real | Exp (Real fValue)
static Real | Floor (Real fValue)
| Floor function Returns the largest previous integer.
static Real | gaussianDistribution (Real x, Real offset=0.0f, Real scale=1.0f)
| Generates a value based on the Gaussian (normal) distribution function with the given offset and scale parameters.
static AngleUnit | getAngleUnit (void)
| Get the unit being used for angles.
static int | IAbs (int iValue)
static int | ICeil (float fValue)
static int | IFloor (float fValue)
static bool | intersects (const Plane &plane, const AxisAlignedBox &box)
| Plane / box intersection test.
static RayTestResult | intersects (const Ray &ray, const AxisAlignedBox &box)
| Ray / box intersection.
static bool | intersects (const Ray &ray, const AxisAlignedBox &box, Real *d1, Real *d2)
| Ray / box intersection, returns boolean result and two intersection distance.
static RayTestResult | intersects (const Ray &ray, const Plane &plane)
| Ray / plane intersection.
static RayTestResult | intersects (const Ray &ray, const Sphere &sphere, bool discardInside=true)
| Ray / sphere intersection.
static RayTestResult | intersects (const Ray &ray, const std::vector< Plane > &planeList, bool normalIsOutside)
| Ray / convex plane list intersection test.
static RayTestResult | intersects (const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, bool positiveSide=true, bool negativeSide=true)
| Ray / triangle intersection [moller1997fast], returns boolean result and distance.
static RayTestResult | intersects (const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &normal, bool positiveSide=true, bool negativeSide=true)
static bool | intersects (const Sphere &sphere, const AxisAlignedBox &box)
| Sphere / box intersection test.
static bool | intersects (const Sphere &sphere, const Plane &plane)
| Sphere / plane intersection test.
static Real | InvSqrt (Real fValue)
| Inverse square root i.e.
static int | ISign (int iValue)
static bool | isNaN (Real f)
template<typename V, typename T>
static V | lerp (const V &v0, const V &v1, const T &t)
| Simulate the shader function lerp which performers linear interpolation.
static Real | Log (Real fValue)
static Real | Log2 (Real fValue)
static Real | LogN (Real base, Real fValue)
static Matrix3 | lookRotation (const Vector3 &direction, const Vector3 &yaw)
| Create a rotation matrix from direction and yaw.
static Matrix4 | makePerspectiveMatrix (Real left, Real right, Real bottom, Real top, Real zNear, Real zFar)
| This creates 'uniform' perspective projection matrix, which depth range [-1,1], right-handed rules.
static Affine3 | makeViewMatrix (const Vector3 &position, const Quaternion &orientation, const Affine3 *reflectMatrix=0)
| This creates a view matrix.
static bool | pointInTri2D (const Vector2 &p, const Vector2 &a, const Vector2 &b, const Vector2 &c)
| Checks whether a given point is inside a triangle, in a 2-dimensional (Cartesian) space.
static bool | pointInTri3D (const Vector3 &p, const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &normal)
| Checks whether a given 3D point is inside a triangle.
static Real | Pow (Real fBase, Real fExponent)
static float | RadiansToAngleUnits (float radians)
| Convert from radians to the current AngleUnit .
static float | RadiansToDegrees (float radians)
static float | RangeRandom (float fLow, float fHigh)
| Generate a random number within the range provided.
static bool | RealEqual (Real a, Real b, Real tolerance=std::numeric_limits< Real >::epsilon())
| Compare 2 reals, using tolerance for inaccuracies.
static double | saturate (double t)
static float | saturate (float t)
| Simulate the shader function saturate that clamps a parameter value between 0 and 1.
static void | setAngleUnit (AngleUnit unit)
| These functions used to set the assumed angle units (radians or degrees) expected when using the Angle type.
static void | SetRandomValueProvider (RandomValueProvider *provider)
static Degree | Sign (const Degree &dValue)
static Radian | Sign (const Radian &rValue)
static Real | Sign (Real fValue)
static float | Sin (const Radian &fValue, bool useTables=false)
| Sine function.
static float | Sin (Real fValue, bool useTables=false)
| Sine function.
static Real | Sqr (Real fValue)
| Squared function.
static Degree | Sqrt (const Degree &fValue)
| Square root function.
static Radian | Sqrt (const Radian &fValue)
| Square root function.
static Real | Sqrt (Real fValue)
| Square root function.
static float | SymmetricRandom ()
| Generate a random number in the range [-1,1].
static float | Tan (const Radian &fValue, bool useTables=false)
| Tangent function.
static float | Tan (Real fValue, bool useTables=false)
| Tangent function.
static uint16 | uint16Cast (size_t t)
| saturated cast of size_t to uint16
static float | UnitRandom ()
| Generate a random number of unit length.

## Static Public Attributes

static constexpr float | fDeg2Rad = PI / Real(180.0)
static constexpr float | fRad2Deg = Real(180.0) / PI
static constexpr Real | HALF_PI = Real( 0.5 * PI )
static constexpr Real | LOG2 = static_cast<Real> (0.69314718055994530942)
| Stored value of log(2) for frequent use.
static constexpr Real | NEG_INFINITY = -std::numeric_limits<Real>::infinity()
static constexpr Real | PI = static_cast<Real> (3.14159265358979323846)
static constexpr Real | POS_INFINITY = std::numeric_limits<Real>::infinity()
static constexpr Real | TWO_PI = Real( 2.0 * PI )

## Detailed Description

Class to provide access to common mathematical functions.

Most of the maths functions are aliased versions of the C runtime library functions. They are aliased here to provide future optimisation opportunities, either from faster RTLs or custom math approximations.

Note
  This is based on MgcMath.h from Wild Magic.

## Member Enumeration Documentation

## AngleUnit

enum Ogre::Math::AngleUnit

The angular units used by the API.

This functionality is now deprecated in favor of discreet angular unit types ( see Degree and Radian above ). The only place this functionality is actually still used is when parsing files. Search for usage of the Angle class for those instances

Enumerator
AU_DEGREE |
AU_RADIAN |

## Constructor & Destructor Documentation

## Math()

Ogre::Math::Math | ( | unsigned int | trigTableSize = 4096 | ) |

Default constructor.

Parameters

  trigTableSize | Optional parameter to set the size of the tables used to implement Sin, Cos, Tan

## ~Math()

Ogre::Math::~Math | ( |  | ) |

Default destructor.

## Member Function Documentation

## IAbs()

int Ogre::Math::IAbs | ( | int | iValue | ) |

inline static

## ICeil()

int Ogre::Math::ICeil | ( | float | fValue | ) |

inline static

## IFloor()

int Ogre::Math::IFloor | ( | float | fValue | ) |

inline static

## ISign()

int Ogre::Math::ISign | ( | int | iValue | ) |

inline static

## Abs() [1/3]

Real Ogre::Math::Abs | ( | Real | fValue | ) |

inline static

Absolute value function.

Parameters

  fValue | The value whose absolute value will be returned.

Referenced by Ogre::VectorBase< 3, Real >::absDotProduct(), Ogre::VectorBase< 3, Real >::directionEquals(), Ogre::Quaternion::equals(), Ogre::VectorBase< 3, Real >::getRotationTo(), Ogre::Ray::intersects(), Ogre::Sphere::intersects(), Ogre::Volume::OctreeNode::isIsoSurfaceNear(), Ogre::VectorBase< 3, Real >::perpendicular(), Ogre::VectorBase< 3, Real >::primaryAxis(), and Ogre::AxisAlignedBox::transform().

## Abs() [2/3]

Degree Ogre::Math::Abs | ( | const Degree & | dValue | ) |

inline static

Absolute value function.

Parameters

  dValue | The value, in degrees, whose absolute value will be returned.

References Ogre::Degree::valueDegrees().

## Abs() [3/3]

Radian Ogre::Math::Abs | ( | const Radian & | rValue | ) |

inline static

Absolute value function.

Parameters

  rValue | The value, in radians, whose absolute value will be returned.

References Ogre::Radian::valueRadians().

## ACos()

Radian Ogre::Math::ACos | ( | Real | fValue | ) |

static

Arc cosine function.

Parameters

  fValue | The value whose arc cosine will be returned.

Referenced by Ogre::Vector< 2, Real >::angleBetween(), Ogre::VectorBase< 3, Real >::directionEquals(), and Ogre::Quaternion::equals().

## ASin()

Radian Ogre::Math::ASin | ( | Real | fValue | ) |

static

Arc sine function.

Parameters

  fValue | The value whose arc sine will be returned.

## ATan()

Radian Ogre::Math::ATan | ( | float | fValue | ) |

inline static

Arc tangent function.

Parameters

  fValue | The value whose arc tangent will be returned.

## ATan2()

Radian Ogre::Math::ATan2 | ( | float | fY,
|  | float | fX )

inline static

Arc tangent between two values function.

Parameters

  fY | The first value to calculate the arc tangent with.
  fX | The second value to calculate the arc tangent with.

## Ceil()

Real Ogre::Math::Ceil | ( | Real | fValue | ) |

inline static

Ceiling function Returns the smallest following integer.

(example: Ceil(1.1) = 2)

Parameters

  fValue | The value to round up to the nearest integer.

## isNaN()

bool Ogre::Math::isNaN | ( | Real | f | ) |

inline static

Referenced by Ogre::DualQuaternion::isNaN(), Ogre::Quaternion::isNaN(), and Ogre::Vector< 2, Real >::isNaN().

## Cos() [1/2]

float Ogre::Math::Cos | ( | const Radian & | fValue,
|  | bool | useTables = false )

inline static

Cosine function.

Parameters

  fValue | Angle in radians
  useTables | If true, uses lookup tables rather than calculation - faster but less accurate.

References HALF_PI, and Ogre::Radian::valueRadians().

Referenced by Ogre::VectorBase< 2, Real >::randomDeviant().

## Cos() [2/2]

float Ogre::Math::Cos | ( | float | fValue,
|  | bool | useTables = false )

inline static

Cosine function.

Parameters

  fValue | Angle in radians
  useTables | If true, uses lookup tables rather than calculation - faster but less accurate.

References HALF_PI.

## Exp()

Real Ogre::Math::Exp | ( | Real | fValue | ) |

inline static

## Floor()

Real Ogre::Math::Floor | ( | Real | fValue | ) |

inline static

Floor function Returns the largest previous integer.

(example: Floor(1.9) = 1)

Parameters

  fValue | The value to round down to the nearest integer.

## Log()

Real Ogre::Math::Log | ( | Real | fValue | ) |

inline static

## Log2()

Real Ogre::Math::Log2 | ( | Real | fValue | ) |

inline static

## LogN()

Real Ogre::Math::LogN | ( | Real | base,
|  | Real | fValue )

inline static

## Pow()

Real Ogre::Math::Pow | ( | Real | fBase,
|  | Real | fExponent )

inline static

## Sign() [1/3]

Real Ogre::Math::Sign | ( | Real | fValue | ) |

inline static

Referenced by Sign(), and Sign().

## Sign() [2/3]

Radian Ogre::Math::Sign | ( | const Radian & | rValue | ) |

inline static

References Sign(), and Ogre::Radian::valueRadians().

## Sign() [3/3]

Degree Ogre::Math::Sign | ( | const Degree & | dValue | ) |

inline static

References Sign(), and Ogre::Degree::valueDegrees().

## saturate() [1/2]

float Ogre::Math::saturate | ( | float | t | ) |

inline static

Simulate the shader function saturate that clamps a parameter value between 0 and 1.

## saturate() [2/2]

double Ogre::Math::saturate | ( | double | t | ) |

inline static

## uint16Cast()

uint16 Ogre::Math::uint16Cast | ( | size_t | t | ) |

inline static

saturated cast of size_t to uint16

## lerp()

template<typename V, typename T>

V Ogre::Math::lerp | ( | const V & | v0,
|  | const V & | v1,
|  | const T & | t )

inline static

Simulate the shader function lerp which performers linear interpolation.

given 3 parameters v0, v1 and t the function returns the value of (1 - t)* v0 + t * v1. where v0 and v1 are matching vector or scalar types and t can be either a scalar or a vector of the same type as a and b.

## Sin() [1/2]

float Ogre::Math::Sin | ( | const Radian & | fValue,
|  | bool | useTables = false )

inline static

Sine function.

Parameters

  fValue | Angle in radians
  useTables | If true, uses lookup tables rather than calculation - faster but less accurate.

References Ogre::Radian::valueRadians().

Referenced by Ogre::VectorBase< 2, Real >::randomDeviant().

## Sin() [2/2]

float Ogre::Math::Sin | ( | Real | fValue,
|  | bool | useTables = false )

inline static

Sine function.

Parameters

  fValue | Angle in radians
  useTables | If true, uses lookup tables rather than calculation - faster but less accurate.

## Sqr()

Real Ogre::Math::Sqr | ( | Real | fValue | ) |

inline static

Squared function.

Parameters

  fValue | The value to be squared (fValue^2)

Referenced by Ogre::Sphere::intersects(), Ogre::Sphere::intersects(), and Ogre::Sphere::merge().

## Sqrt() [1/3]

Real Ogre::Math::Sqrt | ( | Real | fValue | ) |

inline static

Square root function.

Parameters

  fValue | The value whose square root will be calculated.

Referenced by Ogre::AxisAlignedBox::distance(), Ogre::VectorBase< 3, Real >::getRotationTo(), Ogre::Ray::intersects(), Ogre::Vector< 2, Real >::length(), Ogre::Sphere::merge(), and Ogre::Quaternion::Norm().

## Sqrt() [2/3]

Radian Ogre::Math::Sqrt | ( | const Radian & | fValue | ) |

inline static

Square root function.

Parameters

  fValue | The value, in radians, whose square root will be calculated.

Returns
  The square root of the angle in radians.

References Ogre::Radian::valueRadians().

## Sqrt() [3/3]

Degree Ogre::Math::Sqrt | ( | const Degree & | fValue | ) |

inline static

Square root function.

Parameters

  fValue | The value, in degrees, whose square root will be calculated.

Returns
  The square root of the angle in degrees.

References Ogre::Degree::valueDegrees().

## InvSqrt()

Real Ogre::Math::InvSqrt | ( | Real | fValue | ) |

inline static

Inverse square root i.e.

1 / Sqrt(x), good for vector normalisation.

Parameters

  fValue | The value whose inverse square root will be calculated.

## UnitRandom()

float Ogre::Math::UnitRandom | ( |  | ) |

inline static

Generate a random number of unit length.

Returns
  A random number in the range from [0,1].

Referenced by Ogre::VectorBase< 3, Real >::randomDeviant(), RangeRandom(), and SymmetricRandom().

## RangeRandom()

float Ogre::Math::RangeRandom | ( | float | fLow,
|  | float | fHigh )

inline static

Generate a random number within the range provided.

Parameters

  fLow | The lower bound of the range.
  fHigh | The upper bound of the range.

Returns
  A random number in the range from [fLow,fHigh].

References UnitRandom().

Referenced by Ogre::VectorBase< 2, Real >::randomDeviant().

## SymmetricRandom()

float Ogre::Math::SymmetricRandom | ( |  | ) |

inline static

Generate a random number in the range [-1,1].

Returns
  A random number in the range from [-1,1].

References UnitRandom().

## SetRandomValueProvider()

void Ogre::Math::SetRandomValueProvider | ( | RandomValueProvider * | provider | ) |

static

## Tan() [1/2]

float Ogre::Math::Tan | ( | const Radian & | fValue,
|  | bool | useTables = false )

inline static

Tangent function.

Parameters

  fValue | Angle in radians
  useTables | If true, uses lookup tables rather than calculation - faster but less accurate.

References Ogre::Radian::valueRadians().

## Tan() [2/2]

float Ogre::Math::Tan | ( | Real | fValue,
|  | bool | useTables = false )

inline static

Tangent function.

Parameters

  fValue | Angle in radians
  useTables | If true, uses lookup tables rather than calculation - faster but less accurate.

## DegreesToRadians()

float Ogre::Math::DegreesToRadians | ( | float | degrees | ) |

inline static

References fDeg2Rad.

Referenced by Ogre::Degree::valueRadians().

## RadiansToDegrees()

float Ogre::Math::RadiansToDegrees | ( | float | radians | ) |

inline static

References fRad2Deg.

Referenced by Ogre::Radian::valueDegrees().

## setAngleUnit()

void Ogre::Math::setAngleUnit | ( | AngleUnit | unit | ) |

static

These functions used to set the assumed angle units (radians or degrees) expected when using the Angle type.

  You can set this directly after creating a new Root, and also before/after resource creation, depending on whether you want the change to affect resource files.

## getAngleUnit()

AngleUnit Ogre::Math::getAngleUnit | ( | void |  | ) |

static

Get the unit being used for angles.

## AngleUnitsToRadians()

float Ogre::Math::AngleUnitsToRadians | ( | float | units | ) |

static

Convert from the current AngleUnit to radians.

Referenced by Ogre::Angle::operator Radian().

## RadiansToAngleUnits()

float Ogre::Math::RadiansToAngleUnits | ( | float | radians | ) |

static

Convert from radians to the current AngleUnit .

Referenced by Ogre::Radian::valueAngleUnits().

## AngleUnitsToDegrees()

float Ogre::Math::AngleUnitsToDegrees | ( | float | units | ) |

static

Convert from the current AngleUnit to degrees.

Referenced by Ogre::Angle::operator Degree().

## DegreesToAngleUnits()

float Ogre::Math::DegreesToAngleUnits | ( | float | degrees | ) |

static

Convert from degrees to the current AngleUnit.

Referenced by Ogre::Degree::valueAngleUnits().

## pointInTri2D()

bool Ogre::Math::pointInTri2D | ( | const Vector2 & | p,
|  | const Vector2 & | a,
|  | const Vector2 & | b,
|  | const Vector2 & | c )

static

Checks whether a given point is inside a triangle, in a 2-dimensional (Cartesian) space.

The vertices of the triangle must be given in either trigonometrical (anticlockwise) or inverse trigonometrical (clockwise) order.

Parameters

  p | The point.
  a | The triangle's first vertex.
  b | The triangle's second vertex.
  c | The triangle's third vertex.

Returns
  If the point resides in the triangle, true is returned.

  If the point is outside the triangle, false is returned.

## pointInTri3D()

bool Ogre::Math::pointInTri3D | ( | const Vector3 & | p,
|  | const Vector3 & | a,
|  | const Vector3 & | b,
|  | const Vector3 & | c,
|  | const Vector3 & | normal )

static

Checks whether a given 3D point is inside a triangle.

The vertices of the triangle must be given in either trigonometrical (anticlockwise) or inverse trigonometrical (clockwise) order, and the point must be guaranteed to be in the same plane as the triangle

Parameters

  p | p The point.
  a | The triangle's first vertex.
  b | The triangle's second vertex.
  c | The triangle's third vertex.
  normal | The triangle plane's normal (passed in rather than calculated on demand since the caller may already have it)

Returns
  If the point resides in the triangle, true is returned.

  If the point is outside the triangle, false is returned.

References intersects().

## intersects() [1/6]

RayTestResult Ogre::Math::intersects | ( | const Ray & | ray,
|  | const AxisAlignedBox & | box )

static

Ray / box intersection.

## intersects() [2/6]

bool Ogre::Math::intersects | ( | const Ray & | ray,
|  | const AxisAlignedBox & | box,
|  | Real * | d1,
|  | Real * | d2 )

static

Ray / box intersection, returns boolean result and two intersection distance.

Parameters

  ray | The ray.
  box | The box.
  d1 | A real pointer to retrieve the near intersection distance from the ray origin, maybe null which means don't care about the near intersection distance.
  d2 | A real pointer to retrieve the far intersection distance from the ray origin, maybe null which means don't care about the far intersection distance.

Returns
  If the ray is intersects the box, true is returned, and the near intersection distance is return by d1, the far intersection distance is return by d2. Guarantee 0 <= d1 <= d2.

  If the ray isn't intersects the box, false is returned, and d1 and d2 is unmodified.

## intersects() [3/6]

RayTestResult Ogre::Math::intersects | ( | const Ray & | ray,
|  | const Vector3 & | a,
|  | const Vector3 & | b,
|  | const Vector3 & | c,
|  | bool | positiveSide = true,
|  | bool | negativeSide = true )

static

Ray / triangle intersection [moller1997fast], returns boolean result and distance.

Parameters

  ray | The ray.
  a | The triangle's first vertex.
  b | The triangle's second vertex.
  c | The triangle's third vertex.
  positiveSide | Intersect with "positive side" of the triangle (as determined by vertex winding)
  negativeSide | Intersect with "negative side" of the triangle (as determined by vertex winding)

## intersects() [4/6]

RayTestResult Ogre::Math::intersects | ( | const Ray & | ray,
|  | const Vector3 & | a,
|  | const Vector3 & | b,
|  | const Vector3 & | c,
|  | const Vector3 & | normal,
|  | bool | positiveSide = true,
|  | bool | negativeSide = true )

inline static

Deprecated
  normal parameter is not used any more

References intersects().

## intersects() [5/6]

bool Ogre::Math::intersects | ( | const Sphere & | sphere,
|  | const AxisAlignedBox & | box )

static

Sphere / box intersection test.

References intersects().

## intersects() [6/6]

RayTestResult Ogre::Math::intersects | ( | const Ray & | ray,
|  | const std::vector< Plane > & | planeList,
|  | bool | normalIsOutside )

static

Ray / convex plane list intersection test.

Parameters

  ray | The ray to test with
  planeList | List of planes which form a convex volume
  normalIsOutside | Does the normal point outside the volume

References intersects().

## RealEqual()

bool Ogre::Math::RealEqual | ( | Real | a,
|  | Real | b,
|  | Real | tolerance = std::numeric_limits<Real>::epsilon() )

inline static

Compare 2 reals, using tolerance for inaccuracies.

Referenced by Ogre::VectorBase< 3, Real >::getRotationTo(), Ogre::Matrix3::hasScale(), and Ogre::Vector< 2, Real >::positionEquals().

## calculateTangentSpaceVector()

Vector3 Ogre::Math::calculateTangentSpaceVector | ( | const Vector3 & | position1,
|  | const Vector3 & | position2,
|  | const Vector3 & | position3,
|  | Real | u1,
|  | Real | v1,
|  | Real | u2,
|  | Real | v2,
|  | Real | u3,
|  | Real | v3 )

static

Deprecated
  use TangentSpaceCalc

## buildReflectionMatrix()

Affine3 Ogre::Math::buildReflectionMatrix | ( | const Plane & | p | ) |

static

Build a reflection matrix for the passed in plane.

References calculateBasicFaceNormal(), calculateBasicFaceNormalWithoutNormalize(), calculateFaceNormal(), and calculateFaceNormalWithoutNormalize().

## gaussianDistribution()

Real Ogre::Math::gaussianDistribution | ( | Real | x,
|  | Real | offset = 0.0f,
|  | Real | scale = 1.0f )

static

Generates a value based on the Gaussian (normal) distribution function with the given offset and scale parameters.

## Clamp()

template<typename T>

T Ogre::Math::Clamp | ( | T | val,
|  | T | minval,
|  | T | maxval )

inline static

Clamp a value within an inclusive range.

Referenced by Ogre::Vector< 2, Real >::angleBetween().

## makeViewMatrix()

Affine3 Ogre::Math::makeViewMatrix | ( | const Vector3 & | position,
|  | const Quaternion & | orientation,
|  | const Affine3 * | reflectMatrix = 0 )

static

This creates a view matrix.

[ Lx Uy Dz Tx ] [ Lx Uy Dz Ty ] [ Lx Uy Dz Tz ] [ 0 0 0 1 ]

Where T = -(Transposed(Rot) * Pos)

References lookRotation().

## makePerspectiveMatrix()

Matrix4 Ogre::Math::makePerspectiveMatrix | ( | Real | left,
|  | Real | right,
|  | Real | bottom,
|  | Real | top,
|  | Real | zNear,
|  | Real | zFar )

static

This creates 'uniform' perspective projection matrix, which depth range [-1,1], right-handed rules.

[ A 0 C 0 ] [ 0 B D 0 ] [ 0 0 q qn ] [ 0 0 -1 0 ]

A = 2 * near / (right - left) B = 2 * near / (top - bottom) C = (right + left) / (right - left) D = (top + bottom) / (top - bottom) q = - (far + near) / (far - near) qn = - 2 * (far * near) / (far - near)

## boundingRadiusFromAABB()

Real Ogre::Math::boundingRadiusFromAABB | ( | const AxisAlignedBox & | aabb | ) |

static

Get the radius of the origin-centered bounding sphere from the bounding box.

## boundingRadiusFromAABBCentered()

Real Ogre::Math::boundingRadiusFromAABBCentered | ( | const AxisAlignedBox & | aabb | ) |

static

Get the radius of the bbox-centered bounding sphere from the bounding box.

## Member Data Documentation

## LOG2

Real Ogre::Math::LOG2 = static_cast<Real> (0.69314718055994530942)

static constexpr

Stored value of log(2) for frequent use.

## POS_INFINITY

Real Ogre::Math::POS_INFINITY = std::numeric_limits<Real>::infinity()

static constexpr

Referenced by Ogre::BspRaySceneQuery::execute(), Ogre::AxisAlignedBox::getHalfSize(), Ogre::AxisAlignedBox::getSize(), and Ogre::AxisAlignedBox::volume().

## NEG_INFINITY

Real Ogre::Math::NEG_INFINITY = -std::numeric_limits<Real>::infinity()

static constexpr

## PI

Real Ogre::Math::PI = static_cast<Real> (3.14159265358979323846)

static constexpr

## TWO_PI

Real Ogre::Math::TWO_PI = Real( 2.0 * PI )

static constexpr

Referenced by Ogre::VectorBase< 2, Real >::angleTo(), and Ogre::VectorBase< 3, Real >::randomDeviant().

## HALF_PI

Real Ogre::Math::HALF_PI = Real( 0.5 * PI )

static constexpr

Referenced by Cos(), and Cos().

## fDeg2Rad

float Ogre::Math::fDeg2Rad = PI / Real(180.0)

static constexpr

Referenced by DegreesToRadians().

## fRad2Deg

float Ogre::Math::fRad2Deg = Real(180.0) / PI

static constexpr

Referenced by RadiansToDegrees().

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

- OgreMath.h
- OgreMatrix3.h
- OgrePlane.h
- OgreRay.h
- OgreSphere.h
- OgreVector.h