#include <vector.h>
Collaboration diagram for math::vector3:
Public Methods | |
vector3 (void) | |
Default Constructor. More... | |
vector3 (real_t x_, real_t y_, real_t z_) | |
Constructor. More... | |
vector3 (real_t *r3) | |
Constructor. More... | |
vector3 (const math::vector3 &p) | |
Copy Constructor. | |
math::vector3 & | operator= (const math::vector3 &p) |
Assignment Operator. | |
void | set (real_t x_, real_t y_, real_t z_) |
Sets vector to (x_, y_, z_). | |
real_t | operator() (unsigned int index) const |
Array like read access to vector. More... | |
real_t & | operator() (unsigned int index) |
Array like write access to vector. More... | |
math::vector3 | operator+ (const math::vector3 &rhs) const |
Vector Addition. More... | |
math::vector3 | operator- (const math::vector3 &rhs) const |
Vector Subtraction. More... | |
math::vector3 | operator * (const math::vector3 &rhs) const |
Vector Component Multiplication. More... | |
math::vector3 | operator/ (const math::vector3 &rhs) const |
Vector Component Division. More... | |
math::vector3 | operator- (void) const |
Returns the negated (flipped) vector. More... | |
math::vector3 | operator * (real_t rhs) const |
Scalar Multiplication. More... | |
math::vector3 | operator/ (real_t rhs) const |
Scalar Division. More... | |
void | operator-= (const math::vector3 &v) |
Vector Subtraction. More... | |
void | operator+= (const math::vector3 &v) |
Vector Addition. More... | |
void | operator *= (const math::vector3 &rhs) |
Vector Component Multiplication. More... | |
void | operator/= (const math::vector3 &rhs) |
Vector Component Division. More... | |
void | operator-= (real_t rhs) |
Scalar Subtraction. More... | |
void | operator+= (real_t rhs) |
Scalar Addition. More... | |
void | operator *= (real_t rhs) |
Scalar Multiplication. More... | |
void | operator/= (real_t rhs) |
Scalar Division. More... | |
real_t | x (void) const |
Returns a copy of x. | |
real_t | y (void) const |
Returns a copy of y. | |
real_t | z (void) const |
Returns a copy of z. | |
void | x (real_t x_) |
Sets the value of x. | |
void | y (real_t y_) |
Sets the value of y. | |
void | z (real_t z_) |
Sets the value of z. | |
double | length (void) const |
Returns the length of the vector. More... | |
void | normalize (void) |
Normalizes the vector. More... | |
void | negate (void) |
Negates (flips) the vector. More... | |
bool | operator== (const math::vector3 &rhs) const |
Equals operator. More... | |
bool | operator!= (const math::vector3 &rhs) const |
Not equals operator. More... | |
operator const real_t * (void) const | |
Cast operator to const real_t* . More... | |
Static Public Attributes | |
const vector3 | ZERO |
The vector
. | |
const vector3 | X_AXIS |
The vector
. | |
const vector3 | Y_AXIS |
The vector
. | |
const vector3 | Z_AXIS |
The vector
. | |
Friends | |
math::vector3 | operator * (real_t lhs, const math::vector3 &rhs) |
Scalar Multiplication. More... | |
std::ostream & | operator<< (std::ostream &o, const math::vector3 &vec) |
stream output operator. More... | |
math::vector3 | math::cross (const math::vector3 &lhs, const math::vector3 &rhs) |
Cross Product. More... | |
void | math::add (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs) |
Vector Addition. More... | |
void | math::subtract (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs) |
Vector Subtraction. More... | |
void | math::multiply (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs) |
Vector Component Multiplication. More... | |
void | math::divide (math::vector3 &dest, const math::vector3 &lhs, const math::vector3 &rhs) |
Vector Component Division. More... | |
void | math::multiply (math::vector3 &dest, const math::vector3 &lhs, real_t rhs) |
Scalar Multiplication. More... | |
void | math::multiply (math::vector3 &dest, real_t rhs, const math::vector3 &lhs) |
Scalar Multiplication. More... | |
real_t | math::dot (const math::vector3 &lhs, const math::vector3 &rhs) |
Dot Product. More... |
Definition at line 32 of file vector.h.
|
Default Constructor. Initializes the x, y, and z components to 0.0. |
|
Constructor. Sets vector to (x_, y_, z_). Definition at line 160 of file vector.h. References real_t. |
|
Constructor. Sets vector to what r3 points too.
Definition at line 171 of file vector.h. References real_t. |
|
Returns the length of the vector. The length of a vector is defined as: . Definition at line 446 of file vector.h. Referenced by math::quaternion::from_angle_axis. |
|
Negates (flips) the vector.
|
|
Normalizes the vector. Sets this vector to be unit length. A unit length vector is defined as . Definition at line 457 of file vector.h. References math::equals. Referenced by gl::matrix4::build_look_at. |
|
Scalar Multiplication. Returns the scalar product of the vector and rhs.
Definition at line 301 of file vector.h. References real_t. |
|
Vector Component Multiplication. Multiplies the corresponding components of the vector and rhs, returning the result.
Definition at line 258 of file vector.h. References m_data. |
|
Scalar Multiplication. Multiplies rhs to each component in the vector. The result is stored in this vector. Definition at line 394 of file vector.h. References real_t. |
|
Vector Component Multiplication. Multiplies the corresponding components of the vector and rhs, The result is stored in this vector. Definition at line 349 of file vector.h. References m_data. |
|
Cast operator to Returns a read only pointer to the vector's x, y, z data. |
|
Not equals operator. Checks if the vector is not equal to rhs.
Definition at line 497 of file vector.h. References math::equals, and m_data. |
|
Array like write access to vector. Returns a reference to either the x, y, or z component of the vector based on the index passed in. If the index is not 0, 1, or 3, abort( ) may be called. Definition at line 217 of file vector.h. References real_t. |
|
Array like read access to vector. Returns a copy of either the x, y, or z component of the vector based on the index passed in. If the index is not 0, 1, or 3, abort( ) may be called.
Definition at line 206 of file vector.h. References real_t. |
|
Vector Addition. Returns the vector sum of the vector and rhs.
Definition at line 229 of file vector.h. References m_data. |
|
Scalar Addition. Adds rhs to each component in the vector. The result is stored in this vector. Definition at line 383 of file vector.h. References real_t. |
|
Vector Addition. Adds v to the vector. The result is stored in this vector. Definition at line 338 of file vector.h. References m_data. |
|
Returns the negated (flipped) vector.
|
|
Vector Subtraction. Returns the vector difference of the vector and rhs.
Definition at line 244 of file vector.h. References m_data. |
|
Scalar Subtraction. Subtracts rhs from each component in the vector. The result is stored in this vector. Definition at line 372 of file vector.h. References real_t. |
|
Vector Subtraction. Subtracts v from the vector. The result is stored in this vector. Definition at line 328 of file vector.h. References m_data. |
|
Scalar Division. Divides each component of the vector by rhs, returning the result.
Definition at line 316 of file vector.h. References real_t. |
|
Vector Component Division. Divides the corresponding components of this by rhs, returning the result.
Definition at line 273 of file vector.h. References m_data. |
|
Scalar Division. Divides rhs from each component in the vector. The result is stored in this vector. \warn No divide by zero checks. Definition at line 406 of file vector.h. References real_t. |
|
Vector Component Division. Divides the corresponding components of the vector by rhs, The result is stored in this vector. \warn No divide by zero checks. Definition at line 361 of file vector.h. References m_data. |
|
Equals operator. Checks if the vector is equal to rhs.
Definition at line 484 of file vector.h. References math::equals, and m_data. |
|
Vector Addition. Computes the vector sum of lhs and rhs, placing the result in dest.
|
|
Cross Product. Returns the cross product of lhs and rhs. |
|
Vector Component Division. Divides the corresponding components of lhs by rhs, and places the result in dest.
|
|
Dot Product. Returns the dot product of lhs and rhs. |
|
Scalar Multiplication. Computes the scalar product of lhs and rhs, placing the result in dest.
|
|
Scalar Multiplication. Computes the scalar product of lhs and rhs, placing the result in dest.
|
|
Vector Component Multiplication. Multiplies the corresponding components of lhs and rhs, and places the result in dest.
|
|
Vector Subtraction. Computes the vector difference of lhs and rhs, placing the result in dest.
|
|
Scalar Multiplication. Returns the scalar product of lhs and rhs.
Definition at line 14 of file vector.cpp. |
|
Outputs vec as follows: Definition at line 24 of file vector.cpp. |