Standard 2-dimensional vector. More...
#include <OgreVector2.h>
Public Member Functions | |
Vector2 () | |
Default constructor. More... | |
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) | |
Ogre::Radian | angleBetween (const Ogre::Vector2 &other) const |
Gets the angle between 2 vectors. More... | |
Ogre::Radian | angleTo (const Ogre::Vector2 &other) const |
Gets the oriented angle between 2 vectors. More... | |
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. More... | |
Real | distance (const Vector2 &rhs) const |
Returns the distance to another vector. More... | |
Real | dotProduct (const Vector2 &vec) const |
Calculates the dot (scalar) product of this vector with another. 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 Vector2 &cmp) |
Sets this vector's components to the maximum of its own and the ones of the passed in vector. More... | |
void | makeFloor (const Vector2 &cmp) |
Sets this vector's components to the minimum of its own and the ones of the passed in vector. More... | |
Vector2 | midPoint (const Vector2 &vec) const |
Returns a vector at a point half way between this and the passed in vector. More... | |
Real | normalise () |
Normalises the vector. More... | |
Vector2 | normalisedCopy (void) const |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy. More... | |
bool | operator!= (const Vector2 &rkVector) const |
Vector2 | operator* (const Real fScalar) const |
Vector2 | operator* (const Vector2 &rhs) const |
Vector2 & | operator*= (const Real fScalar) |
Vector2 & | operator*= (const Vector2 &rkVector) |
Vector2 | operator+ (const Vector2 &rkVector) const |
const Vector2 & | operator+ () const |
Vector2 & | operator+= (const Vector2 &rkVector) |
Vector2 & | operator+= (const Real fScaler) |
Vector2 | operator- (const Vector2 &rkVector) const |
Vector2 | operator- () const |
Vector2 & | operator-= (const Vector2 &rkVector) |
Vector2 & | operator-= (const Real fScaler) |
Vector2 | operator/ (const Real fScalar) const |
Vector2 | operator/ (const Vector2 &rhs) const |
Vector2 & | operator/= (const Real fScalar) |
Vector2 & | operator/= (const Vector2 &rkVector) |
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. More... | |
Vector2 & | operator= (const Vector2 &rkVector) |
Assigns the value of the other vector. More... | |
Vector2 & | operator= (const Real fScalar) |
bool | operator== (const Vector2 &rkVector) const |
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. More... | |
Real | operator[] (const size_t i) const |
Real & | operator[] (const size_t i) |
Vector2 | perpendicular (void) const |
Generates a vector perpendicular to this vector (eg an 'up' vector). More... | |
Real * | ptr () |
Pointer accessor for direct copying. More... | |
const Real * | ptr () const |
Pointer accessor for direct copying. More... | |
Vector2 | randomDeviant (Radian angle) const |
Generates a new random vector which deviates from this vector by a given angle in a random direction. More... | |
Vector2 | reflect (const Vector2 &normal) const |
Calculates a reflection vector to the plane with the given normal . More... | |
Real | squaredDistance (const Vector2 &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 (Vector2 &other) |
Exchange the contents of this vector with another. More... | |
Public Attributes | |
Real | x |
Real | y |
Static Public Attributes | |
static const Vector2 | NEGATIVE_UNIT_X |
static const Vector2 | NEGATIVE_UNIT_Y |
static const Vector2 | UNIT_SCALE |
static const Vector2 | UNIT_X |
static const Vector2 | UNIT_Y |
static const Vector2 | ZERO |
Friends | |
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) |
Vector2 | operator/ (const Real fScalar, const Vector2 &rkVector) |
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const Vector2 &v) |
Function for writing to a stream. More... | |
Standard 2-dimensional vector.
Definition at line 51 of file OgreVector2.h.
|
inline |
Default constructor.
Definition at line 61 of file OgreVector2.h.
Definition at line 65 of file OgreVector2.h.
|
inlineexplicit |
Definition at line 70 of file OgreVector2.h.
|
inlineexplicit |
Definition at line 75 of file OgreVector2.h.
|
inlineexplicit |
Definition at line 81 of file OgreVector2.h.
|
inlineexplicit |
Definition at line 87 of file OgreVector2.h.
|
inline |
Gets the angle between 2 vectors.
Definition at line 556 of file OgreVector2.h.
References Ogre::Math::ACos(), Ogre::Math::Clamp(), and length().
|
inline |
Gets the oriented angle between 2 vectors.
Definition at line 574 of file OgreVector2.h.
References Ogre::Math::TWO_PI.
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 495 of file OgreVector2.h.
Returns the distance to another vector.
Definition at line 358 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 392 of file OgreVector2.h.
|
inline |
Check whether this vector contains valid values.
Definition at line 547 of file OgreVector2.h.
References Ogre::Math::isNaN().
|
inline |
Returns true if this vector is zero length.
Definition at line 522 of file OgreVector2.h.
|
inline |
Returns the length (magnitude) of the vector.
Definition at line 331 of file OgreVector2.h.
References Ogre::Math::Sqrt().
Referenced by angleBetween().
|
inline |
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
Definition at line 474 of file OgreVector2.h.
|
inline |
Sets this vector's components to the minimum of its own and the ones of the passed in vector.
Definition at line 461 of file OgreVector2.h.
Returns a vector at a point half way between this and the passed in vector.
Definition at line 427 of file OgreVector2.h.
|
inline |
Normalises the vector.
Definition at line 407 of file OgreVector2.h.
References Ogre::Math::Sqrt().
Referenced by normalisedCopy().
|
inline |
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().
|
inline |
Definition at line 150 of file OgreVector2.h.
Definition at line 170 of file OgreVector2.h.
Definition at line 177 of file OgreVector2.h.
Definition at line 288 of file OgreVector2.h.
Definition at line 296 of file OgreVector2.h.
Definition at line 156 of file OgreVector2.h.
|
inline |
Definition at line 202 of file OgreVector2.h.
Definition at line 256 of file OgreVector2.h.
Definition at line 264 of file OgreVector2.h.
Definition at line 163 of file OgreVector2.h.
|
inline |
Definition at line 207 of file OgreVector2.h.
Definition at line 272 of file OgreVector2.h.
Definition at line 280 of file OgreVector2.h.
Definition at line 184 of file OgreVector2.h.
Definition at line 195 of file OgreVector2.h.
Definition at line 304 of file OgreVector2.h.
Definition at line 316 of file OgreVector2.h.
|
inline |
Returns true if the vector's scalar components are all greater that the ones of the vector it is compared against.
Definition at line 437 of file OgreVector2.h.
Assigns the value of the other vector.
rkVector | The other vector |
Definition at line 129 of file OgreVector2.h.
Definition at line 137 of file OgreVector2.h.
|
inline |
Definition at line 145 of file OgreVector2.h.
|
inline |
Returns true if the vector's scalar components are all smaller that the ones of the vector it is compared against.
Definition at line 447 of file OgreVector2.h.
|
inline |
Definition at line 100 of file OgreVector2.h.
|
inline |
Definition at line 107 of file OgreVector2.h.
|
inline |
Generates a vector perpendicular to this vector (eg an 'up' vector).
Definition at line 487 of file OgreVector2.h.
|
inline |
Pointer accessor for direct copying.
Definition at line 115 of file OgreVector2.h.
Referenced by Ogre::AnimableValue::setAsBaseValue(), and Ogre::RTShader::UniformParameter::setGpuParameter().
|
inline |
Pointer accessor for direct copying.
Definition at line 120 of file OgreVector2.h.
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 |
Definition at line 512 of file OgreVector2.h.
References Ogre::Math::Cos(), Ogre::Math::RangeRandom(), and Ogre::Math::Sin().
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 373 of file OgreVector2.h.
|
inline |
Returns the square of the length(magnitude) of the vector.
Definition at line 346 of file OgreVector2.h.
|
inline |
Exchange the contents of this vector with another.
Definition at line 94 of file OgreVector2.h.
References std::swap(), x, and y.
Definition at line 213 of file OgreVector2.h.
Definition at line 227 of file OgreVector2.h.
Definition at line 234 of file OgreVector2.h.
Definition at line 241 of file OgreVector2.h.
Definition at line 248 of file OgreVector2.h.
Definition at line 220 of file OgreVector2.h.
|
friend |
Function for writing to a stream.
Definition at line 595 of file OgreVector2.h.
|
static |
Definition at line 588 of file OgreVector2.h.
|
static |
Definition at line 589 of file OgreVector2.h.
|
static |
Definition at line 590 of file OgreVector2.h.
|
static |
Definition at line 586 of file OgreVector2.h.
|
static |
Definition at line 587 of file OgreVector2.h.
Real Ogre::Vector2::x |
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().
Real Ogre::Vector2::y |
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().
|
static |
Definition at line 585 of file OgreVector2.h.