Public Methods |
| Vec3 () |
| Vec3 (float x, float y, float z) |
const bool | operator== (const Vec3 &v) const |
const bool | operator!= (const Vec3 &v) const |
const bool | operator< (const Vec3 &v) const |
float * | ptr () |
const float * | ptr () const |
void | set (float x, float y, float z) |
float & | operator[] (int i) |
const float | operator[] (int i) const |
float & | x () |
float & | y () |
float & | z () |
const float | x () const |
const float | y () const |
const float | z () const |
const bool | valid () const |
const bool | isNaN () const |
float | operator * (const Vec3 &rhs) const |
| dot product
|
const Vec3 | operator^ (const Vec3 &rhs) const |
| cross product
|
const Vec3 | operator * (const float &rhs) const |
| multiply by scalar
|
Vec3 & | operator *= (const float &rhs) |
| unary multiply by scalar
|
const Vec3 | operator/ (const float &rhs) const |
| divide by scalar
|
Vec3 & | operator/= (const float &rhs) |
| unary divide by scalar
|
const Vec3 | operator+ (const Vec3 &rhs) const |
| binary vector add
|
Vec3 & | operator+= (const Vec3 &rhs) |
| unary vector add.
|
const Vec3 | operator- (const Vec3 &rhs) const |
| binary vector subtract
|
Vec3 & | operator-= (const Vec3 &rhs) |
| unary vector subtract
|
const Vec3 | operator- () const |
| negation operator. Returns the negative of the Vec3
|
const float | length () const |
| Length of the vector = sqrt( vec . vec ).
|
const float | length2 () const |
| Length squared of the vector = vec . vec.
|
const float | normalize () |
| normalize the vector so that it has length unity returns the previous length of the vector
|
Public Attributes |
float | _v [3] |
Friends |
std::ostream & | operator<< (std::ostream &output, const Vec3 &vec) |
Provides general maths operations from addition through to cross products. No support yet added for float * Vec3 - is it necessary? Need to define a non-member non-friend operator * etc. Vec3 * float is okay