Polycode
|
2D Vector (convenience wrapper around Vector3). More...
Public Member Functions | |
Vector2 (Number x, Number y) | |
Create from x,y,z coordinates. | |
Vector2 () | |
Default constructor. | |
void | set (Number x, Number y) |
Sets the vector from x,y,z coordinates. | |
Number | distance (const Vector2 &vec2) const |
Returns the distance from this vector to another one. | |
Number | length () const |
Returns the vector length. | |
Number | dot (const Vector2 &u) const |
Returns the dot product with another vector. | |
Number | crossProduct (const Vector2 &vec2) const |
Returns the cross product with another vector. | |
void | Normalize () |
Normalizes the vector. | |
Operators | |
Available vector operators. | |
Vector2 | operator* (const Number val) const |
Vector2 | operator/ (const Number val) const |
Vector2 & | operator= (const Vector2 &v2) |
Vector2 & | operator+= (const Vector2 &v2) |
Vector2 & | operator-= (const Vector2 &v2) |
Vector2 | operator+ (const Vector2 &v2) const |
bool | operator== (const Vector2 &v2) |
bool | operator!= (const Vector2 &v2) |
Public Attributes | |
Number | x |
X coordinate. | |
Number | y |
Y coordinate. |
2D Vector (convenience wrapper around Vector3).
Vector2::Vector2 | ( | Number | x, |
Number | y | ||
) |
Create from x,y,z coordinates.
x | X coordinate. |
y | Y coordinate. |
Number Polycode::Vector2::crossProduct | ( | const Vector2 & | vec2 | ) | const [inline] |
Returns the cross product with another vector.
vec2 | Second vector. |
Number Polycode::Vector2::distance | ( | const Vector2 & | vec2 | ) | const [inline] |
Returns the distance from this vector to another one.
vec2 | Second vector. |
Number Polycode::Vector2::dot | ( | const Vector2 & | u | ) | const [inline] |
Returns the dot product with another vector.
Number Polycode::Vector2::length | ( | ) | const [inline] |
Returns the vector length.
void Vector2::set | ( | Number | x, |
Number | y | ||
) |
Sets the vector from x,y,z coordinates.
x | X coordinate. |
y | Y coordinate. |