Vector. More...
#include <Vector2.h>
Public Member Functions | |
| Vector2 () | |
| Default constructor. More... | |
| Vector2 (const double x_, const double y_) | |
| Constructor. More... | |
| Vector2 (const Vector2 &v_) | |
| Copy constructor. More... | |
| bool | isDegenerate () const |
| Check if the vector is degenerate. More... | |
| double | length () const |
| Get the length of the vector. More... | |
| double | operator* (const Vector2 &other) const |
| Scalar product. More... | |
| Vector2 | operator* (double val) const |
| Multiplication by a scalar. More... | |
| Vector2 | operator/ (double val) const |
| Division by a scalar. More... | |
| Vector2 & | operator= (const Vector2 &other) |
| Assignment operator. More... | |
| Vector2 | orthogonalVector () const |
| Get a normalized, orthogonal 2D vector (CCW direction) More... | |
| void | set (const double x_, const double y_) |
| Set the components. More... | |
| double | sqLength () const |
| Get the squared length of the vector. More... | |
| double | x () const |
| Get the x-value. More... | |
| double | y () const |
| Get the y-value. More... | |
Protected Attributes | |
| double | valX |
| double | valY |
This class represents a 2D vector.
| GEOM_FADE2D::Vector2::Vector2 | ( | const double | x_, |
| const double | y_ | ||
| ) |
Constructs a 2D vector with the given x and y components.
| x_,y_ | The coordinates of the vector. |
| GEOM_FADE2D::Vector2::Vector2 | ( | ) |
Initializes the vector to (0, 0).
| GEOM_FADE2D::Vector2::Vector2 | ( | const Vector2 & | v_ | ) |
Creates a copy of the given vector.
| v_ | The vector to copy. |
| bool GEOM_FADE2D::Vector2::isDegenerate | ( | ) | const |
Checks if the vector is degenerate (i.e., has zero length).
true if the vector length is 0, false otherwise. | double GEOM_FADE2D::Vector2::length | ( | ) | const |
| double GEOM_FADE2D::Vector2::operator* | ( | const Vector2 & | other | ) | const |
Computes the scalar product of the current vector and another vector.
| other | The other vector to compute the scalar product with. |
| Vector2 GEOM_FADE2D::Vector2::operator* | ( | double | val | ) | const |
Multiplies the vector by a scalar value.
| val | The scalar value to multiply by. |
| Vector2 GEOM_FADE2D::Vector2::operator/ | ( | double | val | ) | const |
Divides the vector by a scalar value.
| val | The scalar value to divide by. |
Assigns the values of one vector to another.
| other | The vector to copy. |
| Vector2 GEOM_FADE2D::Vector2::orthogonalVector | ( | ) | const |
| void GEOM_FADE2D::Vector2::set | ( | const double | x_, |
| const double | y_ | ||
| ) |
Sets the x, and y components of the vector.
| x_,y_ | The components of the vector. |
| double GEOM_FADE2D::Vector2::sqLength | ( | ) | const |
| double GEOM_FADE2D::Vector2::x | ( | ) | const |
| double GEOM_FADE2D::Vector2::y | ( | ) | const |