#include <Vector2D.hpp>
Public Member Functions | |
| Vector2D () | |
| Constructor #1. | |
| Vector2D (float x, float y) | |
| Constructor #2. | |
| Vector2D (const Vector2D &vector) | |
| Copy constructor. | |
| const float | getX () const |
| Get the x coordinate of the vector. | |
| const float | getY () const |
| Get the y coordinate of the vector. | |
| void | set (const float x, const float y) |
| Set the coordinates of the vector. | |
| void | setX (const float x) |
| Set the x coordinate of the vector. | |
| void | setY (const float y) |
| Set the y coordinate of the vector. | |
| void | from2Array (const float array[2]) |
| Set the coordinates of the vector from a 2-element array. | |
| const float | getLength () const |
| Calculate the length (magnitude) of the vector. | |
| Vector2D | normalize () const |
| Return a normalized vector which have the same directions as this vector. | |
| Vector2D & | operator= (const Vector2D &arg) |
| Set the vector coordinates using an "=" operator. | |
| Vector2D | operator+ (const Vector2D &arg) const |
| Add a vector using a "+" operator. | |
| Vector2D | operator- (const Vector2D &arg) const |
| Substract a vector using a "-" operator. | |
| Vector2D | operator * (const float arg) const |
| Multiply coordinates by a scalar using a "*" operator. | |
| Vector2D | operator/ (const float arg) const |
| Divide coordinates by a scalar using a "/" operator. | |
| void | operator+= (const Vector2D &arg) |
| Add the coordinates of a vector to those of this using a "+=" operator. | |
| void | operator-= (const Vector2D &arg) |
| Substract the coordinates of a vector from those of this using a "-=" operator. | |
| void | operator *= (const float arg) |
| Multiply the coordinates of this by a scalar using a "*=" operator. | |
| void | operator/= (const float arg) |
| Divide the coordinates of this by a scalar using a "/=" operator. | |
| bool | operator== (const Vector2D &arg) const |
| Compare a vector to this. | |
| bool | operator!= (const Vector2D &arg) const |
| Compare a vector to this. | |
Private Attributes | |
| float | m_x |
| x coordinate of the vector | |
| float | m_y |
| y coordinate of the vector | |
| float | m_length |
| Length of the vector (0 if not calculated yet). | |
| bool | m_lengthChanged |
| Indicate if length has been changed since last time it was calculated (it avoids to re-calculate the length too many times). | |
| syBR::Core::Vector2D::Vector2D | ( | ) |
Constructor #1.
Initialize vector to (0,0)
| syBR::Core::Vector2D::Vector2D | ( | float | x, | |
| float | y | |||
| ) |
Constructor #2.
Initialize vector to specific coordinates
| x | X coordinate of the vector | |
| y | Y coordinate of the vector |
| syBR::Core::Vector2D::Vector2D | ( | const Vector2D & | vector | ) |
Copy constructor.
| vector | 2D vector from which coordinates must be copied |
| const float syBR::Core::Vector2D::getX | ( | ) | const [inline] |
Get the x coordinate of the vector.
| const float syBR::Core::Vector2D::getY | ( | ) | const [inline] |
Get the y coordinate of the vector.
| void syBR::Core::Vector2D::set | ( | const float | x, | |
| const float | y | |||
| ) |
Set the coordinates of the vector.
| x | X coordinate of the vector | |
| y | Y coordinate of the vector |
| void syBR::Core::Vector2D::setX | ( | const float | x | ) |
Set the x coordinate of the vector.
| x | X coordinate of the vector |
| void syBR::Core::Vector2D::setY | ( | const float | y | ) |
Set the y coordinate of the vector.
| y | Y coordinate of the vector |
| void syBR::Core::Vector2D::from2Array | ( | const float | array[2] | ) |
Set the coordinates of the vector from a 2-element array.
| array | Array containing the (x,y) coordinates |
| const float syBR::Core::Vector2D::getLength | ( | ) | const |
Calculate the length (magnitude) of the vector.
| Vector2D syBR::Core::Vector2D::normalize | ( | ) | const |
Return a normalized vector which have the same directions as this vector.
Set the vector coordinates using an "=" operator.
| arg | New coordinates to set |
Add a vector using a "+" operator.
| arg | Coordinates to add |
Substract a vector using a "-" operator.
| arg | Coordinates to substract |
| Vector2D syBR::Core::Vector2D::operator * | ( | const float | arg | ) | const |
Multiply coordinates by a scalar using a "*" operator.
| arg | Scalar to multiply by |
| Vector2D syBR::Core::Vector2D::operator/ | ( | const float | arg | ) | const |
Divide coordinates by a scalar using a "/" operator.
| arg | Scalar to divide by |
| void syBR::Core::Vector2D::operator+= | ( | const Vector2D & | arg | ) |
Add the coordinates of a vector to those of this using a "+=" operator.
| arg | Coordinates to add |
| void syBR::Core::Vector2D::operator-= | ( | const Vector2D & | arg | ) |
Substract the coordinates of a vector from those of this using a "-=" operator.
| arg | Coordinates to substract |
| void syBR::Core::Vector2D::operator *= | ( | const float | arg | ) |
Multiply the coordinates of this by a scalar using a "*=" operator.
| arg | Coordinates to multiply by |
| void syBR::Core::Vector2D::operator/= | ( | const float | arg | ) |
Divide the coordinates of this by a scalar using a "/=" operator.
| arg | Scalar to divide by |
| bool syBR::Core::Vector2D::operator== | ( | const Vector2D & | arg | ) | const |
Compare a vector to this.
| arg | Vector to compare to |
| bool syBR::Core::Vector2D::operator!= | ( | const Vector2D & | arg | ) | const |
Compare a vector to this.
| arg | Vector to compare to |
float syBR::Core::Vector2D::m_x [private] |
x coordinate of the vector
float syBR::Core::Vector2D::m_y [private] |
y coordinate of the vector
float syBR::Core::Vector2D::m_length [private] |
Length of the vector (0 if not calculated yet).
bool syBR::Core::Vector2D::m_lengthChanged [private] |
Indicate if length has been changed since last time it was calculated (it avoids to re-calculate the length too many times).
Copyright © 2008 by Sebastien Frippiat

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008