VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
DtVector Class Reference

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
DtVectoroperator= (const DtVector &vec)
 assignment operator
void setToZero ()
 set Vector to all zeros
DtVectoroperator+= (const DtVector &other)
 adds other to this vector
DtVectoroperator-= (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 DtVectorzero ()
 Get a zeroed vector.
static const DtVectori ()
 Get a (1,0,0) vector.
static const DtVectorj ()
 Get a (0,1,0) vector.
static const DtVectork ()
 Get a (0,0,1) vector.
static const DtVectorones ()
 Get a vector set to all ones.

Protected Attributes

double myRep [3]

Detailed Description

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.

Constructor & Destructor Documentation

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

Member Function Documentation

bool DtVector::approxEq ( const DtVector v,
const double &  tolerance 
) const

check if the vector is zero-ed out withing the tolerance passed

DtVector DtVector::crossProduct ( const DtVector v) const

Compute cross product with another vector.

double DtVector::dotProduct ( const DtVector v) const

Compute dot product with another vector.

static const DtVector& DtVector::i ( )
static

Get a (1,0,0) vector.

bool DtVector::isNormalized ( ) const

Returns true of the vector is Normalized.

static const DtVector& DtVector::j ( )
static

Get a (0,1,0) vector.

static const DtVector& DtVector::k ( )
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 const DtVector& DtVector::ones ( )
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

DtVector& DtVector::operator+= ( const DtVector other)

adds other to this vector

DtVector& DtVector::operator-= ( const DtVector other)

subtracts other from this vector (this - other)

DtVector& DtVector::operator= ( const DtVector vec)

assignment operator

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 const DtVector& DtVector::zero ( )
static

Get a zeroed vector.

Member Data Documentation

double DtVector::myRep[3]
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Wed Jan 7 13:31:29 EST 2015 from SVN revision 149162
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)