cee::Vec2f
-
class
Vec2f
Vector class for a 2D float vector.
Public Functions
-
Vec2f
() Constructs a null vector.
-
Vec2f
(float x, float y) Constructs a vector from an x and y coordinate.
-
Vec2f &
operator=
(const Vec2f &other) Assigns other to this vector and returns a reference to this vector.
-
bool
operator==
(const Vec2f &rhs) const Returns true if two vectors are equal, otherwise returns false.
An exact match is required x() == rhs.x(), etc.
-
bool
operator!=
(const Vec2f &rhs) const Returns true if two vectors are not equal, otherwise returns false.
Exact comparison is used (!= between floats)
-
const Vec2f
operator-
(const Vec2f &rhs) const Returns a vector that is this vector subtracted with rhs.
-
const Vec2f
operator*
(float scalar) const Returns a vector that is this vector multiplies with scalar.
-
const Vec2f
operator/
(float scalar) const Returns a vector that is this vector divided with scalar.
-
float
operator*
(const Vec2f &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 float &
x
() const X element of the vector.
-
const float &
y
() const Y element of the vector.
-
float &
x
() X element of the vector.
-
float &
y
() Y element of the vector.
-
void
set
(float x, float y) Sets x and y value.
-
bool
normalize
() Normalizes this vector.
Returns false if the vector is a null vector. Otherwise returns true.
-
float
length
() const Returns the length of this vector.
-