OGRE 2.1
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. | |
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 (void) 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 (void) 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) |
Vector3 & | operator= (const Vector3 &rkVector) |
Assigns the value of the other vector. | |
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 (void) 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=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 |
Friends | |
Vector3 | operator* (const Real fScalar, const Vector3 &rkVector) |
Vector3 | operator+ (const Real lhs, const Vector3 &rhs) |
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 fScalar, const Vector3 &rkVector) |
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const Vector3 &v) |
Function for writing to a stream. | |
Standard 3-dimensional vector.
|
inline |
Default constructor.
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().
Gets the angle between 2 vectors.
References Ogre::Math::ACos(), and Ogre::Math::Clamp().
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. |
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(), and Ogre::Math::ACos().
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). |
|
inline |
Gets the shortest arc quaternion to rotate this vector to the destination vector.
References Ogre::Quaternion::FromAngleAxis(), Ogre::Quaternion::IDENTITY, normalise(), Ogre::Quaternion::normalise(), Ogre::Math::PI, Ogre::Math::Sqrt(), UNIT_X, UNIT_Y, Ogre::Quaternion::w, Ogre::Quaternion::x, Ogre::Quaternion::y, Ogre::Quaternion::z, and ZERO.
|
inline |
Check whether this vector contains valid values.
References Ogre::Math::isNaN().
|
inline |
Returns the length (magnitude) of the vector.
References Ogre::Math::Sqrt().
|
inline |
Causes negative members to become positive.
References Ogre::Math::Abs().
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
References Ogre::max().
Referenced by Ogre::AxisAlignedBox::merge().
Sets this vector's components to the minimum of its own and the ones of the passed in vector.
References Ogre::min().
Referenced by Ogre::AxisAlignedBox::merge().
Returns a vector at a point half way between this and the passed in vector.
|
inline |
Normalises the vector.
References Ogre::Math::Sqrt().
Referenced by getRotationTo().
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy.
|
inline |
Returns true if the vector's scalar components are all greater that the ones of the vector it is compared against.
Assigns the value of the other vector.
rkVector | The other vector |
Returns true if the vector's scalar components are all smaller that the ones of the vector it is compared against.
Generates a vector perpendicular to this vector (eg an 'up' vector).
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 |
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().
|
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 |
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.
Exchange the contents of this vector with another.
References std::swap(), x, y, and z.
|
inline |
Swizzle-like narrowing operations.
|
friend |
Function for writing to a stream.
Referenced by primaryAxis().
Referenced by primaryAxis().
Referenced by primaryAxis().
Referenced by getRotationTo(), perpendicular(), and primaryAxis().
Referenced by getRotationTo(), perpendicular(), and primaryAxis().
Referenced by primaryAxis().
Real Ogre::Vector3::x |
Referenced by Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::getAllCorners(), 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(), Ogre::AxisAlignedBox::intersects(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderLeft(), Ogre::Volume::OctreeNode::isBorderRight(), Ogre::Matrix4::operator*(), Ogre::Plane::operator-(), Ogre::ArraySphere::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMaximumX(), Ogre::AxisAlignedBox::setMinimum(), Ogre::AxisAlignedBox::setMinimumX(), Ogre::AxisAlignedBox::squaredDistance(), and swap().
Real Ogre::Vector3::y |
Referenced by Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::getAllCorners(), 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(), Ogre::AxisAlignedBox::intersects(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderBottom(), Ogre::Volume::OctreeNode::isBorderTop(), Ogre::Matrix4::operator*(), Ogre::Plane::operator-(), Ogre::ArraySphere::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMaximumY(), Ogre::AxisAlignedBox::setMinimum(), Ogre::AxisAlignedBox::setMinimumY(), Ogre::AxisAlignedBox::squaredDistance(), and swap().
Real Ogre::Vector3::z |
Referenced by Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::contains(), Ogre::AxisAlignedBox::getAllCorners(), 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(), Ogre::AxisAlignedBox::intersects(), Ogre::AxisAlignedBox::intersects(), Ogre::Volume::OctreeNode::isBorderBack(), Ogre::Volume::OctreeNode::isBorderFront(), Ogre::Matrix4::operator*(), Ogre::Plane::operator-(), Ogre::ArraySphere::setAll(), Ogre::AxisAlignedBox::setExtents(), Ogre::ArrayAabb::setFromAabb(), Ogre::AxisAlignedBox::setMaximum(), Ogre::AxisAlignedBox::setMaximumZ(), Ogre::AxisAlignedBox::setMinimum(), Ogre::AxisAlignedBox::setMinimumZ(), Ogre::AxisAlignedBox::squaredDistance(), and swap().
Referenced by Ogre::AxisAlignedBox::getHalfSize(), getRotationTo(), Ogre::AxisAlignedBox::getSize(), and randomDeviant().