![]() |
OGRE-Next 3.0.0
Object-Oriented Graphics Rendering Engine
|
Standard 3-dimensional vector. More...
#include <OgreVector3.h>
Public Member Functions | |
Vector3 () | |
Default constructor. | |
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. | |
Radian | angleBetween (const Vector3 &dest) const |
Gets the angle between 2 vectors. | |
Real | collapseMax () const |
Returns the maximum value of all components. | |
Real | collapseMin () const |
Returns the minimum value of all components. | |
Vector3 | crossProduct (const Vector3 &rkVector) const |
Calculates the cross-product of 2 vectors, i.e. | |
bool | directionEquals (const Vector3 &rhs, const Radian &tolerance) const |
Returns whether this vector is within a directional tolerance of another vector. | |
Real | distance (const Vector3 &rhs) const |
Returns the distance to another vector. | |
Real | dotProduct (const Vector3 &vec) const |
Calculates the dot (scalar) product of this vector with another. | |
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 | isNaN () const |
Check whether this vector contains valid values. | |
bool | isZeroLength () const |
Returns true if this vector is zero length. | |
Real | length () const |
Returns the length (magnitude) of the vector. | |
void | makeAbs () |
Causes negative members to become positive. | |
void | makeCeil (const Vector3 &cmp) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector. | |
void | makeFloor (const Vector3 &cmp) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector. | |
Vector3 | midPoint (const Vector3 &vec) const |
Returns a vector at a point half way between this and the passed in vector. | |
Real | normalise () |
Normalises the vector. | |
Vector3 | normalisedCopy () const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy. | |
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. | |
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. | |
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). | |
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 | positionEquals (const Vector3 &rhs, Real tolerance=Real(1e-03)) const |
Returns whether this vector is within a positional tolerance of another vector. | |
Vector3 | primaryAxis () const |
Extract the primary (dominant) axis from this direction vector. | |
Real * | ptr () |
Pointer accessor for direct copying. | |
const Real * | ptr () const |
Pointer accessor for direct copying. | |
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. | |
Vector3 | reflect (const Vector3 &normal) const |
Calculates a reflection vector to the plane with the given normal . | |
Real | squaredDistance (const Vector3 &rhs) const |
Returns the square of the distance to another vector. | |
Real | squaredLength () const |
Returns the square of the length(magnitude) of the vector. | |
void | swap (Vector3 &other) |
Exchange the contents of this vector with another. | |
Vector2 | xy () const |
Swizzle-like narrowing operations. | |
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.
Referenced by absDotProduct(), angleBetween(), crossProduct(), directionEquals(), distance(), dotProduct(), getRotationTo(), makeCeil(), makeFloor(), midPoint(), normalisedCopy(), operator!=(), operator*(), operator*, operator*(), operator*=(), operator*=(), operator+(), operator+, operator+, operator+(), operator+=(), operator+=(), operator-(), operator-, operator-, operator-(), operator-=(), operator-=(), operator/(), operator/, operator/(), operator/=(), operator/=(), operator<(), operator<<, operator=(), operator==(), operator>(), perpendicular(), positionCloses(), positionEquals(), primaryAxis(), randomDeviant(), reflect(), squaredDistance(), and swap().
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 Vector3(), Ogre::Math::Abs(), x, y, and z.
Gets the angle between 2 vectors.
References Vector3(), Ogre::Math::ACos(), Ogre::Math::Clamp(), dotProduct(), and length().
|
inline |
|
inline |
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. |
References Vector3(), x, y, and z.
Referenced by getRotationTo(), and perpendicular().
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 Vector3(), Ogre::Math::Abs(), Ogre::Math::ACos(), dotProduct(), and Ogre::Radian::valueRadians().
Returns the distance to another vector.
References Vector3().
Calculates the dot (scalar) product of this vector with another.
vec | Vector with which to calculate the dot product (together with this one). |
References Vector3(), x, y, and z.
Referenced by angleBetween(), directionEquals(), getRotationTo(), Ogre::Plane::redefine(), and reflect().
|
inline |
Gets the shortest arc quaternion to rotate this vector to the destination vector.
References Vector3(), 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(), x, y, and z.
|
inline |
|
inline |
Returns the length (magnitude) of the vector.
References Ogre::Math::Sqrt(), x, y, and z.
Referenced by angleBetween().
|
inline |
Causes negative members to become positive.
References Ogre::Math::Abs(), x, y, and z.
|
inline |
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
References Vector3(), x, y, and z.
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.
References Vector3(), x, y, and z.
Referenced by Ogre::AxisAlignedBox::intersection(), and Ogre::AxisAlignedBox::merge().
|
inline |
Normalises the vector.
References Ogre::Math::Sqrt(), x, y, and z.
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 Vector3(), and normalise().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Generates a vector perpendicular to this vector (eg an 'up' vector).
References Vector3(), crossProduct(), normalise(), squaredLength(), UNIT_X, and UNIT_Y.
Referenced by randomDeviant().
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 Vector3(), squaredDistance(), and 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 Vector3(), Ogre::Math::RealEqual(), x, y, and z.
|
inline |
Extract the primary (dominant) axis from this direction vector.
References Vector3(), Ogre::Math::Abs(), NEGATIVE_UNIT_X, NEGATIVE_UNIT_Y, NEGATIVE_UNIT_Z, UNIT_X, UNIT_Y, UNIT_Z, x, y, and z.
|
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 Vector3(), Ogre::Quaternion::FromAngleAxis(), perpendicular(), Ogre::Math::TWO_PI, Ogre::Math::UnitRandom(), and ZERO.
Calculates a reflection vector to the plane with the given normal .
References Vector3(), and dotProduct().
Returns the square of the distance to another vector.
References Vector3().
Referenced by positionCloses().
|
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 Vector3(), std::swap(), x, y, and z.
|
static |
Referenced by primaryAxis().
|
static |
Referenced by primaryAxis().
|
static |
|
static |
|
static |
Referenced by getRotationTo(), perpendicular(), primaryAxis(), and Ogre::v1::BillboardChain::setFaceCamera().
|
static |
|
static |
Referenced by primaryAxis().
Real Ogre::Vector3::x |
Referenced by Vector3(), Vector3(), Vector3(), Vector3(), Vector3(), absDotProduct(), collapseMax(), collapseMin(), Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), Ogre::ColourValue::fromVector3(), Ogre::ArrayAabb::getAsAabb(), Ogre::ArrayVector3::getAsVector3(), Ogre::Volume::OctreeNode::getChildrenDimensions(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderLeft(), Ogre::Volume::OctreeNode::isBorderRight(), isNaN(), isZeroLength(), length(), makeAbs(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), normalise(), operator!=(), Ogre::Matrix4::operator*(), Ogre::Matrix4::operator*(), operator*(), operator*, operator*(), operator*=(), operator*=(), operator+, operator+, operator+(), operator+=(), operator+=(), operator-(), operator-, operator-, operator-(), operator-=(), operator-=(), operator/(), operator/, operator/(), operator/=(), operator/=(), operator<(), operator=(), Ogre::Vector4::operator=(), operator==(), operator>(), operator[](), operator[](), positionEquals(), primaryAxis(), ptr(), ptr(), Ogre::ArraySphere::setAll(), Ogre::ArrayVector3::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::ArrayVector3::setFromVector3(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), Ogre::AxisAlignedBox::squaredDistance(), squaredLength(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::AxisAlignedBox::transformAffine(), Ogre::Matrix4::transformAffine(), Ogre::Matrix4::transformDirectionAffine(), Ogre::AxisAlignedBox::volume(), and xy().
Real Ogre::Vector3::y |
Referenced by Vector3(), Vector3(), Vector3(), Vector3(), Vector3(), absDotProduct(), collapseMax(), collapseMin(), Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), Ogre::ColourValue::fromVector3(), Ogre::ArrayAabb::getAsAabb(), Ogre::ArrayVector3::getAsVector3(), Ogre::Volume::OctreeNode::getChildrenDimensions(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderBottom(), Ogre::Volume::OctreeNode::isBorderTop(), isNaN(), isZeroLength(), length(), makeAbs(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), normalise(), operator!=(), Ogre::Matrix4::operator*(), Ogre::Matrix4::operator*(), operator*(), operator*, operator*(), operator*=(), operator*=(), operator+, operator+, operator+(), operator+=(), operator+=(), operator-(), operator-, operator-, operator-(), operator-=(), operator-=(), operator/(), operator/, operator/(), operator/=(), operator/=(), operator<(), operator=(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), primaryAxis(), Ogre::ArraySphere::setAll(), Ogre::ArrayVector3::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::ArrayVector3::setFromVector3(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), Ogre::AxisAlignedBox::squaredDistance(), squaredLength(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::AxisAlignedBox::transformAffine(), Ogre::Matrix4::transformAffine(), Ogre::Matrix4::transformDirectionAffine(), Ogre::AxisAlignedBox::volume(), and xy().
Real Ogre::Vector3::z |
Referenced by Vector3(), Vector3(), Vector3(), Vector3(), Vector3(), absDotProduct(), collapseMax(), collapseMin(), Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), Ogre::ColourValue::fromVector3(), Ogre::ArrayAabb::getAsAabb(), Ogre::ArrayVector3::getAsVector3(), Ogre::Volume::OctreeNode::getChildrenDimensions(), getRotationTo(), Ogre::Matrix4::getScale(), Ogre::Matrix4::getTrans(), Ogre::AxisAlignedBox::intersection(), Ogre::AxisAlignedBox::intersects(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderBack(), Ogre::Volume::OctreeNode::isBorderFront(), isNaN(), isZeroLength(), length(), makeAbs(), makeCeil(), makeFloor(), Ogre::Matrix4::makeTrans(), midPoint(), normalise(), operator!=(), Ogre::Matrix4::operator*(), Ogre::Matrix4::operator*(), operator*(), operator*, operator*(), operator*=(), operator*=(), operator+, operator+, operator+(), operator+=(), operator+=(), operator-(), operator-, operator-, operator-(), operator-=(), operator-=(), operator/(), operator/, operator/(), operator/=(), operator/=(), operator<(), operator=(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), primaryAxis(), Ogre::ArraySphere::setAll(), Ogre::ArrayVector3::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::ArrayVector3::setFromVector3(), Ogre::Matrix4::setScale(), Ogre::Matrix4::setTrans(), Ogre::AxisAlignedBox::squaredDistance(), squaredLength(), swap(), Ogre::AxisAlignedBox::transform(), Ogre::AxisAlignedBox::transformAffine(), Ogre::Matrix4::transformAffine(), Ogre::Matrix4::transformDirectionAffine(), and Ogre::AxisAlignedBox::volume().
|
static |
Referenced by Ogre::Volume::OctreeNode::OctreeNode(), Ogre::Node::createChild(), Ogre::v1::OldBone::createChild(), Ogre::v1::OldNode::createChild(), Ogre::v1::OldNode::createChild(), Ogre::SceneNode::createChildSceneNode(), Ogre::TagPoint::createChildTagPoint(), Ogre::v1::OldSkeletonInstance::createTagPointOnBone(), Ogre::AxisAlignedBox::getHalfSize(), getRotationTo(), Ogre::AxisAlignedBox::getSize(), Ogre::StringConverter::parseVector3(), randomDeviant(), Ogre::Camera::setAutoTracking(), and Ogre::SceneNode::setAutoTracking().