Standard 3-dimensional vector. More...
#include <OgreVector3.h>
Public Member Functions | |
Vector3 () | |
Vector3 (const Real fX, const Real fY, const Real fZ) | |
Vector3 (const Real afCoordinate[3]) | |
Vector3 (const int afCoordinate[3]) | |
Vector3 (Real *const r) | |
Vector3 (const Real scaler) | |
void | swap (Vector3 &other) |
Exchange the contents of this vector with another. | |
Real | operator[] (const size_t i) const |
Real & | operator[] (const size_t i) |
Real * | ptr () |
Pointer accessor for direct copying. | |
const Real * | ptr () const |
Pointer accessor for direct copying. | |
Vector3 & | operator= (const Vector3 &rkVector) |
Assigns the value of the other vector. | |
Vector3 & | operator= (const Real fScaler) |
bool | operator== (const Vector3 &rkVector) const |
bool | operator!= (const Vector3 &rkVector) const |
Vector3 | operator+ (const Vector3 &rkVector) const |
Vector3 | operator- (const Vector3 &rkVector) const |
Vector3 | operator* (const Real fScalar) const |
Vector3 | operator* (const Vector3 &rhs) const |
Vector3 | operator/ (const Real fScalar) const |
Vector3 | operator/ (const Vector3 &rhs) const |
const Vector3 & | operator+ () const |
Vector3 | operator- () const |
Vector3 & | operator+= (const Vector3 &rkVector) |
Vector3 & | operator+= (const Real fScalar) |
Vector3 & | operator-= (const Vector3 &rkVector) |
Vector3 & | operator-= (const Real fScalar) |
Vector3 & | operator*= (const Real fScalar) |
Vector3 & | operator*= (const Vector3 &rkVector) |
Vector3 & | operator/= (const Real fScalar) |
Vector3 & | operator/= (const Vector3 &rkVector) |
Real | length () const |
Returns the length (magnitude) of the vector. | |
Real | squaredLength () const |
Returns the square of the length(magnitude) of the vector. | |
Real | distance (const Vector3 &rhs) const |
Returns the distance to another vector. | |
Real | squaredDistance (const Vector3 &rhs) const |
Returns the square of the distance to another vector. | |
Real | dotProduct (const Vector3 &vec) const |
Calculates the dot (scalar) product of this vector with another. | |
Real | absDotProduct (const Vector3 &vec) const |
Calculates the absolute dot (scalar) product of this vector with another. | |
Real | normalise () |
Normalises the vector. | |
Vector3 | crossProduct (const Vector3 &rkVector) const |
Calculates the cross-product of 2 vectors, i.e. | |
Vector3 | midPoint (const Vector3 &vec) const |
Returns a vector at a point half way between this and the passed in vector. | |
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. | |
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. | |
void | makeFloor (const Vector3 &cmp) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector. | |
void | makeCeil (const Vector3 &cmp) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector. | |
Vector3 | perpendicular (void) const |
Generates a vector perpendicular to this vector (eg an 'up' vector). | |
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. | |
Radian | angleBetween (const Vector3 &dest) const |
Gets the angle between 2 vectors. | |
Quaternion | getRotationTo (const Vector3 &dest, const Vector3 &fallbackAxis=Vector3::ZERO) const |
Gets the shortest arc quaternion to rotate this vector to the destination vector. | |
bool | isZeroLength (void) const |
Returns true if this vector is zero length. | |
Vector3 | normalisedCopy (void) const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy. | |
Vector3 | reflect (const Vector3 &normal) const |
Calculates a reflection vector to the plane with the given normal . | |
bool | positionEquals (const Vector3 &rhs, Real tolerance=1e-03) const |
Returns whether this vector is within a positional tolerance of another vector. | |
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. | |
bool | directionEquals (const Vector3 &rhs, const Radian &tolerance) const |
Returns whether this vector is within a directional tolerance of another vector. | |
bool | isNaN () const |
Check whether this vector contains valid values. | |
Vector3 | primaryAxis () const |
Extract the primary (dominant) axis from this direction vector. | |
Public Attributes | |
Real | x |
Real | y |
Real | z |
Static Public Attributes | |
static const Vector3 | ZERO |
static const Vector3 | UNIT_X |
static const Vector3 | UNIT_Y |
static const Vector3 | UNIT_Z |
static const Vector3 | NEGATIVE_UNIT_X |
static const Vector3 | NEGATIVE_UNIT_Y |
static const Vector3 | NEGATIVE_UNIT_Z |
static const Vector3 | UNIT_SCALE |
Friends | |
Vector3 | operator* (const Real fScalar, const Vector3 &rkVector) |
Vector3 | operator/ (const Real fScalar, const Vector3 &rkVector) |
Vector3 | operator+ (const Vector3 &lhs, const Real rhs) |
Vector3 | operator+ (const Real lhs, const Vector3 &rhs) |
Vector3 | operator- (const Vector3 &lhs, const Real rhs) |
Vector3 | operator- (const Real lhs, const Vector3 &rhs) |
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const Vector3 &v) |
Function for writing to a stream. |
Standard 3-dimensional vector.
Definition at line 51 of file OgreVector3.h.
Ogre::Vector3::Vector3 | ( | ) |
Definition at line 57 of file OgreVector3.h.
Definition at line 61 of file OgreVector3.h.
Ogre::Vector3::Vector3 | ( | const Real | afCoordinate[3] | ) | [explicit] |
Definition at line 66 of file OgreVector3.h.
Ogre::Vector3::Vector3 | ( | const int | afCoordinate[3] | ) | [explicit] |
Definition at line 73 of file OgreVector3.h.
Ogre::Vector3::Vector3 | ( | Real *const | r | ) | [explicit] |
Definition at line 80 of file OgreVector3.h.
Ogre::Vector3::Vector3 | ( | const Real | scaler | ) | [explicit] |
Definition at line 85 of file OgreVector3.h.
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). |
Definition at line 428 of file OgreVector3.h.
References Ogre::Math::Abs(), x, y, and z.
Gets the angle between 2 vectors.
Definition at line 629 of file OgreVector3.h.
References Ogre::Math::ACos(), Ogre::Math::Clamp(), and length().
Calculates the cross-product of 2 vectors, i.e.
the vector that lies perpendicular to them both.
vec | Vector which, together with this one, will be used to calculate the cross-product. |
Definition at line 488 of file OgreVector3.h.
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 |
Definition at line 759 of file OgreVector3.h.
References Ogre::Math::Abs(), Ogre::Math::ACos(), and Ogre::Radian::valueRadians().
Returns the distance to another vector.
Definition at line 379 of file OgreVector3.h.
Calculates the dot (scalar) product of this vector with another.
vec | Vector with which to calculate the dot product (together with this one). |
Definition at line 413 of file OgreVector3.h.
Referenced by getRotationTo().
Quaternion Ogre::Vector3::getRotationTo | ( | const Vector3 & | dest, | |
const Vector3 & | fallbackAxis = Vector3::ZERO | |||
) | const |
Gets the shortest arc quaternion to rotate this vector to the destination vector.
Definition at line 651 of file OgreVector3.h.
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, x, Ogre::Quaternion::x, y, Ogre::Quaternion::y, z, Ogre::Quaternion::z, and ZERO.
bool Ogre::Vector3::isNaN | ( | ) | const |
Check whether this vector contains valid values.
Definition at line 770 of file OgreVector3.h.
References Ogre::Math::isNaN().
bool Ogre::Vector3::isZeroLength | ( | void | ) | const |
Returns true if this vector is zero length.
Definition at line 702 of file OgreVector3.h.
Referenced by getRotationTo().
Real Ogre::Vector3::length | ( | ) | const |
Returns the length (magnitude) of the vector.
Definition at line 352 of file OgreVector3.h.
References Ogre::Math::Sqrt().
Referenced by angleBetween().
void Ogre::Vector3::makeCeil | ( | const Vector3 & | cmp | ) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
Definition at line 548 of file OgreVector3.h.
Referenced by Ogre::AxisAlignedBox::intersection(), and Ogre::AxisAlignedBox::merge().
void Ogre::Vector3::makeFloor | ( | const Vector3 & | cmp | ) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector.
Definition at line 534 of file OgreVector3.h.
Referenced by Ogre::AxisAlignedBox::intersection(), and Ogre::AxisAlignedBox::merge().
Returns a vector at a point half way between this and the passed in vector.
Definition at line 499 of file OgreVector3.h.
Real Ogre::Vector3::normalise | ( | ) |
Normalises the vector.
Definition at line 442 of file OgreVector3.h.
References Ogre::Math::Sqrt().
Referenced by getRotationTo(), normalisedCopy(), Ogre::Matrix4::operator*(), and perpendicular().
Vector3 Ogre::Vector3::normalisedCopy | ( | void | ) | const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy.
Definition at line 711 of file OgreVector3.h.
References normalise().
bool Ogre::Vector3::operator!= | ( | const Vector3 & | rkVector | ) | const |
Definition at line 153 of file OgreVector3.h.
Definition at line 183 of file OgreVector3.h.
Definition at line 175 of file OgreVector3.h.
Definition at line 313 of file OgreVector3.h.
Definition at line 305 of file OgreVector3.h.
const Vector3& Ogre::Vector3::operator+ | ( | ) | const |
Definition at line 211 of file OgreVector3.h.
Definition at line 159 of file OgreVector3.h.
Definition at line 280 of file OgreVector3.h.
Definition at line 271 of file OgreVector3.h.
Vector3 Ogre::Vector3::operator- | ( | ) | const |
Definition at line 216 of file OgreVector3.h.
Definition at line 167 of file OgreVector3.h.
Definition at line 297 of file OgreVector3.h.
Definition at line 288 of file OgreVector3.h.
Definition at line 203 of file OgreVector3.h.
Definition at line 191 of file OgreVector3.h.
Definition at line 335 of file OgreVector3.h.
Definition at line 322 of file OgreVector3.h.
bool Ogre::Vector3::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.
Definition at line 510 of file OgreVector3.h.
Definition at line 139 of file OgreVector3.h.
Assigns the value of the other vector.
rkVector | The other vector |
Definition at line 130 of file OgreVector3.h.
bool Ogre::Vector3::operator== | ( | const Vector3 & | rkVector | ) | const |
Definition at line 148 of file OgreVector3.h.
bool Ogre::Vector3::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.
Definition at line 520 of file OgreVector3.h.
Real& Ogre::Vector3::operator[] | ( | const size_t | i | ) |
Definition at line 109 of file OgreVector3.h.
Real Ogre::Vector3::operator[] | ( | const size_t | i | ) | const |
Definition at line 102 of file OgreVector3.h.
Vector3 Ogre::Vector3::perpendicular | ( | void | ) | const |
Generates a vector perpendicular to this vector (eg an 'up' vector).
Definition at line 562 of file OgreVector3.h.
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 |
Definition at line 746 of file OgreVector3.h.
References squaredLength().
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 |
Definition at line 732 of file OgreVector3.h.
References Ogre::Math::RealEqual(), x, y, and z.
Vector3 Ogre::Vector3::primaryAxis | ( | ) | const |
Extract the primary (dominant) axis from this direction vector.
Definition at line 776 of file OgreVector3.h.
References Ogre::Math::Abs(), NEGATIVE_UNIT_X, NEGATIVE_UNIT_Y, NEGATIVE_UNIT_Z, UNIT_X, UNIT_Y, and UNIT_Z.
const Real* Ogre::Vector3::ptr | ( | ) | const |
Pointer accessor for direct copying.
Definition at line 121 of file OgreVector3.h.
Real* Ogre::Vector3::ptr | ( | ) |
Pointer accessor for direct copying.
Definition at line 116 of file OgreVector3.h.
Referenced by Ogre::AnimableValue::setAsBaseValue().
Vector3 Ogre::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.
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) |
Definition at line 599 of file OgreVector3.h.
References Ogre::Quaternion::FromAngleAxis(), Ogre::Math::TWO_PI, Ogre::Math::UnitRandom(), and ZERO.
Calculates a reflection vector to the plane with the given normal .
Definition at line 721 of file OgreVector3.h.
Returns the square of the distance to another vector.
Definition at line 394 of file OgreVector3.h.
Real Ogre::Vector3::squaredLength | ( | ) | const |
Returns the square of the length(magnitude) of the vector.
Definition at line 367 of file OgreVector3.h.
Referenced by Ogre::Sphere::intersects(), Ogre::Sphere::merge(), perpendicular(), and positionCloses().
void Ogre::Vector3::swap | ( | Vector3 & | other | ) |
Exchange the contents of this vector with another.
Definition at line 95 of file OgreVector3.h.
References std::swap(), x, y, and z.
Definition at line 222 of file OgreVector3.h.
Definition at line 246 of file OgreVector3.h.
Definition at line 238 of file OgreVector3.h.
Definition at line 262 of file OgreVector3.h.
Definition at line 254 of file OgreVector3.h.
Definition at line 230 of file OgreVector3.h.
_OgreExport friend std::ostream& operator<< | ( | std::ostream & | o, | |
const Vector3 & | v | |||
) | [friend] |
Function for writing to a stream.
Definition at line 808 of file OgreVector3.h.
const Vector3 Ogre::Vector3::NEGATIVE_UNIT_X [static] |
Definition at line 800 of file OgreVector3.h.
Referenced by primaryAxis().
const Vector3 Ogre::Vector3::NEGATIVE_UNIT_Y [static] |
Definition at line 801 of file OgreVector3.h.
Referenced by primaryAxis().
const Vector3 Ogre::Vector3::NEGATIVE_UNIT_Z [static] |
Definition at line 802 of file OgreVector3.h.
Referenced by primaryAxis().
const Vector3 Ogre::Vector3::UNIT_SCALE [static] |
Definition at line 803 of file OgreVector3.h.
const Vector3 Ogre::Vector3::UNIT_X [static] |
Definition at line 797 of file OgreVector3.h.
Referenced by getRotationTo(), perpendicular(), and primaryAxis().
const Vector3 Ogre::Vector3::UNIT_Y [static] |
Definition at line 798 of file OgreVector3.h.
Referenced by getRotationTo(), perpendicular(), and primaryAxis().
const Vector3 Ogre::Vector3::UNIT_Z [static] |
Definition at line 799 of file OgreVector3.h.
Referenced by primaryAxis().
Definition at line 54 of file OgreVector3.h.
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), Ogre::AxisAlignedBox::distance(), dotProduct(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), operator!=(), Ogre::EdgeListBuilder::vectorLess::operator()(), operator*(), Ogre::Matrix4::operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), Ogre::Vector4::operator=(), operator=(), operator==(), operator>(), positionEquals(), Ogre::AxisAlignedBox::setExtents(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMinimum(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::Matrix4::transformAffine(), Ogre::AxisAlignedBox::transformAffine(), and Ogre::AxisAlignedBox::volume().
Definition at line 54 of file OgreVector3.h.
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), Ogre::AxisAlignedBox::distance(), dotProduct(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), operator!=(), Ogre::EdgeListBuilder::vectorLess::operator()(), operator*(), Ogre::Matrix4::operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), Ogre::Vector4::operator=(), operator=(), operator==(), operator>(), positionEquals(), Ogre::AxisAlignedBox::setExtents(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::Matrix4::transformAffine(), Ogre::AxisAlignedBox::transformAffine(), and Ogre::AxisAlignedBox::volume().
Definition at line 54 of file OgreVector3.h.
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), Ogre::AxisAlignedBox::distance(), dotProduct(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), operator!=(), Ogre::EdgeListBuilder::vectorLess::operator()(), operator*(), Ogre::Matrix4::operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), Ogre::Vector4::operator=(), operator=(), operator==(), operator>(), positionEquals(), Ogre::AxisAlignedBox::setExtents(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::Matrix4::transformAffine(), Ogre::AxisAlignedBox::transformAffine(), and Ogre::AxisAlignedBox::volume().
const Vector3 Ogre::Vector3::ZERO [static] |
Definition at line 796 of file OgreVector3.h.
Referenced by Ogre::InstancedEntity::_getDerivedPosition(), Ogre::AxisAlignedBox::getHalfSize(), getRotationTo(), Ogre::AxisAlignedBox::getSize(), and randomDeviant().
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:41:25 2012