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