#include <math.h>
Represents a 3D vector or point with S56E11 floating point elements.
Public Member Functions | |
DblVector (void) throw () | |
Constructs the vector with zero values. More... | |
Vector | Vec () const |
DblVector (double fX, double fY, double fZ=0.0) throw () | |
Constructs the vector with specified values. More... | |
DblVector (const DblVector &vVector) throw () | |
Copy constructor. More... | |
DblVector (const Vector &vVector) throw () | |
constructor from single precision vector. More... | |
DblVector (const char *pVector) throw () | |
Construct the vector from a pointer to 8bit signed data. More... | |
DblVector (const short *pVector) throw () | |
Construct the vector from a pointer to 16bit signed data. More... | |
DblVector & | Set (double fX, double fY, double fZ) throw () |
Sets the values of the vector elements and returns the vector. More... | |
DblVector & | Clear (void) throw () |
Zeros all the components of the Vector, then returns it. More... | |
DblVector & | Normalize (void) throw () |
Normalizes the vector and returns it. More... | |
DblVector | Normalized (void) const throw () |
Returns a normalized version of the vector, without changing this vector. More... | |
DblVector & | MakeOrthogonal (const DblVector &vBase) |
Makes this vector orthogonal to the given vBase vector and normalizes it. More... | |
DblVector & | SetLength (double fLength) |
Sets the vector to the given length, without changing its direction. More... | |
double | LengthSquare (void) const |
Returns the square of the length of the DblVector. More... | |
double | Length () const throw () |
Returns the length of the DblVector. More... | |
double | Length2D () const throw () |
Returns the 2D length of the DblVector, ignoring the z element. More... | |
double | DistanceFrom (const DblVector &v) const |
Returns the distance between two points (this and another, represented as DblVector objects). More... | |
double | DistanceFromLine (const DblVector &v0, const DblVector &v1) const |
Returns the shortest distance between this point and a line defined by two other points (all points represented by DblVector objects). More... | |
double | DistanceFromSegment (const DblVector &v0, const DblVector &v1) const |
Returns the distance between this point and a line segment defined by the two ending points. More... | |
double | AngleCos (const DblVector &v1) const throw () |
Returns the cosine of the angle between this vector and the one passed in. More... | |
DblVector | Minimum (const DblVector &o) |
Returns the minimum of this and the argument vector. More... | |
DblVector | Maximum (const DblVector &o) |
Returns the maximum of this and the argument vector. More... | |
DblVector | operator- (void) const throw () |
Returns the inverse of the vector. More... | |
DblVector | operator+ (double f) const throw () |
Returns the sum of a vector and a scalar. More... | |
DblVector | operator+ (const DblVector &v) const throw () |
Returns the sum of two vectors. More... | |
DblVector | operator- (const DblVector &v) const throw () |
Returns the difference between two DblVectors/points. More... | |
DblVector | operator* (const DblVector &v) const throw () |
Returns the product of two DblVectors by components. More... | |
DblVector | operator* (double f) const throw () |
Returns the product of the DblVector and a scalar. More... | |
DblVector | operator/ (const DblVector &v) const throw () |
Returns the quotient of two DblVectors by components. More... | |
DblVector | operator/ (double f) const throw () |
Returns the quotient of a DblVector and a scalar. More... | |
DblVector | operator* (int i) const throw () |
Returns the product of a DblVector and an integer. More... | |
DblVector | operator/ (int i) const throw () |
Returns the quotient of a DblVector and an integer. More... | |
DblVector | operator/ (unsigned int i) const throw () |
Returns the quotient of a DblVector and an unsigned integer. More... | |
double | operator| (const DblVector &v) const throw () |
Returns the dot product of two DblVectors. More... | |
DblVector | operator& (const DblVector &v) const |
Returns the cross product of two DblVectors. More... | |
bool | operator== (const DblVector &v) const throw () |
Returns true if the two DblVectors are identical, false otherwise. More... | |
bool | operator!= (const DblVector &v) const throw () |
Returns true if the two DblVectors are different, false otherwise. More... | |
operator bool (void) const throw () | |
Returns true if the DblVector is not a zero DblVector, false otherwise. More... | |
bool | operator! (void) const throw () |
Returns true if the DblVector is a zero DblVector, false otherwise. More... | |
DblVector & | operator= (const DblVector &v) |
Sets this DblVector to equal another one and returns it. More... | |
DblVector & | operator<< (const DblVector &v) |
Sets this DblVector to equal another one and returns it. More... | |
DblVector & | operator-= (const DblVector &v) throw () |
Subtracts the component values of another DblVector from this one's, and returns the result. More... | |
DblVector & | operator+= (const DblVector &v) throw () |
Adds another DblVector to this one and returns the result. More... | |
DblVector & | operator*= (double f) |
Multiplies the components of the DblVector with a scalar value and returns the result. More... | |
DblVector & | operator*= (const DblVector &v) |
Multiplies the DblVector with another DblVector by components and returns the result. More... | |
DblVector & | operator/= (double f) |
Divides the DblVector by a scalar and returns the result. More... | |
double & | operator[] (int i) throw () |
Returns a individual components of the DblVector. More... | |
double & | operator[] (unsigned int i) throw () |
Returns a component of the DblVector. More... | |
operator const double * (void) const | |
Returns a pointer to the data of the DblVector. Do not delete this pointer. More... | |
Public Attributes | |
union { | |
struct { | |
double m_fX | |
double m_fY | |
double m_fZ | |
} | |
struct { | |
double x | |
double y | |
double z | |
} | |
double m_aCoors [3] | |
}; | |
|
inline |
|
inline |
|
inline |
|
inline |
Zeros all the components of the Vector, then returns it.
Definition at line 387 of file math.h.
Normalizes the vector and returns it.
If the vector is zero length, it is set to (0,1,0)
Returns a normalized version of the vector, without changing this vector.
Makes this vector orthogonal to the given vBase vector and normalizes it.
Returns the vector.
The resulting vector will lie on the plane defined by the original value of this vector, and vBase.
|
inline |
Sets the vector to the given length, without changing its direction.
If the vector is of zero length, then it is arbitrarily made parallel to the Y axis.
Definition at line 410 of file math.h.
|
inline |
double Length | ( | ) | const | |
throw | ( | |||
) |
Returns the length of the DblVector.
double Length2D | ( | ) | const | |
throw | ( | |||
) |
Returns the 2D length of the DblVector, ignoring the z element.
|
inline |
Returns the distance between two points (this and another, represented as DblVector objects).
Definition at line 425 of file math.h.
Returns the shortest distance between this point and a line defined by two other points (all points represented by DblVector objects).
Returns the distance between this point and a line segment defined by the two ending points.
|
inline |
Returns the cosine of the angle between this vector and the one passed in.
Definition at line 437 of file math.h.
Returns the minimum of this and the argument vector.
Minimums are calculated individually for z, y, and z.
Definition at line 442 of file math.h.
Returns the maximum of this and the argument vector.
Maximums are calculated individually for z, y, and z.
Definition at line 447 of file math.h.
Returns the inverse of the vector.
Definition at line 451 of file math.h.
|
inline |
Returns the sum of a vector and a scalar.
(The scalar is added to each component individually).
Definition at line 456 of file math.h.
Returns the sum of two vectors.
Definition at line 460 of file math.h.
Returns the difference between two DblVectors/points.
Definition at line 464 of file math.h.
Returns the product of two DblVectors by components.
Definition at line 468 of file math.h.
|
inline |
Returns the product of the DblVector and a scalar.
Definition at line 472 of file math.h.
Returns the quotient of two DblVectors by components.
Definition at line 476 of file math.h.
|
inline |
Returns the quotient of a DblVector and a scalar.
Definition at line 480 of file math.h.
Returns the product of a DblVector and an integer.
Definition at line 484 of file math.h.
Returns the quotient of a DblVector and an integer.
Definition at line 488 of file math.h.
Returns the quotient of a DblVector and an unsigned integer.
Definition at line 492 of file math.h.
|
inline |
Returns the cross product of two DblVectors.
Definition at line 500 of file math.h.
|
inline |
Returns true if the two DblVectors are different, false otherwise.
Definition at line 515 of file math.h.
|
inline |
|
inline |
|
inline |
|
inline |
Divides the DblVector by a scalar and returns the result.
Definition at line 551 of file math.h.
|
inline |
|
inline |
|
inline |
union { ... } |