OGRE-Next
3.0.0
Object-Oriented Graphics Rendering Engine
|
Standard 3-dimensional vector. More...
#include <OgreVector3.h>
Public Member Functions | |
Vector3 () | |
Default constructor. More... | |
Vector3 (const int afCoordinate[3]) | |
Vector3 (const Real afCoordinate[3]) | |
Vector3 (const Real fX, const Real fY, const Real fZ) | |
Vector3 (const Real scaler) | |
Vector3 (Real *const r) | |
Real | absDotProduct (const Vector3 &vec) const |
Calculates the absolute dot (scalar) product of this vector with another. More... | |
Radian | angleBetween (const Vector3 &dest) const |
Gets the angle between 2 vectors. More... | |
Real | collapseMax () const |
Returns the maximum value of all components. More... | |
Real | collapseMin () const |
Returns the minimum value of all components. More... | |
Vector3 | crossProduct (const Vector3 &rkVector) const |
Calculates the cross-product of 2 vectors, i.e. More... | |
bool | directionEquals (const Vector3 &rhs, const Radian &tolerance) const |
Returns whether this vector is within a directional tolerance of another vector. More... | |
Real | distance (const Vector3 &rhs) const |
Returns the distance to another vector. More... | |
Real | dotProduct (const Vector3 &vec) const |
Calculates the dot (scalar) product of this vector with another. More... | |
Quaternion | getRotationTo (const Vector3 &dest, const Vector3 &fallbackAxis=Vector3::ZERO) const |
Gets the shortest arc quaternion to rotate this vector to the destination vector. More... | |
bool | isNaN () const |
Check whether this vector contains valid values. More... | |
bool | isZeroLength () const |
Returns true if this vector is zero length. More... | |
Real | length () const |
Returns the length (magnitude) of the vector. More... | |
void | makeAbs () |
Causes negative members to become positive. More... | |
void | makeCeil (const Vector3 &cmp) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector. More... | |
void | makeFloor (const Vector3 &cmp) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector. More... | |
Vector3 | midPoint (const Vector3 &vec) const |
Returns a vector at a point half way between this and the passed in vector. More... | |
Real | normalise () |
Normalises the vector. More... | |
Vector3 | normalisedCopy () const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy. More... | |
bool | operator!= (const Vector3 &rkVector) const |
Vector3 | operator* (const Real fScalar) const |
Vector3 | operator* (const Vector3 &rhs) const |
Vector3 & | operator*= (const Real fScalar) |
Vector3 & | operator*= (const Vector3 &rkVector) |
const Vector3 & | operator+ () const |
Vector3 | operator+ (const Vector3 &rkVector) const |
Vector3 & | operator+= (const Real fScalar) |
Vector3 & | operator+= (const Vector3 &rkVector) |
Vector3 | operator- () const |
Vector3 | operator- (const Vector3 &rkVector) const |
Vector3 & | operator-= (const Real fScalar) |
Vector3 & | operator-= (const Vector3 &rkVector) |
Vector3 | operator/ (const Real fScalar) const |
Vector3 | operator/ (const Vector3 &rhs) const |
Vector3 & | operator/= (const Real fScalar) |
Vector3 & | operator/= (const Vector3 &rkVector) |
bool | operator< (const Vector3 &rhs) const |
Returns true if the vector's scalar components are all greater that the ones of the vector it is compared against. More... | |
Vector3 & | operator= (const Real fScaler) |
bool | operator== (const Vector3 &rkVector) const |
bool | operator> (const Vector3 &rhs) const |
Returns true if the vector's scalar components are all smaller that the ones of the vector it is compared against. More... | |
Real & | operator[] (const size_t i) |
Real | operator[] (const size_t i) const |
Vector3 | perpendicular () const |
Generates a vector perpendicular to this vector (eg an 'up' vector). More... | |
bool | 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... | |
bool | positionEquals (const Vector3 &rhs, Real tolerance=Real(1e-03)) const |
Returns whether this vector is within a positional tolerance of another vector. More... | |
Vector3 | primaryAxis () const |
Extract the primary (dominant) axis from this direction vector. More... | |
Real * | ptr () |
Pointer accessor for direct copying. More... | |
const Real * | ptr () const |
Pointer accessor for direct copying. More... | |
Vector3 | randomDeviant (const Radian &angle, const Vector3 &up=Vector3::ZERO) const |
Generates a new random vector which deviates from this vector by a given angle in a random direction. More... | |
Vector3 | reflect (const Vector3 &normal) const |
Calculates a reflection vector to the plane with the given normal . More... | |
Real | squaredDistance (const Vector3 &rhs) const |
Returns the square of the distance to another vector. More... | |
Real | squaredLength () const |
Returns the square of the length(magnitude) of the vector. More... | |
void | swap (Vector3 &other) |
Exchange the contents of this vector with another. More... | |
Vector2 | xy () const |
Swizzle-like narrowing operations. More... | |
Public Attributes | |
Real | x |
Real | y |
Real | z |
Static Public Attributes | |
static const Vector3 | NEGATIVE_UNIT_X |
static const Vector3 | NEGATIVE_UNIT_Y |
static const Vector3 | NEGATIVE_UNIT_Z |
static const Vector3 | UNIT_SCALE |
static const Vector3 | UNIT_X |
static const Vector3 | UNIT_Y |
static const Vector3 | UNIT_Z |
static const Vector3 | ZERO |
Standard 3-dimensional vector.
|
inline |
Default constructor.
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Calculates the absolute dot (scalar) product of this vector with another.
vec | Vector with which to calculate the absolute dot product (together with this one). |
References Ogre::Math::Abs(), x, y, and z.
Gets the angle between 2 vectors.
References Ogre::Math::ACos(), Ogre::Math::Clamp(), and length().
|
inline |
Returns the maximum value of all components.
|
inline |
Returns the minimum value of all components.
Calculates the cross-product of 2 vectors, i.e.
the vector that lies perpendicular to them both.
rkVector | Vector which, together with this one, will be used to calculate the cross-product. |
Referenced by getRotationTo().
Returns whether this vector is within a directional tolerance of another vector.
rhs | The vector to compare with |
tolerance | The maximum angle by which the vectors may vary and still be considered equal |
References Ogre::Math::Abs(), Ogre::Math::ACos(), and Ogre::Radian::valueRadians().
Returns the distance to another vector.
Calculates the dot (scalar) product of this vector with another.
vec | Vector with which to calculate the dot product (together with this one). |
Referenced by Ogre::Plane::getDistance(), getRotationTo(), and Ogre::Plane::redefine().
|
inline |
Gets the shortest arc quaternion to rotate this vector to the destination vector.
References crossProduct(), dotProduct(), Ogre::Quaternion::FromAngleAxis(), Ogre::Quaternion::IDENTITY, isZeroLength(), Ogre::Quaternion::normalise(), normalise(), Ogre::Math::PI, Ogre::Math::Sqrt(), UNIT_X, UNIT_Y, Ogre::Quaternion::w, Ogre::Quaternion::x, x, Ogre::Quaternion::y, y, Ogre::Quaternion::z, z, and ZERO.
|
inline |
Check whether this vector contains valid values.
References Ogre::Math::isNaN().
|
inline |
Returns true if this vector is zero length.
Referenced by getRotationTo().
|
inline |
Returns the length (magnitude) of the vector.
References Ogre::Math::Sqrt().
Referenced by angleBetween().
|
inline |
Causes negative members to become positive.
References Ogre::Math::Abs().
|
inline |
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
Referenced by Ogre::AxisAlignedBox::intersection(), and Ogre::AxisAlignedBox::merge().
|
inline |
Sets this vector's components to the minimum of its own and the ones of the passed in vector.
Referenced by Ogre::AxisAlignedBox::intersection(), and Ogre::AxisAlignedBox::merge().
|
inline |
Normalises the vector.
References Ogre::Math::Sqrt().
Referenced by getRotationTo(), normalisedCopy(), Ogre::Matrix4::operator*(), and perpendicular().
|
inline |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy.
References normalise().
Referenced by Ogre::Plane::redefine().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Generates a vector perpendicular to this vector (eg an 'up' vector).
References normalise(), squaredLength(), UNIT_X, and UNIT_Y.
Returns whether this vector is within a positional tolerance of another vector, also take scale of the vectors into account.
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 squaredLength().
|
inline |
Returns whether this vector is within a positional tolerance of another vector.
rhs | The vector to compare with |
tolerance | The amount that each element of the vector may vary by and still be considered equal |
References Ogre::Math::RealEqual(), x, y, and z.
|
inline |
Extract the primary (dominant) axis from this direction vector.
References Ogre::Math::Abs(), NEGATIVE_UNIT_X, NEGATIVE_UNIT_Y, NEGATIVE_UNIT_Z, UNIT_X, UNIT_Y, and UNIT_Z.
|
inline |
Pointer accessor for direct copying.
|
inline |
Pointer accessor for direct copying.
|
inline |
Generates a new random vector which deviates from this vector by a given angle in a random direction.
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) |
References Ogre::Quaternion::FromAngleAxis(), Ogre::Math::TWO_PI, Ogre::Math::UnitRandom(), and ZERO.
Calculates a reflection vector to the plane with the given normal .
Returns the square of the distance to another vector.
|
inline |
Returns the square of the length(magnitude) of the vector.
Referenced by Ogre::Sphere::merge(), perpendicular(), positionCloses(), and Ogre::AxisAlignedBox::squaredDistance().
|
inline |
Exchange the contents of this vector with another.
References std::swap(), x, y, and z.
|
inline |
Swizzle-like narrowing operations.
|
static |
Referenced by primaryAxis().
|
static |
Referenced by primaryAxis().
|
static |
Referenced by primaryAxis().
|
static |
|
static |
Referenced by getRotationTo(), perpendicular(), and primaryAxis().
|
static |
Referenced by getRotationTo(), perpendicular(), and primaryAxis().
|
static |
Referenced by primaryAxis().
Real Ogre::Vector3::x |
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), Ogre::ColourValue::fromVector3(), Ogre::AxisAlignedBox::getAllCorners(), Ogre::ArrayAabb::getAsAabb(), Ogre::ArrayVector3::getAsVector3(), Ogre::AxisAlignedBox::getCenter(), Ogre::Volume::OctreeNode::getCenterBack(), Ogre::Volume::OctreeNode::getCenterBackBottom(), Ogre::Volume::OctreeNode::getCenterBackLeft(), Ogre::Volume::OctreeNode::getCenterBackRight(), Ogre::Volume::OctreeNode::getCenterBackTop(), Ogre::Volume::OctreeNode::getCenterBottom(), Ogre::Volume::OctreeNode::getCenterFront(), Ogre::Volume::OctreeNode::getCenterFrontBottom(), Ogre::Volume::OctreeNode::getCenterFrontLeft(), Ogre::Volume::OctreeNode::getCenterFrontRight(), Ogre::Volume::OctreeNode::getCenterFrontTop(), Ogre::Volume::OctreeNode::getCenterLeft(), Ogre::Volume::OctreeNode::getCenterLeftBottom(), Ogre::Volume::OctreeNode::getCenterLeftTop(), Ogre::Volume::OctreeNode::getCenterRight(), Ogre::Volume::OctreeNode::getCenterRightBottom(), Ogre::Volume::OctreeNode::getCenterRightTop(), Ogre::Volume::OctreeNode::getCenterTop(), Ogre::Volume::OctreeNode::getChildrenDimensions(), Ogre::AxisAlignedBox::getCorner(), Ogre::Volume::OctreeNode::getCorner1(), Ogre::Volume::OctreeNode::getCorner2(), Ogre::Volume::OctreeNode::getCorner3(), Ogre::Volume::OctreeNode::getCorner4(), Ogre::Volume::OctreeNode::getCorner5(), Ogre::Volume::OctreeNode::getCorner7(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderLeft(), Ogre::Volume::OctreeNode::isBorderRight(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), operator!=(), operator*(), Ogre::Matrix4::operator*(), operator*=(), operator+(), operator+=(), Ogre::Plane::operator-(), operator-(), operator-=(), operator/(), operator/=(), operator<(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), Ogre::ArraySphere::setAll(), Ogre::ArrayVector3::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::ArrayVector3::setFromVector3(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMaximumX(), Ogre::AxisAlignedBox::setMinimum(), Ogre::AxisAlignedBox::setMinimumX(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), Ogre::AxisAlignedBox::squaredDistance(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::AxisAlignedBox::transformAffine(), Ogre::Matrix4::transformAffine(), Ogre::Matrix4::transformDirectionAffine(), and Ogre::AxisAlignedBox::volume().
Real Ogre::Vector3::y |
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), Ogre::ColourValue::fromVector3(), Ogre::AxisAlignedBox::getAllCorners(), Ogre::ArrayAabb::getAsAabb(), Ogre::ArrayVector3::getAsVector3(), Ogre::AxisAlignedBox::getCenter(), Ogre::Volume::OctreeNode::getCenterBack(), Ogre::Volume::OctreeNode::getCenterBackBottom(), Ogre::Volume::OctreeNode::getCenterBackLeft(), Ogre::Volume::OctreeNode::getCenterBackRight(), Ogre::Volume::OctreeNode::getCenterBackTop(), Ogre::Volume::OctreeNode::getCenterBottom(), Ogre::Volume::OctreeNode::getCenterFront(), Ogre::Volume::OctreeNode::getCenterFrontBottom(), Ogre::Volume::OctreeNode::getCenterFrontLeft(), Ogre::Volume::OctreeNode::getCenterFrontRight(), Ogre::Volume::OctreeNode::getCenterFrontTop(), Ogre::Volume::OctreeNode::getCenterLeft(), Ogre::Volume::OctreeNode::getCenterLeftBottom(), Ogre::Volume::OctreeNode::getCenterLeftTop(), Ogre::Volume::OctreeNode::getCenterRight(), Ogre::Volume::OctreeNode::getCenterRightBottom(), Ogre::Volume::OctreeNode::getCenterRightTop(), Ogre::Volume::OctreeNode::getCenterTop(), Ogre::Volume::OctreeNode::getChildrenDimensions(), Ogre::AxisAlignedBox::getCorner(), Ogre::Volume::OctreeNode::getCorner1(), Ogre::Volume::OctreeNode::getCorner2(), Ogre::Volume::OctreeNode::getCorner3(), Ogre::Volume::OctreeNode::getCorner4(), Ogre::Volume::OctreeNode::getCorner5(), Ogre::Volume::OctreeNode::getCorner7(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderBottom(), Ogre::Volume::OctreeNode::isBorderTop(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), operator!=(), operator*(), Ogre::Matrix4::operator*(), operator*=(), operator+(), operator+=(), Ogre::Plane::operator-(), operator-(), operator-=(), operator/(), operator/=(), operator<(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), Ogre::ArraySphere::setAll(), Ogre::ArrayVector3::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::ArrayVector3::setFromVector3(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMaximumY(), Ogre::AxisAlignedBox::setMinimum(), Ogre::AxisAlignedBox::setMinimumY(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), Ogre::AxisAlignedBox::squaredDistance(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::AxisAlignedBox::transformAffine(), Ogre::Matrix4::transformAffine(), Ogre::Matrix4::transformDirectionAffine(), and Ogre::AxisAlignedBox::volume().
Real Ogre::Vector3::z |
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), Ogre::ColourValue::fromVector3(), Ogre::AxisAlignedBox::getAllCorners(), Ogre::ArrayAabb::getAsAabb(), Ogre::ArrayVector3::getAsVector3(), Ogre::AxisAlignedBox::getCenter(), Ogre::Volume::OctreeNode::getCenterBack(), Ogre::Volume::OctreeNode::getCenterBackBottom(), Ogre::Volume::OctreeNode::getCenterBackLeft(), Ogre::Volume::OctreeNode::getCenterBackRight(), Ogre::Volume::OctreeNode::getCenterBackTop(), Ogre::Volume::OctreeNode::getCenterBottom(), Ogre::Volume::OctreeNode::getCenterFront(), Ogre::Volume::OctreeNode::getCenterFrontBottom(), Ogre::Volume::OctreeNode::getCenterFrontLeft(), Ogre::Volume::OctreeNode::getCenterFrontRight(), Ogre::Volume::OctreeNode::getCenterFrontTop(), Ogre::Volume::OctreeNode::getCenterLeft(), Ogre::Volume::OctreeNode::getCenterLeftBottom(), Ogre::Volume::OctreeNode::getCenterLeftTop(), Ogre::Volume::OctreeNode::getCenterRight(), Ogre::Volume::OctreeNode::getCenterRightBottom(), Ogre::Volume::OctreeNode::getCenterRightTop(), Ogre::Volume::OctreeNode::getCenterTop(), Ogre::Volume::OctreeNode::getChildrenDimensions(), Ogre::AxisAlignedBox::getCorner(), Ogre::Volume::OctreeNode::getCorner1(), Ogre::Volume::OctreeNode::getCorner2(), Ogre::Volume::OctreeNode::getCorner3(), Ogre::Volume::OctreeNode::getCorner4(), Ogre::Volume::OctreeNode::getCorner5(), Ogre::Volume::OctreeNode::getCorner7(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderBack(), Ogre::Volume::OctreeNode::isBorderFront(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), operator!=(), operator*(), Ogre::Matrix4::operator*(), operator*=(), operator+(), operator+=(), Ogre::Plane::operator-(), operator-(), operator-=(), operator/(), operator/=(), operator<(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), Ogre::ArraySphere::setAll(), Ogre::ArrayVector3::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::ArrayVector3::setFromVector3(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMaximumZ(), Ogre::AxisAlignedBox::setMinimum(), Ogre::AxisAlignedBox::setMinimumZ(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), Ogre::AxisAlignedBox::squaredDistance(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::AxisAlignedBox::transformAffine(), Ogre::Matrix4::transformAffine(), Ogre::Matrix4::transformDirectionAffine(), and Ogre::AxisAlignedBox::volume().
|
static |
Referenced by Ogre::AxisAlignedBox::getHalfSize(), getRotationTo(), Ogre::AxisAlignedBox::getSize(), and randomDeviant().