OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::Math Class Reference

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. More...
 
 ~Math ()
 Default destructor. More...
 

Static Public Member Functions

static Degree Abs (const Degree &dValue)
 Absolute value function. More...
 
static Radian Abs (const Radian &rValue)
 Absolute value function. More...
 
static Real Abs (Real fValue)
 Absolute value function. More...
 
static Radian ACos (Real fValue)
 Arc cosine function. More...
 
static Real AngleUnitsToDegrees (Real units)
 Convert from the current AngleUnit to degrees. More...
 
static Real AngleUnitsToRadians (Real units)
 Convert from the current AngleUnit to radians. More...
 
static Radian ASin (Real fValue)
 Arc sine function. More...
 
static Radian ATan (Real fValue)
 Arc tangent function. More...
 
static Radian ATan2 (Real fY, Real fX)
 Arc tangent between two values function. More...
 
static Real boundingRadiusFromAABB (const AxisAlignedBox &aabb)
 Get a bounding radius value from a bounding box. More...
 
static Matrix4 buildReflectionMatrix (const Plane &p)
 Build a reflection matrix for the passed in plane. More...
 
static Vector3 calculateBasicFaceNormal (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
 Calculate a face normal, no w-information. More...
 
static Vector3 calculateBasicFaceNormalWithoutNormalize (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
 Calculate a face normal without normalize, no w-information. More...
 
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. More...
 
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. More...
 
static 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. More...
 
static Real Ceil (Real fValue)
 Ceiling function Returns the smallest following integer. More...
 
template<typename T >
static T Clamp (T val, T minval, T maxval)
 Clamp a value within an inclusive range. More...
 
static uint32 ClosestPow2 (uint32 x)
 Return closest power of two not smaller than given number. More...
 
static Real Cos (const Radian &fValue, bool useTables=false)
 Cosine function. More...
 
static Real Cos (Real fValue, bool useTables=false)
 Cosine function. More...
 
static Real DegreesToAngleUnits (Real degrees)
 Convert from degrees to the current AngleUnit. More...
 
static Real DegreesToRadians (Real degrees)
 
static Real Exp (Real fValue)
 
static Real Floor (Real fValue)
 Floor function Returns the largest previous integer. More...
 
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. More...
 
static size_t gcd (size_t a, size_t b)
 Returns Greatest Common Denominator. More...
 
static AngleUnit getAngleUnit ()
 Get the unit being used for angles. More...
 
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. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const AxisAlignedBox &box)
 Ray / box intersection, returns boolean result and distance. More...
 
static bool intersects (const Ray &ray, const AxisAlignedBox &box, Real *d1, Real *d2)
 Ray / box intersection, returns boolean result and two intersection distance. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const Plane &plane)
 Ray / plane intersection, returns boolean result and distance. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const Sphere &sphere, bool discardInside=true)
 Ray / sphere intersection, returns boolean result and distance. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const StdList< Plane > &planeList, bool normalIsOutside)
 Ray / convex plane list intersection test. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const StdVector< Plane > &planeList, bool normalIsOutside)
 Ray / convex plane list intersection test. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, bool positiveSide=true, bool negativeSide=true)
 Ray / triangle intersection, returns boolean result and distance. More...
 
static std::pair< bool, Realintersects (const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &normal, bool positiveSide=true, bool negativeSide=true)
 Ray / triangle intersection, returns boolean result and distance. More...
 
static bool intersects (const Sphere &sphere, const AxisAlignedBox &box)
 Sphere / box intersection test. More...
 
static bool intersects (const Sphere &sphere, const Plane &plane)
 Sphere / plane intersection test. More...
 
static Real InvSqrt (Real fValue)
 Inverse square root i.e. More...
 
static int ISign (int iValue)
 
static bool isNaN (Real f)
 
static size_t lcm (size_t a, size_t b)
 Returns Least Common Multiple. More...
 
template<typename T , typename S >
static FORCEINLINElerp (const T &a, const T &b, const S &w)
 Linear interpolation. More...
 
static Real Log (Real fValue)
 
static Real Log2 (Real fValue)
 
static Real LogN (Real base, Real fValue)
 
static Matrix4 makeViewMatrix (const Vector3 &position, const Quaternion &orientation, const Matrix4 *reflectMatrix=0)
 
static Vector3 octahedronMappingDecode (Vector2 f)
 Takes a 2D value in range [0; 1] and returns a unit-length 3D vector. More...
 
static Vector2 octahedronMappingEncode (Vector3 n)
 Takes a directional 3D vector n and returns a 2D value in range [0; 1] Vector 'n' doesn't have to be normalized. More...
 
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. More...
 
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. More...
 
static Real Pow (Real fBase, Real fExponent)
 
static Real RadiansToAngleUnits (Real radians)
 Convert from radians to the current AngleUnit . More...
 
static Real RadiansToDegrees (Real radians)
 
static Real RangeRandom (Real fLow, Real fHigh)
 Generate a random number within the range provided. More...
 
static bool RealEqual (Real a, Real b, Real tolerance=std::numeric_limits< Real >::epsilon())
 Compare 2 reals, using tolerance for inaccuracies. More...
 
static double saturate (double t)
 
static float saturate (float t)
 
static void setAngleUnit (AngleUnit unit)
 These functions used to set the assumed angle units (radians or degrees) expected when using the Angle type. More...
 
static void SetRandomValueProvider (RandomValueProvider *provider)
 
static Degree Sign (const Degree &dValue)
 
static Radian Sign (const Radian &rValue)
 
static Real Sign (Real fValue)
 
static Real Sin (const Radian &fValue, bool useTables=false)
 Sine function. More...
 
static Real Sin (Real fValue, bool useTables=false)
 Sine function. More...
 
static Real Sqr (Real fValue)
 Squared function. More...
 
static Degree Sqrt (const Degree &fValue)
 Square root function. More...
 
static Radian Sqrt (const Radian &fValue)
 Square root function. More...
 
static Real Sqrt (Real fValue)
 Square root function. More...
 
static Real SymmetricRandom ()
 Generate a random number in the range [-1,1]. More...
 
static Real Tan (const Radian &fValue, bool useTables=false)
 Tangent function. More...
 
static Real Tan (Real fValue, bool useTables=false)
 Tangent function. More...
 
static Real UnitRandom ()
 Generate a random number of unit length. More...
 

Static Public Attributes

static const Real fDeg2Rad
 
static const Real fRad2Deg
 
static const Real HALF_PI
 
static const Real LOG2
 Stored value of log(2) for frequent use. More...
 
static const Real NEG_INFINITY
 
static const Real PI
 
static const Real POS_INFINITY
 
static const Real TWO_PI
 

Detailed Description

Class to provide access to common mathematical functions.

Remarks
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

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
trigTableSizeOptional parameter to set the size of the tables used to implement Sin, Cos, Tan

◆ ~Math()

Ogre::Math::~Math ( )

Default destructor.

Member Function Documentation

◆ Abs() [1/3]

static Degree Ogre::Math::Abs ( const Degree dValue)
inlinestatic

Absolute value function.

Parameters
dValueThe value, in degrees, whose absolute value will be returned.

References Ogre::Degree::valueDegrees().

◆ Abs() [2/3]

static Radian Ogre::Math::Abs ( const Radian rValue)
inlinestatic

Absolute value function.

Parameters
rValueThe value, in radians, whose absolute value will be returned.

References Ogre::Radian::valueRadians().

◆ Abs() [3/3]

static Real Ogre::Math::Abs ( Real  fValue)
inlinestatic

◆ ACos()

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

Arc cosine function.

Parameters
fValueThe value whose arc cosine will be returned.

Referenced by Ogre::Vector2::angleBetween(), Ogre::Vector3::angleBetween(), and Ogre::Vector3::directionEquals().

◆ AngleUnitsToDegrees()

static Real Ogre::Math::AngleUnitsToDegrees ( Real  units)
static

Convert from the current AngleUnit to degrees.

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

◆ AngleUnitsToRadians()

static Real Ogre::Math::AngleUnitsToRadians ( Real  units)
static

Convert from the current AngleUnit to radians.

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

◆ ASin()

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

Arc sine function.

Parameters
fValueThe value whose arc sine will be returned.

◆ ATan()

static Radian Ogre::Math::ATan ( Real  fValue)
inlinestatic

Arc tangent function.

Parameters
fValueThe value whose arc tangent will be returned.

◆ ATan2()

static Radian Ogre::Math::ATan2 ( Real  fY,
Real  fX 
)
inlinestatic

Arc tangent between two values function.

Parameters
fYThe first value to calculate the arc tangent with.
fXThe second value to calculate the arc tangent with.

◆ boundingRadiusFromAABB()

static Real Ogre::Math::boundingRadiusFromAABB ( const AxisAlignedBox aabb)
static

Get a bounding radius value from a bounding box.

◆ buildReflectionMatrix()

static Matrix4 Ogre::Math::buildReflectionMatrix ( const Plane p)
static

Build a reflection matrix for the passed in plane.

◆ calculateBasicFaceNormal()

static Vector3 Ogre::Math::calculateBasicFaceNormal ( const Vector3 v1,
const Vector3 v2,
const Vector3 v3 
)
static

Calculate a face normal, no w-information.

◆ calculateBasicFaceNormalWithoutNormalize()

static Vector3 Ogre::Math::calculateBasicFaceNormalWithoutNormalize ( const Vector3 v1,
const Vector3 v2,
const Vector3 v3 
)
static

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

◆ calculateFaceNormal()

static Vector4 Ogre::Math::calculateFaceNormal ( const Vector3 v1,
const Vector3 v2,
const Vector3 v3 
)
static

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

◆ calculateFaceNormalWithoutNormalize()

static Vector4 Ogre::Math::calculateFaceNormalWithoutNormalize ( const Vector3 v1,
const Vector3 v2,
const Vector3 v3 
)
static

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

◆ calculateTangentSpaceVector()

static 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

Calculates the tangent space vector for a given set of positions / texture coords.

◆ Ceil()

static Real Ogre::Math::Ceil ( Real  fValue)
inlinestatic

Ceiling function Returns the smallest following integer.

(example: Ceil(1.1) = 2)

Parameters
fValueThe value to round up to the nearest integer.

◆ Clamp()

template<typename T >
static T Ogre::Math::Clamp ( val,
minval,
maxval 
)
inlinestatic

◆ ClosestPow2()

static uint32 Ogre::Math::ClosestPow2 ( uint32  x)
inlinestatic

Return closest power of two not smaller than given number.

◆ Cos() [1/2]

static Real Ogre::Math::Cos ( const Radian fValue,
bool  useTables = false 
)
inlinestatic

Cosine function.

Parameters
fValueAngle in radians
useTablesIf true, uses lookup tables rather than calculation - faster but less accurate.

References Ogre::Radian::valueRadians().

Referenced by Ogre::Vector2::randomDeviant().

◆ Cos() [2/2]

static Real Ogre::Math::Cos ( Real  fValue,
bool  useTables = false 
)
inlinestatic

Cosine function.

Parameters
fValueAngle in radians
useTablesIf true, uses lookup tables rather than calculation - faster but less accurate.

◆ DegreesToAngleUnits()

static Real Ogre::Math::DegreesToAngleUnits ( Real  degrees)
static

Convert from degrees to the current AngleUnit.

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

◆ DegreesToRadians()

static Real Ogre::Math::DegreesToRadians ( Real  degrees)
inlinestatic

◆ Exp()

static Real Ogre::Math::Exp ( Real  fValue)
inlinestatic

◆ Floor()

static Real Ogre::Math::Floor ( Real  fValue)
inlinestatic

Floor function Returns the largest previous integer.

(example: Floor(1.9) = 1)

Parameters
fValueThe value to round down to the nearest integer.

◆ gaussianDistribution()

static 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.

◆ gcd()

static size_t Ogre::Math::gcd ( size_t  a,
size_t  b 
)
inlinestatic

Returns Greatest Common Denominator.

◆ getAngleUnit()

static AngleUnit Ogre::Math::getAngleUnit ( )
static

Get the unit being used for angles.

◆ IAbs()

static int Ogre::Math::IAbs ( int  iValue)
inlinestatic

◆ ICeil()

static int Ogre::Math::ICeil ( float  fValue)
inlinestatic

◆ IFloor()

static int Ogre::Math::IFloor ( float  fValue)
inlinestatic

◆ intersects() [1/11]

static bool Ogre::Math::intersects ( const Plane plane,
const AxisAlignedBox box 
)
static

Plane / box intersection test.

◆ intersects() [2/11]

static std::pair<bool, Real> Ogre::Math::intersects ( const Ray ray,
const AxisAlignedBox box 
)
static

Ray / box intersection, returns boolean result and distance.

◆ intersects() [3/11]

static 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
rayThe ray.
boxThe box.
d1A real pointer to retrieve the near intersection distance from the ray origin, maybe null which means don't care about the near intersection distance.
d2A 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() [4/11]

static std::pair<bool, Real> Ogre::Math::intersects ( const Ray ray,
const Plane plane 
)
static

Ray / plane intersection, returns boolean result and distance.

Referenced by Ogre::Sphere::intersects(), Ogre::Ray::intersects(), Ogre::PlaneBoundedVolume::intersects(), and Ogre::AxisAlignedBox::intersects().

◆ intersects() [5/11]

static std::pair<bool, Real> Ogre::Math::intersects ( const Ray ray,
const Sphere sphere,
bool  discardInside = true 
)
static

Ray / sphere intersection, returns boolean result and distance.

◆ intersects() [6/11]

static std::pair<bool, Real> Ogre::Math::intersects ( const Ray ray,
const StdList< Plane > &  planeList,
bool  normalIsOutside 
)
static

Ray / convex plane list intersection test.

Parameters
rayThe ray to test with
planeListList of planes which form a convex volume
normalIsOutsideDoes the normal point outside the volume

◆ intersects() [7/11]

static std::pair<bool, Real> Ogre::Math::intersects ( const Ray ray,
const StdVector< Plane > &  planeList,
bool  normalIsOutside 
)
static

Ray / convex plane list intersection test.

Parameters
rayThe ray to test with
planeListList of planes which form a convex volume
normalIsOutsideDoes the normal point outside the volume

◆ intersects() [8/11]

static std::pair<bool, Real> 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, returns boolean result and distance.

Parameters
rayThe ray.
aThe triangle's first vertex.
bThe triangle's second vertex.
cThe triangle's third vertex.
positiveSideIntersect with "positive side" of the triangle
negativeSideIntersect with "negative side" of the triangle
Returns
If the ray is intersects the triangle, a pair of true and the distance between intersection point and ray origin returned.
If the ray isn't intersects the triangle, a pair of false and 0 returned.

◆ intersects() [9/11]

static std::pair<bool, Real> Ogre::Math::intersects ( const Ray ray,
const Vector3 a,
const Vector3 b,
const Vector3 c,
const Vector3 normal,
bool  positiveSide = true,
bool  negativeSide = true 
)
static

Ray / triangle intersection, returns boolean result and distance.

Parameters
rayThe ray.
aThe triangle's first vertex.
bThe triangle's second vertex.
cThe triangle's third vertex.
normalThe triangle plane's normal (passed in rather than calculated on demand since the caller may already have it), doesn't need normalised since we don't care.
positiveSideIntersect with "positive side" of the triangle
negativeSideIntersect with "negative side" of the triangle
Returns
If the ray is intersects the triangle, a pair of true and the distance between intersection point and ray origin returned.
If the ray isn't intersects the triangle, a pair of false and 0 returned.

◆ intersects() [10/11]

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

Sphere / box intersection test.

Sphere / box intersection test.

◆ intersects() [11/11]

static bool Ogre::Math::intersects ( const Sphere sphere,
const Plane plane 
)
static

Sphere / plane intersection test.

Remarks
NB just do a plane.getDistance(sphere.getCenter()) for more detail!

◆ InvSqrt()

static Real Ogre::Math::InvSqrt ( Real  fValue)
inlinestatic

Inverse square root i.e.

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

Parameters
fValueThe value whose inverse square root will be calculated.

◆ ISign()

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

◆ isNaN()

◆ lcm()

static size_t Ogre::Math::lcm ( size_t  a,
size_t  b 
)
inlinestatic

Returns Least Common Multiple.

◆ lerp()

template<typename T , typename S >
static FORCEINLINE T Ogre::Math::lerp ( const T &  a,
const T &  b,
const S &  w 
)
inlinestatic

Linear interpolation.

Given 3 parameters a, b and w the function returns the value of (1 – w)* a + w * b. Where a and b are matching vector or scalar types and w can be either a scalar or a vector of the same type as a and b.

Remarks
lerp( a, b, 0 ) = a lerp( a, b, 1 ) = b

◆ Log()

static Real Ogre::Math::Log ( Real  fValue)
inlinestatic

◆ Log2()

static Real Ogre::Math::Log2 ( Real  fValue)
inlinestatic

◆ LogN()

static Real Ogre::Math::LogN ( Real  base,
Real  fValue 
)
inlinestatic

◆ makeViewMatrix()

static Matrix4 Ogre::Math::makeViewMatrix ( const Vector3 position,
const Quaternion orientation,
const Matrix4 reflectMatrix = 0 
)
static

◆ octahedronMappingDecode()

static Vector3 Ogre::Math::octahedronMappingDecode ( Vector2  f)
static

Takes a 2D value in range [0; 1] and returns a unit-length 3D vector.

◆ octahedronMappingEncode()

static Vector2 Ogre::Math::octahedronMappingEncode ( Vector3  n)
static

Takes a directional 3D vector n and returns a 2D value in range [0; 1] Vector 'n' doesn't have to be normalized.

◆ pointInTri2D()

static 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.

Remarks
The vertices of the triangle must be given in either trigonometrical (anticlockwise) or inverse trigonometrical (clockwise) order.
Parameters
pThe point.
aThe triangle's first vertex.
bThe triangle's second vertex.
cThe 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()

static 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.

Remarks
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
pp The point.
aThe triangle's first vertex.
bThe triangle's second vertex.
cThe triangle's third vertex.
normalThe 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.

◆ Pow()

static Real Ogre::Math::Pow ( Real  fBase,
Real  fExponent 
)
inlinestatic

◆ RadiansToAngleUnits()

static Real Ogre::Math::RadiansToAngleUnits ( Real  radians)
static

Convert from radians to the current AngleUnit .

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

◆ RadiansToDegrees()

static Real Ogre::Math::RadiansToDegrees ( Real  radians)
inlinestatic

◆ RangeRandom()

static Real Ogre::Math::RangeRandom ( Real  fLow,
Real  fHigh 
)
static

Generate a random number within the range provided.

Parameters
fLowThe lower bound of the range.
fHighThe upper bound of the range.
Returns
A random number in the range from [fLow,fHigh].

Referenced by Ogre::Vector2::randomDeviant().

◆ RealEqual()

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

Compare 2 reals, using tolerance for inaccuracies.

Referenced by Ogre::Matrix3::hasScale(), Ogre::Matrix4::hasScale(), and Ogre::Vector3::positionEquals().

◆ saturate() [1/2]

static double Ogre::Math::saturate ( double  t)
inlinestatic

◆ saturate() [2/2]

static float Ogre::Math::saturate ( float  t)
inlinestatic

◆ setAngleUnit()

static 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.

◆ SetRandomValueProvider()

static void Ogre::Math::SetRandomValueProvider ( RandomValueProvider provider)
static

◆ Sign() [1/3]

static Degree Ogre::Math::Sign ( const Degree dValue)
inlinestatic

◆ Sign() [2/3]

static Radian Ogre::Math::Sign ( const Radian rValue)
inlinestatic

◆ Sign() [3/3]

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

◆ Sin() [1/2]

static Real Ogre::Math::Sin ( const Radian fValue,
bool  useTables = false 
)
inlinestatic

Sine function.

Parameters
fValueAngle in radians
useTablesIf true, uses lookup tables rather than calculation - faster but less accurate.

References Ogre::Radian::valueRadians().

Referenced by Ogre::Vector2::randomDeviant().

◆ Sin() [2/2]

static Real Ogre::Math::Sin ( Real  fValue,
bool  useTables = false 
)
inlinestatic

Sine function.

Parameters
fValueAngle in radians
useTablesIf true, uses lookup tables rather than calculation - faster but less accurate.

◆ Sqr()

static Real Ogre::Math::Sqr ( Real  fValue)
inlinestatic

Squared function.

Parameters
fValueThe value to be squared (fValue^2)

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

◆ Sqrt() [1/3]

static Degree Ogre::Math::Sqrt ( const Degree fValue)
inlinestatic

Square root function.

Parameters
fValueThe value, in degrees, whose square root will be calculated.
Returns
The square root of the angle in degrees.

References Ogre::Degree::valueDegrees().

◆ Sqrt() [2/3]

static Radian Ogre::Math::Sqrt ( const Radian fValue)
inlinestatic

Square root function.

Parameters
fValueThe 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]

static Real Ogre::Math::Sqrt ( Real  fValue)
inlinestatic

◆ SymmetricRandom()

static Real Ogre::Math::SymmetricRandom ( )
static

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

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

◆ Tan() [1/2]

static Real Ogre::Math::Tan ( const Radian fValue,
bool  useTables = false 
)
inlinestatic

Tangent function.

Parameters
fValueAngle in radians
useTablesIf true, uses lookup tables rather than calculation - faster but less accurate.

References Ogre::Radian::valueRadians().

◆ Tan() [2/2]

static Real Ogre::Math::Tan ( Real  fValue,
bool  useTables = false 
)
inlinestatic

Tangent function.

Parameters
fValueAngle in radians
useTablesIf true, uses lookup tables rather than calculation - faster but less accurate.

◆ UnitRandom()

static Real Ogre::Math::UnitRandom ( )
static

Generate a random number of unit length.

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

Referenced by Ogre::Vector3::randomDeviant().

Member Data Documentation

◆ fDeg2Rad

const Real Ogre::Math::fDeg2Rad
static

◆ fRad2Deg

const Real Ogre::Math::fRad2Deg
static

◆ HALF_PI

const Real Ogre::Math::HALF_PI
static

◆ LOG2

const Real Ogre::Math::LOG2
static

Stored value of log(2) for frequent use.

◆ NEG_INFINITY

const Real Ogre::Math::NEG_INFINITY
static

◆ PI

const Real Ogre::Math::PI
static

◆ POS_INFINITY

◆ TWO_PI

const Real Ogre::Math::TWO_PI
static

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