libmove3d
3.13.0
|
#include <vector3d.h>
Public Member Functions | |
Vector3 (const double fX, const double fY, const double fZ) | |
Vector3 (const double afCoordinate[3]) | |
Vector3 (const int afCoordinate[3]) | |
Vector3 (const p3d_matrix4 m) | |
Vector3 (double *const r) | |
Vector3 (const double scaler) | |
int | size () const |
double | operator[] (const size_t i) const |
double & | operator[] (const size_t i) |
double * | ptr () |
Pointer accessor for direct copying. | |
const double * | ptr () const |
Pointer accessor for direct copying. | |
Vector3 & | operator= (const Vector3 &rkVector) |
Vector3 & | operator= (const double fScaler) |
bool | operator== (const Vector3 &rkVector) const |
bool | operator!= (const Vector3 &rkVector) const |
Vector3 | operator+ (const Vector3 &rkVector) const |
Vector3 | operator- (const Vector3 &rkVector) const |
Vector3 | operator* (const double fScalar) const |
Vector3 | operator* (const Vector3 &rhs) const |
Vector3 | operator/ (const double fScalar) const |
Vector3 | operator/ (const Vector3 &rhs) const |
const Vector3 & | operator+ () const |
Vector3 | operator- () const |
Vector3 & | operator+= (const Vector3 &rkVector) |
Vector3 & | operator+= (const double fScalar) |
Vector3 & | operator-= (const Vector3 &rkVector) |
Vector3 & | operator-= (const double fScalar) |
Vector3 & | operator*= (const double fScalar) |
Vector3 & | operator*= (const Vector3 &rkVector) |
Vector3 & | operator/= (const double fScalar) |
Vector3 & | operator/= (const Vector3 &rkVector) |
double | length () const |
double | squaredLength () const |
double | distance (const Vector3 &rhs) const |
double | squaredDistance (const Vector3 &rhs) const |
double | dotProduct (const Vector3 &vec) const |
double | absDotProduct (const Vector3 &vec) const |
double | normalise () |
Vector3 | crossProduct (const Vector3 &rkVector) const |
Vector3 | midPoint (const Vector3 &vec) const |
bool | operator< (const Vector3 &rhs) const |
bool | operator> (const Vector3 &rhs) const |
void | makeFloor (const Vector3 &cmp) |
void | makeCeil (const Vector3 &cmp) |
Vector3 | perpendicular (void) const |
bool | isZeroLength (void) const |
Vector3 | normalisedCopy (void) const |
Vector3 | reflect (const Vector3 &normal) const |
bool | positionEquals (const Vector3 &rhs, double tolerance=1e-03) const |
bool | doubleEqual (const double &a, const double &b, const double &tolerance) const |
bool | positionCloses (const Vector3 &rhs, double tolerance=1e-03f) const |
Public Attributes | |
double | x |
double | y |
double | z |
Static Public Attributes | |
static const Vector3 | ZERO |
static const Vector3 | UNIT_X |
static const Vector3 | UNIT_Y |
static const Vector3 | UNIT_Z |
static const Vector3 | NEGATIVE_UNIT_X |
static const Vector3 | NEGATIVE_UNIT_Y |
static const Vector3 | NEGATIVE_UNIT_Z |
static const Vector3 | UNIT_SCALE |
Friends | |
Vector3 | operator* (const double fScalar, const Vector3 &rkVector) |
Vector3 | operator/ (const double fScalar, const Vector3 &rkVector) |
Vector3 | operator+ (const Vector3 &lhs, const double rhs) |
Vector3 | operator+ (const double lhs, const Vector3 &rhs) |
Vector3 | operator- (const Vector3 &lhs, const double rhs) |
Vector3 | operator- (const double lhs, const Vector3 &rhs) |
std::ostream & | operator<< (std::ostream &o, const Vector3 &v) |
Standard 3-dimensional vector.
double Vector3::absDotProduct | ( | const Vector3 & | vec | ) | const [inline] |
Calculates the absolute dot (scalar) product of this vector with another.
vec | Vector with which to calculate the absolute dot product (together with this one). |
Calculates the cross-product of 2 vectors, i.e. the vector that lies perpendicular to them both.
vec | Vector which, together with this one, will be used to calculate the cross-product. |
double Vector3::distance | ( | const Vector3 & | rhs | ) | const [inline] |
Returns the distance to another vector.
double Vector3::dotProduct | ( | const Vector3 & | vec | ) | const [inline] |
Calculates the dot (scalar) product of this vector with another.
vec | Vector with which to calculate the dot product (together with this one). |
bool Vector3::isZeroLength | ( | void | ) | const [inline] |
Generates a new random vector which deviates from this vector by a given angle in a random direction.
angle | The angle at which to deviate |
up | Any vector perpendicular to this one (which could generated by cross-product of this vector and any other non-colinear vector). If you choose not to provide this the function will derive one on it's own, however if you provide one yourself the function will be faster (this allows you to reuse up vectors if you call this method more than once) |
double Vector3::length | ( | ) | const [inline] |
Returns the length (magnitude) of the vector.
void Vector3::makeCeil | ( | const Vector3 & | cmp | ) | [inline] |
Sets this vector's components to the maximum of its own and the ones of the passed in vector.
void Vector3::makeFloor | ( | const Vector3 & | cmp | ) | [inline] |
Sets this vector's components to the minimum of its own and the ones of the passed in vector.
Returns a vector at a point half way between this and the passed in vector.
double Vector3::normalise | ( | ) | [inline] |
Normalises the vector.
Vector3 Vector3::normalisedCopy | ( | void | ) | const [inline] |
As normalise, except that this vector is unaffected and the normalised vector is returned as a copy.
bool Vector3::operator< | ( | const Vector3 & | rhs | ) | const [inline] |
Returns true if the vector's scalar components are all greater that the ones of the vector it is compared against.
Assigns the value of the other vector.
rkVector | The other vector |
bool Vector3::operator> | ( | const Vector3 & | rhs | ) | const [inline] |
Returns true if the vector's scalar components are all smaller that the ones of the vector it is compared against.
Vector3 Vector3::perpendicular | ( | void | ) | const [inline] |
Generates a vector perpendicular to this vector (eg an 'up' vector).
bool Vector3::positionCloses | ( | const Vector3 & | rhs, |
double | tolerance = 1e-03f |
||
) | const [inline] |
Returns whether this vector is within a positional tolerance of another vector, also take scale of the vectors into account.
rhs | The vector to compare with |
tolerance | The amount (related to the scale of vectors) that distance of the vector may vary by and still be considered close |
bool Vector3::positionEquals | ( | const Vector3 & | rhs, |
double | tolerance = 1e-03 |
||
) | const [inline] |
Returns whether this vector is within a positional tolerance of another vector.
rhs | The vector to compare with |
tolerance | The amount that each element of the vector may vary by and still be considered equal |
Calculates a reflection vector to the plane with the given normal .
double Vector3::squaredDistance | ( | const Vector3 & | rhs | ) | const [inline] |
Returns the square of the distance to another vector.
double Vector3::squaredLength | ( | ) | const [inline] |
Returns the square of the length(magnitude) of the vector.
std::ostream& operator<< | ( | std::ostream & | o, |
const Vector3 & | v | ||
) | [friend] |
Function for writing to a stream.
const Vector3 Vector3::ZERO [static] |
Returns whether this vector is within a directional tolerance of another vector.
rhs | The vector to compare with |
tolerance | The maximum angle by which the vectors may vary and still be considered equal |