Vector. More...
#include <Vector2.h>
Public Member Functions | |
Vector2 () | |
Default constructor. More... | |
Vector2 (const double x_, const double y_, const double z_) | |
Constructor. More... | |
Vector2 (const Vector2 &v_) | |
Copy constructor. More... | |
int | getMaxIndex () const |
Get the index of the largest absolute component. 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_, const double z_) |
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... | |
double | z () const |
Get the z-value. More... | |
Protected Attributes | |
double | valX |
double | valY |
double | valZ |
This class represents a 2.5D vector.
GEOM_FADE25D::Vector2::Vector2 | ( | const double | x_, |
const double | y_, | ||
const double | z_ | ||
) |
Constructs a vector with the given x, y, and z components.
x_,y_,z_ | The coordinates of the vector. |
GEOM_FADE25D::Vector2::Vector2 | ( | ) |
Initializes the vector to (0, 0, 0).
GEOM_FADE25D::Vector2::Vector2 | ( | const Vector2 & | v_ | ) |
Creates a copy of the given vector.
v_ | The vector to copy. |
int GEOM_FADE25D::Vector2::getMaxIndex | ( | ) | const |
Returns the index of the largest absolute component (0 for x, 1 for y, or 2 for z).
bool GEOM_FADE25D::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_FADE25D::Vector2::length | ( | ) | const |
double GEOM_FADE25D::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_FADE25D::Vector2::operator* | ( | double | val | ) | const |
Multiplies the vector by a scalar value.
val | The scalar value to multiply by. |
Vector2 GEOM_FADE25D::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_FADE25D::Vector2::orthogonalVector | ( | ) | const |
void GEOM_FADE25D::Vector2::set | ( | const double | x_, |
const double | y_, | ||
const double | z_ | ||
) |
Sets the x, y, and z components of the vector.
x_,y_,z_ | The components of the vector. |
double GEOM_FADE25D::Vector2::sqLength | ( | ) | const |
double GEOM_FADE25D::Vector2::x | ( | ) | const |
double GEOM_FADE25D::Vector2::y | ( | ) | const |
double GEOM_FADE25D::Vector2::z | ( | ) | const |