Standard 2-dimensional vector. More...
#include <OgreVector2.h>
Public Member Functions | |
Vector2 () | |
Vector2 (const Real fX, const Real fY) | |
Vector2 (const Real scaler) | |
Vector2 (const Real afCoordinate[2]) | |
Vector2 (const int afCoordinate[2]) | |
Vector2 (Real *const r) | |
void | swap (Vector2 &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. | |
Vector2 & | operator= (const Vector2 &rkVector) |
Assigns the value of the other vector. | |
Vector2 & | operator= (const Real fScalar) |
bool | operator== (const Vector2 &rkVector) const |
bool | operator!= (const Vector2 &rkVector) const |
Vector2 | operator+ (const Vector2 &rkVector) const |
Vector2 | operator- (const Vector2 &rkVector) const |
Vector2 | operator* (const Real fScalar) const |
Vector2 | operator* (const Vector2 &rhs) const |
Vector2 | operator/ (const Real fScalar) const |
Vector2 | operator/ (const Vector2 &rhs) const |
const Vector2 & | operator+ () const |
Vector2 | operator- () const |
Vector2 & | operator+= (const Vector2 &rkVector) |
Vector2 & | operator+= (const Real fScaler) |
Vector2 & | operator-= (const Vector2 &rkVector) |
Vector2 & | operator-= (const Real fScaler) |
Vector2 & | operator*= (const Real fScalar) |
Vector2 & | operator*= (const Vector2 &rkVector) |
Vector2 & | operator/= (const Real fScalar) |
Vector2 & | operator/= (const Vector2 &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 Vector2 &rhs) const |
Returns the distance to another vector. | |
Real | squaredDistance (const Vector2 &rhs) const |
Returns the square of the distance to another vector. | |
Real | dotProduct (const Vector2 &vec) const |
Calculates the dot (scalar) product of this vector with another. | |
Real | normalise () |
Normalises the vector. | |
Vector2 | midPoint (const Vector2 &vec) const |
Returns a vector at a point half way between this and the passed in vector. | |
bool | operator< (const Vector2 &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 Vector2 &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 Vector2 &cmp) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector. | |
void | makeCeil (const Vector2 &cmp) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector. | |
Vector2 | perpendicular (void) const |
Generates a vector perpendicular to this vector (eg an 'up' vector). | |
Real | crossProduct (const Vector2 &rkVector) const |
Calculates the 2 dimensional cross-product of 2 vectors, which results in a single floating point value which is 2 times the area of the triangle. | |
Vector2 | randomDeviant (Real angle) const |
Generates a new random vector which deviates from this vector by a given angle in a random direction. | |
bool | isZeroLength (void) const |
Returns true if this vector is zero length. | |
Vector2 | normalisedCopy (void) const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy. | |
Vector2 | reflect (const Vector2 &normal) const |
Calculates a reflection vector to the plane with the given normal . | |
bool | isNaN () const |
Check whether this vector contains valid values. | |
Public Attributes | |
Real | x |
Real | y |
Static Public Attributes | |
static const Vector2 | ZERO |
static const Vector2 | UNIT_X |
static const Vector2 | UNIT_Y |
static const Vector2 | NEGATIVE_UNIT_X |
static const Vector2 | NEGATIVE_UNIT_Y |
static const Vector2 | UNIT_SCALE |
Friends | |
Vector2 | operator* (const Real fScalar, const Vector2 &rkVector) |
Vector2 | operator/ (const Real fScalar, const Vector2 &rkVector) |
Vector2 | operator+ (const Vector2 &lhs, const Real rhs) |
Vector2 | operator+ (const Real lhs, const Vector2 &rhs) |
Vector2 | operator- (const Vector2 &lhs, const Real rhs) |
Vector2 | operator- (const Real lhs, const Vector2 &rhs) |
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const Vector2 &v) |
Function for writing to a stream. |
Standard 2-dimensional vector.
Definition at line 51 of file OgreVector2.h.
Ogre::Vector2::Vector2 | ( | ) |
Definition at line 57 of file OgreVector2.h.
Definition at line 61 of file OgreVector2.h.
Ogre::Vector2::Vector2 | ( | const Real | scaler | ) | [explicit] |
Definition at line 66 of file OgreVector2.h.
Ogre::Vector2::Vector2 | ( | const Real | afCoordinate[2] | ) | [explicit] |
Definition at line 71 of file OgreVector2.h.
Ogre::Vector2::Vector2 | ( | const int | afCoordinate[2] | ) | [explicit] |
Definition at line 77 of file OgreVector2.h.
Ogre::Vector2::Vector2 | ( | Real *const | r | ) | [explicit] |
Definition at line 83 of file OgreVector2.h.
Calculates the 2 dimensional cross-product of 2 vectors, which results in a single floating point value which is 2 times the area of the triangle.
Definition at line 487 of file OgreVector2.h.
Returns the distance to another vector.
Definition at line 352 of file OgreVector2.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 386 of file OgreVector2.h.
bool Ogre::Vector2::isNaN | ( | ) | const |
Check whether this vector contains valid values.
Definition at line 546 of file OgreVector2.h.
References Ogre::Math::isNaN().
bool Ogre::Vector2::isZeroLength | ( | void | ) | const |
Returns true if this vector is zero length.
Definition at line 522 of file OgreVector2.h.
Real Ogre::Vector2::length | ( | ) | const |
Returns the length (magnitude) of the vector.
Definition at line 326 of file OgreVector2.h.
References Ogre::Math::Sqrt().
void Ogre::Vector2::makeCeil | ( | const Vector2 & | cmp | ) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
Definition at line 467 of file OgreVector2.h.
void Ogre::Vector2::makeFloor | ( | const Vector2 & | cmp | ) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector.
Definition at line 454 of file OgreVector2.h.
Returns a vector at a point half way between this and the passed in vector.
Definition at line 420 of file OgreVector2.h.
Real Ogre::Vector2::normalise | ( | ) |
Normalises the vector.
Definition at line 400 of file OgreVector2.h.
References Ogre::Math::Sqrt().
Referenced by normalisedCopy().
Vector2 Ogre::Vector2::normalisedCopy | ( | void | ) | const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy.
Definition at line 531 of file OgreVector2.h.
References normalise().
bool Ogre::Vector2::operator!= | ( | const Vector2 & | rkVector | ) | const |
Definition at line 146 of file OgreVector2.h.
Definition at line 166 of file OgreVector2.h.
Definition at line 173 of file OgreVector2.h.
Definition at line 283 of file OgreVector2.h.
Definition at line 291 of file OgreVector2.h.
const Vector2& Ogre::Vector2::operator+ | ( | ) | const |
Definition at line 198 of file OgreVector2.h.
Definition at line 152 of file OgreVector2.h.
Definition at line 251 of file OgreVector2.h.
Definition at line 259 of file OgreVector2.h.
Vector2 Ogre::Vector2::operator- | ( | ) | const |
Definition at line 203 of file OgreVector2.h.
Definition at line 159 of file OgreVector2.h.
Definition at line 267 of file OgreVector2.h.
Definition at line 275 of file OgreVector2.h.
Definition at line 180 of file OgreVector2.h.
Definition at line 191 of file OgreVector2.h.
Definition at line 299 of file OgreVector2.h.
Definition at line 311 of file OgreVector2.h.
bool Ogre::Vector2::operator< | ( | const Vector2 & | 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 430 of file OgreVector2.h.
Assigns the value of the other vector.
rkVector | The other vector |
Definition at line 125 of file OgreVector2.h.
Definition at line 133 of file OgreVector2.h.
bool Ogre::Vector2::operator== | ( | const Vector2 & | rkVector | ) | const |
Definition at line 141 of file OgreVector2.h.
bool Ogre::Vector2::operator> | ( | const Vector2 & | 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 440 of file OgreVector2.h.
Real& Ogre::Vector2::operator[] | ( | const size_t | i | ) |
Definition at line 103 of file OgreVector2.h.
Real Ogre::Vector2::operator[] | ( | const size_t | i | ) | const |
Definition at line 96 of file OgreVector2.h.
Vector2 Ogre::Vector2::perpendicular | ( | void | ) | const |
Generates a vector perpendicular to this vector (eg an 'up' vector).
Definition at line 480 of file OgreVector2.h.
const Real* Ogre::Vector2::ptr | ( | ) | const |
Pointer accessor for direct copying.
Definition at line 116 of file OgreVector2.h.
Real* Ogre::Vector2::ptr | ( | ) |
Pointer accessor for direct copying.
Definition at line 111 of file OgreVector2.h.
Referenced by Ogre::AnimableValue::setAsBaseValue(), and Ogre::RTShader::UniformParameter::setGpuParameter().
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 in radians |
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 510 of file OgreVector2.h.
References Ogre::Math::TWO_PI, and Ogre::Math::UnitRandom().
Calculates a reflection vector to the plane with the given normal .
Definition at line 541 of file OgreVector2.h.
Returns the square of the distance to another vector.
Definition at line 367 of file OgreVector2.h.
Real Ogre::Vector2::squaredLength | ( | ) | const |
Returns the square of the length(magnitude) of the vector.
Definition at line 341 of file OgreVector2.h.
void Ogre::Vector2::swap | ( | Vector2 & | other | ) |
Exchange the contents of this vector with another.
Definition at line 90 of file OgreVector2.h.
Definition at line 209 of file OgreVector2.h.
Definition at line 230 of file OgreVector2.h.
Definition at line 223 of file OgreVector2.h.
Definition at line 237 of file OgreVector2.h.
Definition at line 244 of file OgreVector2.h.
Definition at line 216 of file OgreVector2.h.
_OgreExport friend std::ostream& operator<< | ( | std::ostream & | o, |
const Vector2 & | v | ||
) | [friend] |
Function for writing to a stream.
Definition at line 562 of file OgreVector2.h.
const Vector2 Ogre::Vector2::NEGATIVE_UNIT_X [static] |
Definition at line 555 of file OgreVector2.h.
const Vector2 Ogre::Vector2::NEGATIVE_UNIT_Y [static] |
Definition at line 556 of file OgreVector2.h.
const Vector2 Ogre::Vector2::UNIT_SCALE [static] |
Definition at line 557 of file OgreVector2.h.
const Vector2 Ogre::Vector2::UNIT_X [static] |
Definition at line 553 of file OgreVector2.h.
const Vector2 Ogre::Vector2::UNIT_Y [static] |
Definition at line 554 of file OgreVector2.h.
Definition at line 54 of file OgreVector2.h.
Referenced by crossProduct(), dotProduct(), makeCeil(), makeFloor(), midPoint(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator=(), operator==(), operator>(), and swap().
Definition at line 54 of file OgreVector2.h.
Referenced by crossProduct(), dotProduct(), makeCeil(), makeFloor(), midPoint(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator=(), operator==(), operator>(), and swap().
const Vector2 Ogre::Vector2::ZERO [static] |
Definition at line 552 of file OgreVector2.h.
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:56