![]() |
VR-Link API Documentation for HLA 1516
|
DtVectors represent vectors in 3-d space, X, Y, Z. More...
Inheritance diagram for DtVector:
Collaboration diagram for DtVector:Public Member Functions | |
| DtVector () | |
| DtVector (const double &x, const double &y, const double &z) | |
| Construct from three doubles. | |
| ~DtVector () | |
| destructor | |
| DtVector (const DtVector &vec) | |
| copy constructor | |
| DtVector & | operator= (const DtVector &vec) |
| assignment operator | |
| void | setToZero () |
| set Vector to all zeros | |
| DtVector & | operator+= (const DtVector &other) |
| adds other to this vector | |
| DtVector & | operator-= (const DtVector &other) |
| subtracts other from this vector (this - other) | |
| double & | operator[] (int ind) |
| Get the value for the specified subscript. (int version) | |
| double | operator[] (int ind) const |
| A const version to get the value for the specified subscript. | |
| double & | operator[] (DtVectorOffset ind) |
| Get the value for the specified subscript. (enum version) | |
| double | operator[] (DtVectorOffset ind) const |
| a const version to get the value for the specified subscript. (enum version) | |
| int | operator== (const DtVector &vec) const |
| Get whether another vector equals this vector. | |
| int | operator!= (const DtVector &vec) const |
| Get whether another vector does not equal this vector. | |
| DtString | string () const |
| Get a string representation of the vector. | |
| double | magnitudeSquared () const |
| Get the magnitude of the vector squared, i.e. | |
| void | normalize () |
| Normalize the vector; i.e., magnitude = 1. | |
| bool | isNormalized () const |
| Returns true of the vector is Normalized. | |
| DtVector | crossProduct (const DtVector &v) const |
| Compute cross product with another vector. | |
| double | dotProduct (const DtVector &v) const |
| Compute dot product with another vector. | |
| bool | approxEq (const DtVector &v, const double &tolerance) const |
| check if the vector is zero-ed out withing the tolerance passed | |
| bool | magnitudeIsZero () const |
| check if the magnitude of this vector is zero | |
| bool | magnitudeIsZero (double tolerance) const |
| check if the magnitude of this vector is zero, within the tolerance passed. | |
| std::ostream & | printDataToStream (std::ostream &str) const |
| prints out a formated string to the stream | |
| const double & | x () const |
| gets/sets the x component of a Vector | |
| void | setX (const double &x) |
| gets/sets the x component of a Vector | |
| const double & | y () const |
| gets/sets the y component of a Vector | |
| void | setY (const double &y) |
| gets/sets the y component of a Vector | |
| const double & | z () const |
| gets/sets the z component of a Vector | |
| void | setZ (const double &z) |
| gets/sets the z component of a Vector | |
These functions reveal the internal representation of DtVector | |
and should not be used. They are provided for backwards compatibility | |
| operator double * () | |
| operator const double * () const | |
Static Public Member Functions | |
| static const DtVector & | zero () |
| Get a zeroed vector. | |
| static const DtVector & | i () |
| Get a (1,0,0) vector. | |
| static const DtVector & | j () |
| Get a (0,1,0) vector. | |
| static const DtVector & | k () |
| Get a (0,0,1) vector. | |
| static const DtVector & | ones () |
| Get a vector set to all ones. | |
Protected Attributes | |
| double | myRep [3] |
DtVectors represent vectors in 3-d space, X, Y, Z.
A DtVector is not a point. This class has no virtual functions, because we want the size of a DtVector to 3 * 8 bytes - so that you can make the same assumptions about it that we used to make about its size and layout. This is especially important in DtDcm, where we use an array of 3 DtVectors as the myRep. If DtVector had any virtual functions, there would be 4 bytes between vector reps.
| DtVector::DtVector | ( | ) |
| DtVector::DtVector | ( | const double & | x, |
| const double & | y, | ||
| const double & | z | ||
| ) |
Construct from three doubles.
| DtVector::~DtVector | ( | ) |
destructor
| DtVector::DtVector | ( | const DtVector & | vec | ) |
copy constructor
check if the vector is zero-ed out withing the tolerance passed
Compute cross product with another vector.
| double DtVector::dotProduct | ( | const DtVector & | v | ) | const |
Compute dot product with another vector.
|
static |
Get a (1,0,0) vector.
| bool DtVector::isNormalized | ( | ) | const |
Returns true of the vector is Normalized.
|
static |
Get a (0,1,0) vector.
|
static |
Get a (0,0,1) vector.
| bool DtVector::magnitudeIsZero | ( | ) | const |
check if the magnitude of this vector is zero
| bool DtVector::magnitudeIsZero | ( | double | tolerance | ) | const |
check if the magnitude of this vector is zero, within the tolerance passed.
This tolerance is compared against each component of the vector, not the magnitude.
| double DtVector::magnitudeSquared | ( | ) | const |
Get the magnitude of the vector squared, i.e.
x^2 + y^2 + z^2
| void DtVector::normalize | ( | ) |
Normalize the vector; i.e., magnitude = 1.
|
static |
Get a vector set to all ones.
| DtVector::operator const double * | ( | ) | const |
| DtVector::operator double * | ( | ) |
| int DtVector::operator!= | ( | const DtVector & | vec | ) | const |
Get whether another vector does not equal this vector.
Warning: this operation calls operator== which tests floats for exact equality
subtracts other from this vector (this - other)
| int DtVector::operator== | ( | const DtVector & | vec | ) | const |
Get whether another vector equals this vector.
Warning: This operation compares floats of exact equality.
| double& DtVector::operator[] | ( | int | ind | ) |
Get the value for the specified subscript. (int version)
| double DtVector::operator[] | ( | int | ind | ) | const |
A const version to get the value for the specified subscript.
| double& DtVector::operator[] | ( | DtVectorOffset | ind | ) |
Get the value for the specified subscript. (enum version)
| double DtVector::operator[] | ( | DtVectorOffset | ind | ) | const |
a const version to get the value for the specified subscript. (enum version)
| std::ostream& DtVector::printDataToStream | ( | std::ostream & | str | ) | const |
prints out a formated string to the stream
Reimplemented in DtGeodeticCoord.
| void DtVector::setToZero | ( | ) |
set Vector to all zeros
| void DtVector::setX | ( | const double & | x | ) |
gets/sets the x component of a Vector
Referenced by DtGeocentricToMgFlatEarth().
| void DtVector::setY | ( | const double & | y | ) |
gets/sets the y component of a Vector
Referenced by DtGeocentricToMgFlatEarth().
| void DtVector::setZ | ( | const double & | z | ) |
gets/sets the z component of a Vector
Referenced by DtGeocentricToMgFlatEarth().
| DtString DtVector::string | ( | ) | const |
Get a string representation of the vector.
| const double& DtVector::x | ( | ) | const |
gets/sets the x component of a Vector
| const double& DtVector::y | ( | ) | const |
gets/sets the y component of a Vector
| const double& DtVector::z | ( | ) | const |
gets/sets the z component of a Vector
|
static |
Get a zeroed vector.
|
protected |