OGRE  1.12.7 Object-Oriented Graphics Rendering Engine
Math

## Classes

class  Ogre::Affine3
Transform specialization for 3D Affine - encapsulating a 3x4 Matrix. More...

class  Ogre::Angle
Wrapper class which identifies a value as the currently default angle type, as defined by Math::setAngleUnit. More...

class  Ogre::AxisAlignedBox
A 3D box aligned with the x/y/z axes. More...

class  Ogre::Bitwise
Class for manipulating bit patterns. More...

class  Ogre::ConvexBody
Holds a solid representation of a convex body. More...

class  Ogre::Degree
Wrapper class which indicates a given angle value is in Degrees. More...

class  Ogre::DualQuaternion
Implementation of a dual quaternion, i.e. More...

class  Ogre::EdgeData
This class contains the information required to describe the edge connectivity of a given set of vertices and indexes. More...

class  Ogre::EdgeListBuilder
General utility class for building edge lists for geometry. More...

class  Ogre::Math

class  Ogre::Matrix3
A 3x3 matrix which can represent rotations around axes. More...

class  Ogre::Matrix4
Transform specialization for projective - encapsulating a 4x4 Matrix. More...

class  Ogre::NumericSolver
Provides numeric solvers for Ogre. More...

class  Ogre::OptimisedUtil
Utility class for provides optimised functions. More...

class  Ogre::Plane
Defines a plane in 3D space. More...

class  Ogre::PlaneBoundedVolume
Represents a convex volume bounded by planes. More...

class  Ogre::Polygon
The class represents a polygon in 3D space. More...

class  Ogre::Quaternion
Implementation of a Quaternion, i.e. More...

Wrapper class which indicates a given angle value is in Radians. More...

class  Ogre::Ray
Representation of a ray in space, i.e. More...

class  Ogre::RotationalSpline
This class interpolates orientations (rotations) along a spline using derivatives of quaternions. More...

class  Ogre::SimpleSpline
A very simple spline class which implements the Catmull-Rom class of splines. More...

class  Ogre::Sphere
A sphere primitive, mostly used for bounds checking. More...

class  Ogre::TangentSpaceCalc
Class for calculating a tangent space basis. More...

class  Ogre::TransformBase< rows, T >
Class encapsulating a standard 4x4 homogeneous matrix. More...

struct  Ogre::TransformBaseReal

class  Ogre::Vector< dims, T >
Standard N-dimensional vector. More...

struct  Ogre::VectorBase< dims, T >
helper class to implement legacy API. Notably x, y, z access More...

struct  Ogre::VectorBase< 2, Real >

struct  Ogre::VectorBase< 3, Real >

struct  Ogre::VectorBase< 4, Real >

## Typedefs

typedef std::vector< PlaneBoundedVolumeOgre::PlaneBoundedVolumeList

typedef std::vector< PlaneOgre::PlaneList

typedef std::pair< bool, RealOgre::RayTestResult
A pair structure where the first element indicates whether an intersection occurs. More...

## Functions

template<class T >
static void Ogre::advanceRawPointer (const T *&ptr, ptrdiff_t offset)
Advance the pointer with raw offset. More...

template<class T >
static void Ogre::advanceRawPointer (T *&ptr, ptrdiff_t offset)

Radian Ogre::VectorBase< 2, Real >::angleTo (const Vector2 &other) const
Gets the oriented angle between 2 vectors. More...

static Vector3 Ogre::Math::calculateBasicFaceNormal (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
Calculate a face normal, no w-information. More...

static Vector3 Ogre::Math::calculateBasicFaceNormalWithoutNormalize (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
Calculate a face normal without normalize, no w-information. More...

static Vector4 Ogre::Math::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 Ogre::Math::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...

Vector3 Ogre::VectorBase< 3, Real >::crossProduct (const Vector3 &rkVector) const
Calculates the cross-product of 2 vectors, i.e. More...

bool Ogre::VectorBase< 3, Real >::directionEquals (const Vector3 &rhs, const Radian &tolerance) const
Returns whether this vector is within a directional tolerance of another vector. More...

Quaternion Ogre::VectorBase< 3, Real >::getRotationTo (const Vector3 &dest, const Vector3 &fallbackAxis=ZERO) const
Gets the shortest arc quaternion to rotate this vector to the destination vector. More...

static bool Ogre::Math::intersects (const Plane &plane, const AxisAlignedBox &box)
Plane / box intersection test. More...

static RayTestResult Ogre::Math::intersects (const Ray &ray, const Plane &plane)
Ray / plane intersection. More...

static RayTestResult Ogre::Math::intersects (const Ray &ray, const Sphere &sphere, bool discardInside=true)
Ray / sphere intersection. More...

static bool Ogre::Math::intersects (const Sphere &sphere, const Plane &plane)
Sphere / plane intersection test. More...

static Matrix3 Ogre::Math::lookRotation (const Vector3 &direction, const Vector3 &yaw)
Create a rotation matrix from direction and yaw. More...

Vector2 Ogre::VectorBase< 2, Real >::midPoint (const Vector2 &vec) const
Returns a vector at a point half way between this and the passed in vector. More...

Vector3 Ogre::VectorBase< 3, Real >::midPoint (const Vector3 &vec) const
Returns a vector at a point half way between this and the passed in vector. More...

Ogre::Angle::operator Degree () const

Affine3 Ogre::operator* (const Affine3 &m, const Affine3 &m2)

Vector3 Ogre::operator* (const Affine3 &m, const Vector3 &v)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...

Vector4 Ogre::operator* (const Affine3 &m, const Vector4 &v)

Vector3 Ogre::operator* (const Matrix3 &m, const Vector3 &v)
Matrix * vector [3x3 * 3x1 = 3x1]. More...

Matrix4 Ogre::operator* (const Matrix4 &m, const Matrix4 &m2)

Vector3 Ogre::operator* (const Matrix4 &m, const Vector3 &v)
Vector transformation using '*'. More...

Vector4 Ogre::operator* (const Matrix4 &m, const Vector4 &v)

Plane Ogre::operator* (const Matrix4 &mat, const Plane &p)

Vector4 Ogre::operator* (const Vector4 &v, const Matrix4 &mat)

Degree Ogre::operator* (Real a, const Degree &b)

Matrix4 Ogre::operator+ (const Matrix4 &m, const Matrix4 &m2)

Matrix4 Ogre::operator- (const Matrix4 &m, const Matrix4 &m2)
Matrix subtraction. More...

Degree Ogre::operator/ (Real a, const Degree &b)

Vector2 Ogre::VectorBase< 2, Real >::perpendicular (void) const
Generates a vector perpendicular to this vector (eg an 'up' vector). More...

Vector3 Ogre::VectorBase< 3, Real >::perpendicular (void) const
Generates a vector perpendicular to this vector (eg an 'up' vector). More...

bool Ogre::VectorBase< 3, Real >::positionCloses (const Vector3 &rhs, Real tolerance=1e-03f) const
Returns whether this vector is within a positional tolerance of another vector, also take scale of the vectors into account. More...

const Vector3Ogre::VectorBase< 3, Real >::primaryAxis () const
Extract the primary (dominant) axis from this direction vector. More...

Vector3 Ogre::VectorBase< 3, Real >::randomDeviant (const Radian &angle, const Vector3 &up=ZERO) const
Generates a new random vector which deviates from this vector by a given angle in a random direction. More...

Vector2 Ogre::VectorBase< 2, Real >::randomDeviant (Radian angle) const
Generates a new random vector which deviates from this vector by a given angle in a random direction. More...

template<class T >
static const T * Ogre::rawOffsetPointer (const T *ptr, ptrdiff_t offset)
Returns raw offseted of the given pointer. More...

template<class T >
static T * Ogre::rawOffsetPointer (T *ptr, ptrdiff_t offset)

Matrix4 Ogre::TransformBaseReal::transpose () const

Real Ogre::Degree::valueAngleUnits () const

## ◆ RayTestResult

 typedef std::pair Ogre::RayTestResult

A pair structure where the first element indicates whether an intersection occurs.

if true, the second element will indicate the distance along the ray at which it intersects. This can be converted to a point in space by calling Ray::getPoint().

## ◆ PlaneList

 typedef std::vector Ogre::PlaneList

## ◆ PlaneBoundedVolumeList

 typedef std::vector Ogre::PlaneBoundedVolumeList

inline

inline

## ◆ operator*() [2/11]

 Degree Ogre::operator* ( Real a, const Degree & b )
inline

## ◆ operator/() [2/2]

 Degree Ogre::operator/ ( Real a, const Degree & b )
inline

## ◆ operator*() [3/11]

 Vector3 Ogre::operator* ( const Matrix3 & m, const Vector3 & v )
inline

Matrix * vector [3x3 * 3x1 = 3x1].

## ◆ operator*() [4/11]

 Matrix4 Ogre::operator* ( const Matrix4 & m, const Matrix4 & m2 )
inline

## ◆ operator+() [1/2]

 Matrix4 Ogre::operator+ ( const Matrix4 & m, const Matrix4 & m2 )
inline

## ◆ operator-() [1/2]

 Matrix4 Ogre::operator- ( const Matrix4 & m, const Matrix4 & m2 )
inline

Matrix subtraction.

## ◆ operator*() [5/11]

 Affine3 Ogre::operator* ( const Affine3 & m, const Affine3 & m2 )
inline

## ◆ operator*() [6/11]

 Vector3 Ogre::operator* ( const Matrix4 & m, const Vector3 & v )
inline

Vector transformation using '*'.

Remarks
Transforms the given 3-D vector by the matrix, projecting the result back into w = 1.
Note
This means that the initial w is considered to be 1.0, and then all the tree elements of the resulting 3-D vector are divided by the resulting w.

## ◆ operator*() [7/11]

 Vector3 Ogre::operator* ( const Affine3 & m, const Vector3 & v )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

## ◆ operator*() [8/11]

 Vector4 Ogre::operator* ( const Matrix4 & m, const Vector4 & v )
inline

## ◆ operator*() [9/11]

 Vector4 Ogre::operator* ( const Affine3 & m, const Vector4 & v )
inline

## ◆ operator*() [10/11]

 Vector4 Ogre::operator* ( const Vector4 & v, const Matrix4 & mat )
inline

## ◆ rawOffsetPointer() [1/2]

template<class T >
 static const T* Ogre::rawOffsetPointer ( const T * ptr, ptrdiff_t offset )
inlinestatic

Returns raw offseted of the given pointer.

Note
The offset are in bytes, no matter what type of the pointer.

## ◆ rawOffsetPointer() [2/2]

template<class T >
 static T* Ogre::rawOffsetPointer ( T * ptr, ptrdiff_t offset )
inlinestatic

template<class T >
 static void Ogre::advanceRawPointer ( const T *& ptr, ptrdiff_t offset )
inlinestatic

Advance the pointer with raw offset.

Note
The offset are in bytes, no matter what type of the pointer.

References Ogre::rawOffsetPointer().

template<class T >
 static void Ogre::advanceRawPointer ( T *& ptr, ptrdiff_t offset )
inlinestatic

## ◆ operator*() [11/11]

 Plane Ogre::operator* ( const Matrix4 & mat, const Plane & p )
inline

inline

inline

inline

inline

inline

inline

inline

inline

inline

## ◆ valueAngleUnits() [2/2]

 Real Ogre::Degree::valueAngleUnits ( ) const
inline

inline

## ◆ operator Degree()

 Ogre::Angle::operator Degree ( ) const
inline

## ◆ lookRotation()

 Matrix3 Ogre::Math::lookRotation ( const Vector3 & direction, const Vector3 & yaw )
inlinestatic

Create a rotation matrix from direction and yaw.

Parameters
 direction the direction to look in. Must be normalised. yaw the yaw axis to use

## ◆ transpose()

 Matrix4 Ogre::TransformBaseReal::transpose ( ) const
inline

Referenced by Ogre::operator*().

## ◆ intersects() [1/4]

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

Plane / box intersection test.

References Ogre::Plane::BOTH_SIDE, and Ogre::Plane::getSide().

## ◆ intersects() [2/4]

 RayTestResult Ogre::Math::intersects ( const Ray & ray, const Plane & plane )
inlinestatic

Ray / plane intersection.

References Ogre::Ray::intersects().

## ◆ intersects() [3/4]

 RayTestResult Ogre::Math::intersects ( const Ray & ray, const Sphere & sphere, bool discardInside = true )
inlinestatic

Ray / sphere intersection.

References Ogre::Ray::intersects().

## ◆ intersects() [4/4]

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

Sphere / plane intersection test.

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

References Ogre::Sphere::intersects().

## ◆ midPoint() [1/2]

 Vector2 Ogre::VectorBase< 2, Real >::midPoint ( const Vector2 & vec ) const
inline

Returns a vector at a point half way between this and the passed in vector.

## ◆ randomDeviant() [1/2]

 Vector2 Ogre::VectorBase< 2, Real >::randomDeviant ( Radian angle ) const
inline

Generates a new random vector which deviates from this vector by a given angle in a random direction.

Remarks
This method assumes that the random number generator has already been seeded appropriately.
Parameters
 angle The angle at which to deviate in radians
Returns
A random vector which deviates from this vector by angle. This vector will not be normalised, normalise it if you wish afterwards.

References Ogre::Math::Cos(), Ogre::Math::RangeRandom(), and Ogre::Math::Sin().

## ◆ angleTo()

 Radian Ogre::VectorBase< 2, Real >::angleTo ( const Vector2 & other ) const
inline

Gets the oriented angle between 2 vectors.

Remarks
Vectors do not have to be unit-length but must represent directions. The angle is comprised between 0 and 2 PI.

References Ogre::Math::TWO_PI.

## ◆ perpendicular() [1/2]

 Vector2 Ogre::VectorBase< 2, Real >::perpendicular ( void ) const
inline

Generates a vector perpendicular to this vector (eg an 'up' vector).

Remarks
This method will return a vector which is perpendicular to this vector. There are an infinite number of possibilities but this method will guarantee to generate one of them. If you need more control you should use the Quaternion class.

## ◆ perpendicular() [2/2]

 Vector3 Ogre::VectorBase< 3, Real >::perpendicular ( void ) const
inline

Generates a vector perpendicular to this vector (eg an 'up' vector).

Remarks
This method will return a vector which is perpendicular to this vector. There are an infinite number of possibilities but this method will guarantee to generate one of them. If you need more control you should use the Quaternion class.

References Ogre::Math::Abs(), and Ogre::Vector< dims, T >::normalisedCopy().

## ◆ crossProduct()

 Vector3 Ogre::VectorBase< 3, Real >::crossProduct ( const Vector3 & rkVector ) const
inline

Calculates the cross-product of 2 vectors, i.e.

the vector that lies perpendicular to them both.

Remarks
The cross-product is normally used to calculate the normal vector of a plane, by calculating the cross-product of 2 non-equivalent vectors which lie on the plane (e.g. 2 edges of a triangle).
Parameters
 rkVector Vector which, together with this one, will be used to calculate the cross-product.
Returns
A vector which is the result of the cross-product. This vector will NOT be normalised, to maximise efficiency
• call Vector3::normalise on the result if you wish this to be done. As for which side the resultant vector will be on, the returned vector will be on the side from which the arc from 'this' to rkVector is anticlockwise, e.g. UNIT_Y.crossProduct(UNIT_Z) = UNIT_X, whilst UNIT_Z.crossProduct(UNIT_Y) = -UNIT_X. This is because OGRE uses a right-handed coordinate system.
For a clearer explanation, look a the left and the bottom edges of your monitor's screen. Assume that the first vector is the left edge and the second vector is the bottom edge, both of them starting from the lower-left corner of the screen. The resulting vector is going to be perpendicular to both of them and will go inside the screen, towards the cathode tube (assuming you're using a CRT monitor, of course).

## ◆ midPoint() [2/2]

 Vector3 Ogre::VectorBase< 3, Real >::midPoint ( const Vector3 & vec ) const
inline

Returns a vector at a point half way between this and the passed in vector.

## ◆ randomDeviant() [2/2]

 Vector3 Ogre::VectorBase< 3, Real >::randomDeviant ( const Radian & angle, const Vector3 & up = ZERO ) const
inline

Generates a new random vector which deviates from this vector by a given angle in a random direction.

Remarks
This method assumes that the random number generator has already been seeded appropriately.
Parameters
 angle The angle at which to deviate up Any vector perpendicular to this one (which could generated by cross-product of this vector and any other non-colinear vector). If you choose not to provide this the function will derive one on it's own, however if you provide one yourself the function will be faster (this allows you to reuse up vectors if you call this method more than once)
Returns
A random vector which deviates from this vector by angle. This vector will not be normalised, normalise it if you wish afterwards.

## ◆ getRotationTo()

 Quaternion Ogre::VectorBase< 3, Real >::getRotationTo ( const Vector3 & dest, const Vector3 & fallbackAxis = ZERO ) const
inline

Gets the shortest arc quaternion to rotate this vector to the destination vector.

Remarks
If you call this with a dest vector that is close to the inverse of this vector, we will rotate 180 degrees around the 'fallbackAxis' (if specified, or a generated axis if not) since in this case ANY axis of rotation is valid.

## ◆ positionCloses()

 bool Ogre::VectorBase< 3, Real >::positionCloses ( const Vector3 & rhs, Real tolerance = 1e-03f ) const
inline

Returns whether this vector is within a positional tolerance of another vector, also take scale of the vectors into account.

Parameters
 rhs The vector to compare with tolerance The amount (related to the scale of vectors) that distance of the vector may vary by and still be considered close

References Ogre::Vector< dims, T >::squaredLength().

## ◆ directionEquals()

 bool Ogre::VectorBase< 3, Real >::directionEquals ( const Vector3 & rhs, const Radian & tolerance ) const
inline

Returns whether this vector is within a directional tolerance of another vector.

Parameters
 rhs The vector to compare with tolerance The maximum angle by which the vectors may vary and still be considered equal
Note
Both vectors should be normalised.

## ◆ primaryAxis()

 const Vector3 & Ogre::VectorBase< 3, Real >::primaryAxis ( ) const
inline

Extract the primary (dominant) axis from this direction vector.

References Ogre::Math::Abs().

## ◆ calculateBasicFaceNormal()

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

Calculate a face normal, no w-information.

References Ogre::Vector< dims, T >::normalise().

## ◆ calculateFaceNormal()

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

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

## ◆ calculateBasicFaceNormalWithoutNormalize()

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

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

Referenced by Ogre::Math::calculateFaceNormalWithoutNormalize().

## ◆ calculateFaceNormalWithoutNormalize()

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

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