OGRE
1.10.12
Object-Oriented Graphics Rendering Engine
|
Standard 3-dimensional vector. More...
#include <OgreVector3.h>
Public Member Functions | |
Vector3 () | |
Default constructor. More... | |
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) | |
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... | |
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 (void) const |
Returns true if this vector is zero length. More... | |
Real | length () const |
Returns the length (magnitude) of the vector. 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 (void) 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) |
Vector3 | operator+ (const Vector3 &rkVector) const |
const Vector3 & | operator+ () const |
Vector3 & | operator+= (const Vector3 &rkVector) |
Vector3 & | operator+= (const Real fScalar) |
Vector3 | operator- (const Vector3 &rkVector) const |
Vector3 | operator- () const |
Vector3 & | operator-= (const Vector3 &rkVector) |
Vector3 & | operator-= (const Real fScalar) |
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 Vector3 &rkVector) |
Assigns the value of the other vector. 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) const |
Real & | operator[] (const size_t i) |
Vector3 | perpendicular (void) 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=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 |
Friends | |
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) |
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. More... | |
Standard 3-dimensional vector.
|
inline |
Default constructor.
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
Swizzle-like narrowing operations.
|
inline |
Exchange the contents of this vector with another.
References std::swap(), x, y, and z.
|
inline |
|
inline |
|
inline |
Pointer accessor for direct copying.
|
inline |
Pointer accessor for direct copying.
|
inline |
|
inline |
|
inline |
Returns the length (magnitude) of the vector.
References Ogre::Math::Sqrt().
Referenced by angleBetween().
|
inline |
Returns the square of the length(magnitude) of the vector.
Referenced by getRotationTo(), Ogre::Sphere::merge(), positionCloses(), and Ogre::AxisAlignedBox::squaredDistance().
Returns the distance to another vector.
Returns the square of 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). |
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.
|
inline |
Normalises the vector.
References Ogre::Math::Sqrt().
Referenced by normalisedCopy(), and Ogre::Matrix4::operator*().
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. |
|
inline |
|
inline |
|
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 |
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 |
Generates a vector perpendicular to this vector (eg an 'up' vector).
References Ogre::Math::Abs(), and normalisedCopy().
|
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.
Gets the angle between 2 vectors.
References Ogre::Math::ACos(), Ogre::Math::Clamp(), and length().
|
inline |
Gets the shortest arc quaternion to rotate this vector to the destination vector.
References Ogre::Math::Abs(), Ogre::Quaternion::normalise(), Ogre::Math::Sqrt(), squaredLength(), x, y, z, and ZERO.
|
inline |
Returns true if this vector is zero length.
|
inline |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy.
References normalise().
Referenced by perpendicular().
Calculates a reflection vector to the plane with the given normal .
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.
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().
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().
|
inline |
Check whether this vector contains valid values.
References Ogre::Math::isNaN().
|
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.
|
friend |
Function for writing to a stream.
Real Ogre::Vector3::x |
Referenced by absDotProduct(), Ogre::AxisAlignedBox::contains(), crossProduct(), dotProduct(), 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(), 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<(), operator=(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), Ogre::AxisAlignedBox::setExtents(), 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::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(), 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<(), operator=(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), Ogre::AxisAlignedBox::setExtents(), 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::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(), 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<(), operator=(), Ogre::Vector4::operator=(), operator==(), operator>(), positionEquals(), Ogre::AxisAlignedBox::setExtents(), 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::InstancedEntity::_getDerivedPosition(), Ogre::Camera::Listener::cameraDestroyed(), Ogre::Volume::OctreeNode::getChildrenDimensions(), Ogre::Entity::getCurrentLodIndex(), Ogre::AxisAlignedBox::getHalfSize(), Ogre::Node::getInheritScale(), getRotationTo(), Ogre::SceneNode::getShowBoundingBox(), Ogre::AxisAlignedBox::getSize(), Ogre::TangentSpaceCalc::getSplitRotated(), Ogre::StringConverter::parseAngle(), and randomDeviant().
|
static |
Referenced by Ogre::BillboardChain::getDynamic(), and primaryAxis().
|
static |
Referenced by Ogre::Camera::Listener::cameraDestroyed(), Ogre::SceneNode::getShowBoundingBox(), and primaryAxis().
|
static |
Referenced by primaryAxis(), and Ogre::PortalBase::setDirection().
|
static |
Referenced by primaryAxis().
|
static |
Referenced by primaryAxis().
|
static |
Referenced by Ogre::SceneNode::getShowBoundingBox(), primaryAxis(), and Ogre::PortalBase::setDirection().
|
static |
Referenced by Ogre::StaticGeometry::getName(), and Ogre::InstancedGeometry::getName().