cee::Vec3f
-
class Vec3f
Vector class for a 3D float vector.
Public Functions
-
Vec3f()
Constructs a null vector.
-
Vec3f(float x, float y, float z)
Constructs a vector from an x, y and z coordinate.
-
Vec3f &operator=(const Vec3f &other)
Assigns other to this vector and returns a reference to this vector.
-
bool operator==(const Vec3f &rhs) const
Returns true if two vectors are equal, otherwise returns false.
An exact match is required x() == rhs.x(), etc.
-
bool operator!=(const Vec3f &rhs) const
Returns true if two vectors are not equal, otherwise returns false.
Exact comparison is used (!= between floats)
-
const Vec3f operator-(const Vec3f &rhs) const
Returns a vector that is this vector subtracted with rhs.
-
const Vec3f operator*(float scalar) const
Returns a vector that is this vector multiplies with scalar.
-
const Vec3f operator/(float scalar) const
Returns a vector that is this vector divided with scalar.
-
float operator*(const Vec3f &rhs) const
Computes the dot product of this and rhs and return the result (scalar)
Formula:
S = tx*rx + ty*ry + tz*rz
-
const Vec3f operator^(const Vec3f &rhs) const
Computes the cross product of this and rhs and return the result (vector)
Formula:
vec = <ty*rz - tz*ry, tz*rx - tx*rz, tx*ry - ty*rx>
-
const float &x() const
X element of the vector.
-
const float &y() const
Y element of the vector.
-
const float &z() const
Z element of the vector.
-
float &x()
X element of the vector.
-
float &y()
Y element of the vector.
-
float &z()
Z element of the vector.
-
void set(float x, float y, float z)
Sets x, y and z 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.
-
Vec3f()