JugiMap Framework
|
2d vector. More...
#include <jmCommon.h>
Public Member Functions | |
Vec2 () | |
Constructs a vector with coordinates (0,0). More... | |
Vec2 (T _x, T _y) | |
Constructs a vector with the given coordinates **_x** and **_y**. More... | |
void | Set (T _x, T _y) |
Sets the coordinates of this vector to the given **_x** and **_y**. More... | |
bool | operator== (const Vec2< T > &v) const |
Returns true if this vector is equal to given vector v; otherwise returns false. More... | |
bool | operator!= (const Vec2< T > &v) const |
Returns true if this vector is not equal to given vector v; otherwise returns false. More... | |
bool | Equals (const Vec2< T > &v, float epsilon=0.00001f) const |
Returns true if the given vectors v is equal to this vector; otherwise returns false. For floating-point types: two compared numbers are considered equal if their difference is smaller then the given epsilon. More... | |
Vec2< T > | operator- () const |
Return a vector object formed by changing the sign of this vector components. More... | |
Vec2< T > | operator* (const Vec2< T > &v) const |
Returns a vector object formed by multiplying this vector with the given vector v. More... | |
Vec2< T > | operator/ (const Vec2< T > &v) const |
Returns a vector object formed by dividing this vector with the given vector v. More... | |
Vec2< T > | operator+ (const Vec2< T > &v) const |
Returns a vector object formed as the sum of the given s to this vector. More... | |
Vec2< T > | operator- (const Vec2< T > &v) const |
Returns a vector object formed by subtracting the given v from this vector. More... | |
Vec2< T > & | operator+= (const Vec2< T > &v) |
Adds the given vector v to this vector and return a reference to this vector. More... | |
Vec2< T > & | operator-= (const Vec2< T > &v) |
Subtracts the given vector v from this vector and return a reference to this vector. More... | |
Vec2< T > & | operator*= (const Vec2< T > &v) |
Multiplyes this vector with the given vector v and return a reference to this vector. More... | |
Vec2< T > & | operator/= (const Vec2< T > &v) |
Divides this vector with the given vector v and return a reference to this vector. More... | |
Vec2< T > & | operator+= (T s) |
Adds the given s to this vector and return a reference to this vector. More... | |
Vec2< T > & | operator-= (T s) |
Subtracts the given s from this vector and return a reference to this vector. More... | |
Vec2< T > & | operator*= (T s) |
Multiplies this vector with the given s and return a reference to this vector. More... | |
Vec2< T > & | operator/= (T s) |
Divides this vector with the given s and return a reference to this vector. More... | |
Vec2< T > | operator* (double s) const |
Returns a vector object formed by multiplying this vector with the given s. More... | |
Vec2< T > | operator/ (double s) const |
Returns a vector object formed by dividing this vector with the given s. More... | |
Vec2< T > | operator+ (T s) const |
Returns a vector object formed by adding the given s to this vector. More... | |
Vec2< T > | operator- (T s) const |
Returns a vector object formed by subtracting the given s from this vector. More... | |
double | GetLength () const |
Returns the length of this vector. More... | |
double | GetLength2 () const |
Returns the square length of this vector. More... | |
double | Distance (const Vec2< T > &v) const |
Return the distance from the given vector v. More... | |
double | Distance2 (const Vec2< T > &v) const |
Returns the square distance from the given vector v. More... | |
Vec2< T > | Normalize () const |
Returns a vector object formed by normalizing this vector. More... | |
T | Dot (const Vec2< T > &v) const |
Returns the dot product of this vector and the given vector v. More... | |
Public Attributes | |
T | x |
The x coordinate. More... | |
T | y |
The y coordinate. More... | |
2d vector.
|
inline |
Constructs a vector with coordinates (0,0).
Returns true if this vector is equal to given vector v; otherwise returns false.
Returns true if this vector is not equal to given vector v; otherwise returns false.
Returns true if the given vectors v is equal to this vector; otherwise returns false. For floating-point types: two compared numbers are considered equal if their difference is smaller then the given epsilon.
Return a vector object formed by changing the sign of this vector components.
Returns a vector object formed by multiplying this vector with the given vector v.
Returns a vector object formed by dividing this vector with the given vector v.
Returns a vector object formed as the sum of the given s to this vector.
Returns a vector object formed by subtracting the given v from this vector.
Adds the given vector v to this vector and return a reference to this vector.
Subtracts the given vector v from this vector and return a reference to this vector.
Multiplyes this vector with the given vector v and return a reference to this vector.
Divides this vector with the given vector v and return a reference to this vector.
Adds the given s to this vector and return a reference to this vector.
Subtracts the given s from this vector and return a reference to this vector.
Multiplies this vector with the given s and return a reference to this vector.
Divides this vector with the given s and return a reference to this vector.
Returns a vector object formed by multiplying this vector with the given s.
Returns a vector object formed by dividing this vector with the given s.
Returns a vector object formed by adding the given s to this vector.
Returns a vector object formed by subtracting the given s from this vector.
|
inline |
Returns the length of this vector.
|
inline |
Returns the square length of this vector.
Returns the square distance from the given vector v.
Returns the dot product of this vector and the given vector v.
T x |
The x coordinate.
T y |
The y coordinate.