Base Framework
|
Two-dimensional vector. More...
#include <base/math/Vector2D.h>
Public Member Functions | |
Vector2D () noexcept | |
Vector2D (const TYPE &x, const TYPE &y) noexcept | |
Vector2D (const Vector2D ©) noexcept | |
Vector2D & | operator= (const Vector2D &assign) noexcept |
TYPE | getSqrModulus () const noexcept |
TYPE | getModulus () const noexcept |
TYPE | getAngle () const noexcept |
TYPE | getX () const noexcept |
TYPE | getY () const noexcept |
void | setX (const TYPE &x) noexcept |
void | setY (const TYPE &y) noexcept |
Vector2D & | zeroAdjust (const TYPE &zero) noexcept |
bool | isZero () const noexcept |
bool | isProper () const noexcept |
bool | isOrthogonal (const Vector2D &value) const noexcept |
bool | isParallel (const Vector2D &value) const noexcept |
Vector2D | plus () const noexcept |
Vector2D | minus () const noexcept |
Vector2D & | negate () noexcept |
Vector2D & | add (const Vector2D &value) noexcept |
Vector2D & | subtract (const Vector2D &value) noexcept |
Vector2D & | multiply (const TYPE &value) noexcept |
Vector2D & | divide (const TYPE &value) noexcept |
TYPE | dot (const Vector2D &value) const noexcept |
TYPE | determinant (const Vector2D &value) const noexcept |
TYPE | getAngle (const Vector2D &value) const noexcept |
Vector2D | getProjection (const Vector2D &value) const noexcept |
bool | operator== (const Vector2D &value) const noexcept |
Vector2D & | operator+= (const Vector2D &value) noexcept |
Vector2D & | operator-= (const Vector2D &value) noexcept |
Vector2D & | operator*= (const TYPE &value) noexcept |
Vector2D & | operator/= (const TYPE &value) noexcept |
Vector2D | operator+ () const noexcept |
Vector2D | operator- () const noexcept |
Protected Attributes | |
TYPE | x = 0 |
TYPE | y = 0 |
Related Functions | |
(Note that these are not member functions.) | |
template<class TYPE > | |
Vector2D< TYPE > | operator+ (const Vector2D< TYPE > &left, const Vector2D< TYPE > &right) noexcept |
template<class TYPE > | |
Vector2D< TYPE > | operator- (const Vector2D< TYPE > &left, const Vector2D< TYPE > &right) noexcept |
template<class TYPE > | |
Vector2D< TYPE > | operator* (const Vector2D< TYPE > &left, const TYPE &right) noexcept |
template<class TYPE > | |
Vector2D< TYPE > | operator* (const TYPE &left, const Vector2D< TYPE > &right) noexcept |
template<class TYPE > | |
Vector2D< TYPE > | operator/ (const Vector2D< TYPE > &left, const TYPE &right) noexcept |
template<class TYPE > | |
TYPE | dot (const Vector2D< TYPE > &left, const Vector2D< TYPE > &right) noexcept |
template<class TYPE > | |
TYPE | determinant (const Vector2D< TYPE > &left, const Vector2D< TYPE > &right) noexcept |
template<class TYPE > | |
FormatOutputStream & | operator<< (FormatOutputStream &stream, const Vector2D< TYPE > &value) |
Two-dimensional vector.
A two-dimensional vector represented by X and Y coordinates.
Initializes vector as the origin (0,0).
Initializes vector from the specified coordinates.
x | The desired X coordinate. |
y | The desired Y coordinate. |
Initializes vector by copying from the specified vector.
copy | The desired vector. |
|
inlinenoexcept |
Adds the specified vector to this vector.
|
inlinenoexcept |
Returns the determinant of this vector and the specified vector.
Divides this vector with the specified value.
|
inlinenoexcept |
Returns the dot product of this vector and the specified vector.
|
inlinenoexcept |
Returns the angle of the vector.
|
inlinenoexcept |
Returns the angle between this vector and the specified vector.
|
inlinenoexcept |
Returns the modulus of the vector.
|
inlinenoexcept |
Returns the projection of this vector onto the specified vector.
|
inlinenoexcept |
Returns the square of the modulus of the vector.
|
inlinenoexcept |
Returns the X coordinate.
|
inlinenoexcept |
Returns the Y coordinate.
|
inlinenoexcept |
Returns true if this vector is orthogonal with the specified vector.
|
inlinenoexcept |
Returns true if this vector is parallel with the specified vector.
|
inlinenoexcept |
Returns true if the length of this vector is greater zero.
|
inlinenoexcept |
Returns true if the length of this vector is zero.
Multiplies this vector with the specified value.
Multiplies this vector with the specified value.
value | The multiplicator. |
|
inlinenoexcept |
Adds the specified vector from this vector.
value | The value to be added. |
|
inlinenoexcept |
Subtracts the specified vector from this vector.
value | The value to be subtracted. |
Divides this vector with the specified value.
value | The divisor. |
|
inlinenoexcept |
Assignment of this vector from vector.
|
inlinenoexcept |
Returns true if the vectors are equal.
vector | Vector to be compared. |
|
inlinenoexcept |
Sets the X coordinate.
x | The desired X coordinate. |
|
inlinenoexcept |
Sets the Y coordinate.
y | The desired Y coordinate. |
|
inlinenoexcept |
Subtracts the specified vector from this vector.
Sets values less than the specified value to zero.
|
related |
Returns the determinant of the two vectors.
|
related |
Returns the dot product of the two vectors.
|
related |
Returns the product of the vector and the value.
|
related |
Returns the product of the vector and the value.
|
related |
Returns the sum of the vectors.
|
related |
Returns the difference of the vectors.
|
related |
Returns the ratio of the vector and the value.
|
related |
Writes a string representation of a Vector2D object to a format stream. The format is "(x; y)".
|
protected |
The X coordinate.
|
protected |
The Y coordinate.