#include <Vector3.hpp>
Public Member Functions | |
Vector3 () | |
Constructor 1. | |
Vector3 (const double x, const double y, const double z) | |
Constructor 2. | |
~Vector3 () | |
Destructor. | |
const double | getX () const |
Get the x component of the vector. | |
const double | getY () const |
Get the y component of the vector. | |
const double | getZ () const |
Get the z component of the vector. | |
void | set (const double x, const double y, const double z) |
Set the x, y and z components of the vector. | |
void | setX (const double x) |
Set the x component of the vector. | |
void | setY (const double y) |
Set the y component of the vector. | |
void | setZ (const double z) |
Set the z component of the vector. | |
void | from3Array (const double components[3]) |
Construct vector from a three-dimension array. | |
const double | getLength () const |
Get the length / magnitude of the vector. | |
const Vector3 | normalize () const |
Normalize the vector so that its length equals 1. | |
const double | dotProduct (const Vector3 &right) const |
Calculate the dot-product of this vector with another one. | |
const Vector3 | crossProduct (const Vector3 &right) const |
Calculate the cross-product of this vector with another one. | |
Vector3 & | operator= (const Vector3 &right) |
Affectation operator. | |
Vector3 | operator+ (const Vector3 &right) const |
Addition operator. | |
Vector3 | operator- (const Vector3 &right) const |
Substraction operator. | |
Vector3 | operator * (const double right) const |
Scalar multiplication operator. | |
Vector3 | operator/ (const double right) const |
Scalar division operator. | |
void | operator+= (const Vector3 &right) |
Addition-affectation operator. | |
void | operator-= (const Vector3 &right) |
Substraction-affectation operator. | |
void | operator *= (const double right) |
Scalar multiplication-affectation operator. | |
void | operator/= (const double right) |
Scalar division-affectation operator. | |
bool | operator== (const Vector3 &right) const |
Comparison operator. | |
bool | operator!= (const Vector3 &right) const |
Comparison operator. | |
Private Attributes | |
double | m_x |
x component of the vector | |
double | m_y |
y component of the vector | |
double | m_z |
z component of the vector | |
double | m_lastCalculatedLength |
Last calculated value for the length. | |
bool | m_lastCalculatedLengthIsValid |
One of these:
|
syBR::map2syBR::Vector3::Vector3 | ( | ) |
Constructor 1.
syBR::map2syBR::Vector3::Vector3 | ( | const double | x, | |
const double | y, | |||
const double | z | |||
) |
Constructor 2.
x | x component of the vector | |
y | y component of the vector | |
z | z component of the vector |
syBR::map2syBR::Vector3::~Vector3 | ( | ) |
Destructor.
const double syBR::map2syBR::Vector3::getX | ( | ) | const |
Get the x component of the vector.
const double syBR::map2syBR::Vector3::getY | ( | ) | const |
Get the y component of the vector.
const double syBR::map2syBR::Vector3::getZ | ( | ) | const |
Get the z component of the vector.
void syBR::map2syBR::Vector3::set | ( | const double | x, | |
const double | y, | |||
const double | z | |||
) |
Set the x, y and z components of the vector.
x | x component of the vector | |
y | y component of the vector | |
z | z component of the vector |
void syBR::map2syBR::Vector3::setX | ( | const double | x | ) |
Set the x component of the vector.
x | x component of the vector |
void syBR::map2syBR::Vector3::setY | ( | const double | y | ) |
Set the y component of the vector.
y | y component of the vector |
void syBR::map2syBR::Vector3::setZ | ( | const double | z | ) |
Set the z component of the vector.
z | z component of the vector |
void syBR::map2syBR::Vector3::from3Array | ( | const double | components[3] | ) |
Construct vector from a three-dimension array.
components | Three-dimension array containing the values for the x, y and z components |
const double syBR::map2syBR::Vector3::getLength | ( | ) | const |
Get the length / magnitude of the vector.
const Vector3 syBR::map2syBR::Vector3::normalize | ( | ) | const |
Normalize the vector so that its length equals 1.
const double syBR::map2syBR::Vector3::dotProduct | ( | const Vector3 & | right | ) | const |
Calculate the dot-product of this vector with another one.
right | Vector to calculate the dot product against |
Calculate the cross-product of this vector with another one.
right | Vector to calculate the cross product against |
Affectation operator.
right | Vector to affect to this one |
Addition operator.
right | Vector to add to this one |
Substraction operator.
right | Vector to substract from this one |
Vector3 syBR::map2syBR::Vector3::operator * | ( | const double | right | ) | const |
Scalar multiplication operator.
right | Scalar by which this vector must be multiplied |
Vector3 syBR::map2syBR::Vector3::operator/ | ( | const double | right | ) | const |
Scalar division operator.
right | Scalar by which this vector must be divided |
void syBR::map2syBR::Vector3::operator+= | ( | const Vector3 & | right | ) |
Addition-affectation operator.
right | Vector to add to this one |
void syBR::map2syBR::Vector3::operator-= | ( | const Vector3 & | right | ) |
Substraction-affectation operator.
right | Vector to substract from this one |
void syBR::map2syBR::Vector3::operator *= | ( | const double | right | ) |
Scalar multiplication-affectation operator.
right | Scalar by which this vector must be multiplied |
void syBR::map2syBR::Vector3::operator/= | ( | const double | right | ) |
Scalar division-affectation operator.
right | Scalar by which this vector must be divided |
bool syBR::map2syBR::Vector3::operator== | ( | const Vector3 & | right | ) | const |
Comparison operator.
Compare two vectors by taking rounding errors in account.
right | Vector to compare to |
bool syBR::map2syBR::Vector3::operator!= | ( | const Vector3 & | right | ) | const |
Comparison operator.
Compare two vectors by taking rounding errors in account.
right | Vector to compare to |
double syBR::map2syBR::Vector3::m_x [private] |
x component of the vector
double syBR::map2syBR::Vector3::m_y [private] |
y component of the vector
double syBR::map2syBR::Vector3::m_z [private] |
z component of the vector
double syBR::map2syBR::Vector3::m_lastCalculatedLength [mutable, private] |
Last calculated value for the length.
bool syBR::map2syBR::Vector3::m_lastCalculatedLengthIsValid [mutable, private] |
One of these:
It is used to avoid calculating the lenght of the vector each time getLength() is called.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:34 2008