cee::Vec2d
-
class
Vec2d Vector class for a 2D double vector.
Public Functions
-
Vec2d() Constructs a null vector.
-
Vec2d(double x, double y) Constructs a vector from an x and y coordinate.
-
Vec2d &
operator=(const Vec2d &other) Assigns other to this vector and returns a reference to this vector.
-
bool
operator==(const Vec2d &rhs) const Returns true if two vectors are equal, otherwise returns false.
An exact match is required x() == rhs.x(), etc.
-
bool
operator!=(const Vec2d &rhs) const Returns true if two vectors are not equal, otherwise returns false.
Exact comparison is used (!= between doubles)
-
const Vec2d
operator-(const Vec2d &rhs) const Returns a vector that is this vector subtracted with rhs.
-
const Vec2d
operator*(double scalar) const Returns a vector that is this vector multiplies with scalar.
-
const Vec2d
operator/(double scalar) const Returns a vector that is this vector divided with scalar.
-
double
operator*(const Vec2d &rhs) const Computes the dot product of this and rhs and return the result (scalar)
Formula:
S = this.x*rhs.x + this.y*rhs.y
-
const double &
x() const X element of the vector.
-
const double &
y() const Y element of the vector.
-
double &
x() X element of the vector.
-
double &
y() Y element of the vector.
-
void
set(double x, double y) Sets x and y value.
-
bool
normalize() Normalizes this vector.
Returns false if the vector is a null vector. Otherwise returns true.
-
double
length() const Returns the length of this vector.
-