#include <AH/Math/Vector.hpp>
Type for 3D vectors of floating point numbers.
Vec3fs can be added, subtracted, multiplied (dot product) and normalized. It also has an implementation of the following operators: "+", "+=", "-", "-=", "*" (vector-vector); "*", "*=", "/", "/=" (vector-scalar); "==", "!=" (equality); "*" (scalar-vector); "<<" (printing).
Definition at line 140 of file Vector.hpp.
Public Member Functions | |
Vec3f ()=default | |
Create a vector that is initialized to the zero vector (0,0,0). | |
Vec3f (float x, float y, float z) | |
Create a vector with the given x, y and z coordinates. | |
Vec3f (const Vec3f &)=default | |
Vec3f (const volatile Vec3f &other) | |
void | operator= (const Vec3f &other) volatile |
Vec3f & | operator+= (Vec3f rhs) |
Addition. | |
Vec3f | operator+ (Vec3f rhs) const |
Addition. | |
Vec3f | operator- () const |
Negation. | |
Vec3f & | operator-= (Vec3f rhs) |
Subtraction. | |
Vec3f | operator- (Vec3f rhs) const |
Subtraction. | |
Vec3f & | operator*= (float rhs) |
Scalar multiplication. | |
Vec3f | operator* (float rhs) const |
Scalar multiplication. | |
Vec3f & | operator/= (float rhs) |
Scalar division. | |
Vec3f | operator/ (float rhs) const |
Scalar division. | |
float | operator* (Vec3f rhs) const |
Inner product. | |
float | normSquared () const |
Norm squared. | |
float | norm () const |
Norm. | |
Vec3f & | normalize () |
Normalize this vector. | |
Vec3f | normalized () const |
Normalize a copy of this vector (doesn't change the original vector). | |
bool | operator== (Vec3f rhs) const |
Equality check. | |
bool | operator!= (Vec3f rhs) const |
Inequality check. | |
Public Attributes | |
float | x = 0.0 |
The x component of the vector. | |
float | y = 0.0 |
The y component of the vector. | |
float | z = 0.0 |
The z component of the vector. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Print & | operator<< (Print &os, Vec3f v) |
Printing. | |
Vec3f | operator* (float lhs, Vec3f rhs) |
Scalar multiplication. | |
Print & | operator<< (Print &os, Vec3f v) |
Printing. | |
|
default |
Create a vector that is initialized to the zero vector (0,0,0).
Create a vector with the given x, y and z coordinates.
Definition at line 148 of file Vector.hpp.
Addition.
Definition at line 158 of file Vector.hpp.
Addition.
Definition at line 165 of file Vector.hpp.
Negation.
Definition at line 172 of file Vector.hpp.
Subtraction.
Definition at line 174 of file Vector.hpp.
Subtraction.
Definition at line 176 of file Vector.hpp.
Scalar multiplication.
Definition at line 183 of file Vector.hpp.
Scalar multiplication.
Definition at line 190 of file Vector.hpp.
Scalar division.
Definition at line 197 of file Vector.hpp.
Scalar division.
Definition at line 204 of file Vector.hpp.
Inner product.
Definition at line 211 of file Vector.hpp.
|
inline |
Norm squared.
Definition at line 216 of file Vector.hpp.
|
inline |
Norm.
Definition at line 219 of file Vector.hpp.
|
inline |
Normalize this vector.
Definition at line 225 of file Vector.hpp.
|
inline |
Normalize a copy of this vector (doesn't change the original vector).
Definition at line 227 of file Vector.hpp.
Equality check.
Definition at line 230 of file Vector.hpp.
Inequality check.
Definition at line 234 of file Vector.hpp.
Printing.
Definition at line 36 of file Vector.cpp.
float x = 0.0 |
The x component of the vector.
Definition at line 141 of file Vector.hpp.
float y = 0.0 |
The y component of the vector.
Definition at line 142 of file Vector.hpp.
float z = 0.0 |
The z component of the vector.
Definition at line 143 of file Vector.hpp.