Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Mezzanine::Vector2 Class Reference

This is used to represent a point on a 2 dimentional area, such as a screen. More...

#include <vector2.h>

Public Member Functions

 Vector2 ()
 Default Constructor.
 
 Vector2 (const Real &xy)
 Single Real value Constructor. More...
 
 Vector2 (const Real &x, const Real &y)
 Real value Constructor. More...
 
 Vector2 (const Ogre::Vector2 &Vec)
 Ogre Value Constructor. More...
 
Real AngleBetween (const Vector2 &Other) const
 Gets the angle between this Vector2 and another. More...
 
Real AngleTo (const Vector2 &Other) const
 Gets an oriented angle between this Vector2 and another Vector2. More...
 
Real CrossProduct (const Vector2 &Other) const
 This is used to calculate the crossproduct of this and another vector. More...
 
Real Distance (const Vector2 &Other) const
 Gets the distance between this and another vector. More...
 
Real DotProduct (const Vector2 &Other) const
 This is used to calculate the dotproduct of this and another vector. More...
 
void ExtractOgreVector2 (const Ogre::Vector2 &Thiers)
 Copies an existing Ogre vector2. More...
 
Vector2 GetNormal () const
 Gets the normal of this Vector2. More...
 
Ogre::Vector2 GetOgreVector2 () const
 Gets a Ogre vector2. More...
 
Boole IsZero () const
 Checks to see if the values of this vector are all zero. More...
 
Real Length () const
 Gets the length of this vector. More...
 
Vector2Normalize ()
 Normalizes this Vector2. More...
 
Boole operator!= (const Mezzanine::Vector2 &Vec2) const
 Equality Comparison Operator. More...
 
Boole operator!= (const Ogre::Vector2 &Vec2) const
 Equality Comparison Operator. More...
 
Vector2 operator* (const Real &scalar) const
 Scaling by multiplication. More...
 
Vector2 operator* (const Vector2 &Vec2) const
 Multiplaction Operator. More...
 
Vector2operator*= (const Real &scalar)
 Scaling by multiplication. More...
 
Vector2operator*= (const Vector2 &Vec2)
 Multiplaction assignment Operator. More...
 
Vector2 operator+ (const Vector2 &Vec2) const
 Addition Operator. More...
 
Vector2operator+= (const Vector2 &Vec2)
 Addition assignment Operator. More...
 
Vector2 operator- ()
 Unary Operator. More...
 
Vector2 operator- (const Vector2 &Vec2) const
 Subraction Operator. More...
 
Vector2operator-= (const Vector2 &Vec2)
 Subraction assignment Operator. More...
 
Vector2 operator/ (const Real &scalar) const
 Scaling by Division. More...
 
Vector2 operator/ (const Vector2 &Vec2) const
 Division Operator. More...
 
Vector2operator/= (const Real &scalar)
 Scaling by Division. More...
 
Vector2operator/= (const Vector2 &Vec2)
 Division assignment Operator. More...
 
Boole operator<= (const Mezzanine::Vector2 &Vec) const
 Less or Equal Comparison Operator. More...
 
Boole operator== (const Mezzanine::Vector2 &Vec2) const
 Equality Comparison Operator. More...
 
Boole operator== (const Ogre::Vector2 &Vec2) const
 Equality Comparison Operator. More...
 
Boole operator>= (const Mezzanine::Vector2 &Vec) const
 Greater than or Equal Comparison Operator. More...
 
Vector2 Perpendicular () const
 Generates a Vector2 that is perpendicular to this vector. More...
 
void ProtoDeSerialize (const XML::Node &OneNode)
 Take the data stored in an XML and overwrite this instance of this object with it. More...
 
void ProtoSerialize (XML::Node &CurrentRoot) const
 Convert this class to an XML::Node ready for serialization. More...
 
Vector2 Reflect (const Vector2 &Normal) const
 Gets a reflection vector to the line with the given normal. More...
 
void SetIdentity ()
 Sets the values of this vector2 to identity values(0,0).
 
void SetValues (const Real &x, const Real &y)
 Sets the X and Y values of this vector2. More...
 
Real SquaredDistance (const Vector2 &Other) const
 Gets the squared distance between this and another vector. More...
 
Real SquaredLength () const
 Gets the length of this vector squared. More...
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of the the XML tag this class will leave behind as its instances are serialized. More...
 
static Vector2 Neg_Unit_X ()
 Gets a vector representing the negative X unit of a Vector2. More...
 
static Vector2 Neg_Unit_Y ()
 Gets a vector representing the negative Y unit of a Vector2. More...
 
static Vector2 Unit_X ()
 Gets a vector representing the X unit of a Vector2. More...
 
static Vector2 Unit_Y ()
 Gets a vector representing the Y unit of a Vector2. More...
 

Public Attributes

Real X
 Coordinate on the X vector.
 
Real Y
 Coordinate on the Y vector.
 

Detailed Description

This is used to represent a point on a 2 dimentional area, such as a screen.

This contains an X and Y value used to represent coordinates. This also has a number of facilities to make converting to graphics subsystems as easy as possible.

Definition at line 63 of file vector2.h.

Constructor & Destructor Documentation

Mezzanine::Vector2::Vector2 ( const Real xy)
explicit

Single Real value Constructor.

Parameters
xyValue to set both x and y to.

Definition at line 58 of file vector2.cpp.

Mezzanine::Vector2::Vector2 ( const Real x,
const Real y 
)

Real value Constructor.

Parameters
xCoordinate on the X vector.
yCoordinate on the Y vector.

Definition at line 61 of file vector2.cpp.

Mezzanine::Vector2::Vector2 ( const Ogre::Vector2 &  Vec)

Ogre Value Constructor.

Parameters
VecThe vector to be copied to make this vector.

Definition at line 64 of file vector2.cpp.

Member Function Documentation

Real Mezzanine::Vector2::AngleBetween ( const Vector2 Other) const

Gets the angle between this Vector2 and another.

Note
This method assumes both Vector2s are axis vectors.
Parameters
OtherThe other Vector2 to compare with.
Returns
Returns the angle between both Vector2s in radians.

Definition at line 298 of file vector2.cpp.

Real Mezzanine::Vector2::AngleTo ( const Vector2 Other) const

Gets an oriented angle between this Vector2 and another Vector2.

Note
This method assumes both Vector2s are axis vectors.
Parameters
OtherThe other Vector2 to compare with.
Returns
Returns the angle between both Vector2s in radians in the range of 0pi-2pi.

Definition at line 288 of file vector2.cpp.

Real Mezzanine::Vector2::CrossProduct ( const Vector2 Other) const

This is used to calculate the crossproduct of this and another vector.

Parameters
Otherthe Vector to work with to create the cross product.
Returns
A Real containing crossproduct of this vector and Vec.

Definition at line 245 of file vector2.cpp.

Real Mezzanine::Vector2::Distance ( const Vector2 Other) const

Gets the distance between this and another vector.

Parameters
OtherThis is the other point to measure the distance to.
Returns
Returns a Real representing the distance.

Definition at line 251 of file vector2.cpp.

Real Mezzanine::Vector2::DotProduct ( const Vector2 Other) const

This is used to calculate the dotproduct of this and another vector.

Parameters
OtherThe vector to work with to create the cross product.
Returns
This is the dotproduct of this vector and vec.

Definition at line 248 of file vector2.cpp.

void Mezzanine::Vector2::ExtractOgreVector2 ( const Ogre::Vector2 &  Thiers)

Copies an existing Ogre vector2.

Parameters
ThiersThe vector2 to be extracted.

Definition at line 75 of file vector2.cpp.

Vector2 Mezzanine::Vector2::GetNormal ( ) const

Gets the normal of this Vector2.

Returns
Returns a new Vector2 that is a normalized copy of this Vector2.

Definition at line 282 of file vector2.cpp.

Ogre::Vector2 Mezzanine::Vector2::GetOgreVector2 ( ) const

Gets a Ogre vector2.

Returns
Returns an Ogre Vector2 with the same values as this.

Definition at line 67 of file vector2.cpp.

String Mezzanine::Vector2::GetSerializableName ( )
static

Get the name of the the XML tag this class will leave behind as its instances are serialized.

Returns
A string containing "Vector2"

Definition at line 351 of file vector2.cpp.

Boole Mezzanine::Vector2::IsZero ( ) const

Checks to see if the values of this vector are all zero.

Returns
Returns true if all components of this vector are zero, false otherwise.

Definition at line 111 of file vector2.cpp.

Real Mezzanine::Vector2::Length ( ) const

Gets the length of this vector.

Returns
Returns a real representing the length of this vector.

Definition at line 257 of file vector2.cpp.

Vector2 Mezzanine::Vector2::Neg_Unit_X ( )
static

Gets a vector representing the negative X unit of a Vector2.

Returns
A Vector2(-1,0).

Definition at line 90 of file vector2.cpp.

Vector2 Mezzanine::Vector2::Neg_Unit_Y ( )
static

Gets a vector representing the negative Y unit of a Vector2.

Returns
A Vector2(0,-1).

Definition at line 93 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::Normalize ( )

Normalizes this Vector2.

Returns
Returns a reference to this.

Definition at line 269 of file vector2.cpp.

Boole Mezzanine::Vector2::operator!= ( const Mezzanine::Vector2 Vec2) const

Equality Comparison Operator.

Parameters
Vec2This is the other Mezzanine::Vector2.
Returns
Returns true if X!=X or Y!=Y, otherwise returns false.

Definition at line 122 of file vector2.cpp.

Boole Mezzanine::Vector2::operator!= ( const Ogre::Vector2 &  Vec2) const

Equality Comparison Operator.

Parameters
Vec2This is the other Ogre::Vector2.
Returns
Returns true if X!=X or Y!=Y, otherwise returns false.

Definition at line 128 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator* ( const Real scalar) const

Scaling by multiplication.

Returns
This returns a Vector2 that has been scaled.
Parameters
scalarThis is the amount to scale the Vector2 by.

Definition at line 146 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator* ( const Vector2 Vec2) const

Multiplaction Operator.

Parameters
Vec2The other Vector2 to multiply by this.
Returns
Returns a new Vector2 that is the result of this operation.

Definition at line 198 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::operator*= ( const Real scalar)

Scaling by multiplication.

Parameters
scalarThis is the amount to scale the Vector2 by.
Returns
Returns a reference to this.

Definition at line 165 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::operator*= ( const Vector2 Vec2)

Multiplaction assignment Operator.

Parameters
Vec2The other Vector2 to multiply by this.
Returns
Returns a reference to this.

Definition at line 228 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator+ ( const Vector2 Vec2) const

Addition Operator.

Parameters
Vec2The other Vector2 to add to this.
Returns
Returns a new Vector2 that is the result of this operation.

Definition at line 182 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::operator+= ( const Vector2 Vec2)

Addition assignment Operator.

Parameters
Vec2The other Vector2 to add to this.
Returns
Returns a reference to this.

Definition at line 214 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator- ( )

Unary Operator.

Returns
Returns a copy of this Vector2 with the +/- signs on each value flipped.

Definition at line 140 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator- ( const Vector2 Vec2) const

Subraction Operator.

Parameters
Vec2The other Vector2 to subtract from this.
Returns
Returns a new Vector2 that is the result of this operation.

Definition at line 190 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::operator-= ( const Vector2 Vec2)

Subraction assignment Operator.

Parameters
Vec2The other Vector2 to subtract from this.
Returns
Returns a reference to this.

Definition at line 221 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator/ ( const Real scalar) const

Scaling by Division.

Returns
This returns a Vector2 that has been scaled.
Parameters
scalarThis is the amount to scale the Vector2 by.

Definition at line 154 of file vector2.cpp.

Vector2 Mezzanine::Vector2::operator/ ( const Vector2 Vec2) const

Division Operator.

Parameters
Vec2The other Vector2 to divide by.
Returns
Returns a new Vector2 that is the result of this operation.

Definition at line 206 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::operator/= ( const Real scalar)

Scaling by Division.

Parameters
scalarThis is the amount to scale the Vector2 by.
Returns
Returns a reference to this.

Definition at line 172 of file vector2.cpp.

Vector2 & Mezzanine::Vector2::operator/= ( const Vector2 Vec2)

Division assignment Operator.

Parameters
Vec2The other Vector2 to divide by.
Returns
Returns a reference to this.

Definition at line 235 of file vector2.cpp.

Boole Mezzanine::Vector2::operator<= ( const Mezzanine::Vector2 Vec) const

Less or Equal Comparison Operator.

Returns true if X<=X and Y<=Y. If any of those do not hold this returns false.

Parameters
VecThis is the other Mezzanine::Vector2.
Note
Used primarily for testing. This is not implement for use with other kinds of Vector3 implementations as it is widely considered useless.

Definition at line 131 of file vector2.cpp.

Boole Mezzanine::Vector2::operator== ( const Mezzanine::Vector2 Vec2) const

Equality Comparison Operator.

Parameters
Vec2This is the other Mezzanine::Vector2 to compare with.
Returns
Returns true if X==X and Y==Y, otherwise returns false.

Definition at line 119 of file vector2.cpp.

Boole Mezzanine::Vector2::operator== ( const Ogre::Vector2 &  Vec2) const

Equality Comparison Operator.

Parameters
Vec2This is the other Ogre::Vector2.
Returns
Returns true if X==X and Y==Y, otherwise returns false.

Definition at line 125 of file vector2.cpp.

Boole Mezzanine::Vector2::operator>= ( const Mezzanine::Vector2 Vec) const

Greater than or Equal Comparison Operator.

Returns true if X>=X and Y>=Y . If any of those do not hold this returns false.

Parameters
VecThis is the other Mezzanine::Vector2.
Note
Used primarily for testing. This is not implement for use with other kinds of Vector3 implementations as it is widely considered useless.

Definition at line 134 of file vector2.cpp.

Vector2 Mezzanine::Vector2::Perpendicular ( ) const

Generates a Vector2 that is perpendicular to this vector.

Returns
Returns a new Vector2 that is perpendicular to this.

Definition at line 263 of file vector2.cpp.

void Mezzanine::Vector2::ProtoDeSerialize ( const XML::Node OneNode)

Take the data stored in an XML and overwrite this instance of this object with it.

Parameters
OneNodeand XML::Node containing the data.

Definition at line 335 of file vector2.cpp.

void Mezzanine::Vector2::ProtoSerialize ( XML::Node CurrentRoot) const

Convert this class to an XML::Node ready for serialization.

Parameters
CurrentRootThe point in the XML hierarchy that all this vector2 should be appended to.

Definition at line 314 of file vector2.cpp.

Vector2 Mezzanine::Vector2::Reflect ( const Vector2 Normal) const

Gets a reflection vector to the line with the given normal.

Parameters
NormalThe normal of the line being reflected off of.
Returns
Returns a Vector3 containing the reflection vector.

Definition at line 266 of file vector2.cpp.

void Mezzanine::Vector2::SetValues ( const Real x,
const Real y 
)

Sets the X and Y values of this vector2.

Parameters
xThe real that will have this vector's X member set to.
yThe real that will have this vector's Y member set to.

Definition at line 105 of file vector2.cpp.

Real Mezzanine::Vector2::SquaredDistance ( const Vector2 Other) const

Gets the squared distance between this and another vector.

Parameters
OtherThis is the other point to measure the distance to.
Returns
Returns a Real representing the distance squared.

Definition at line 254 of file vector2.cpp.

Real Mezzanine::Vector2::SquaredLength ( ) const

Gets the length of this vector squared.

Returns
Returns a real representing the squared length of this vector.

Definition at line 260 of file vector2.cpp.

Vector2 Mezzanine::Vector2::Unit_X ( )
static

Gets a vector representing the X unit of a Vector2.

Returns
A Vector2(1,0).

Definition at line 84 of file vector2.cpp.

Vector2 Mezzanine::Vector2::Unit_Y ( )
static

Gets a vector representing the Y unit of a Vector2.

Returns
A Vector2(0,1).

Definition at line 87 of file vector2.cpp.


The documentation for this class was generated from the following files: