VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes
DtVectorT< T > Class Template Reference

DtVectors represent vectors in 3-d space, X, Y, Z. More...

+ Inheritance diagram for DtVectorT< T >:
+ Collaboration diagram for DtVectorT< T >:

Public Member Functions

 DtVectorT ()
 
 DtVectorT (const T &x, const T &y, const T &z)
 Construct from three doubles. More...
 
 ~DtVectorT ()
 destructor More...
 
 DtVectorT (const DtVectorT< T > &vec)
 copy constructor More...
 
DtVectorT< T > & operator= (const DtVectorT< T > &vec)
 assignment operator More...
 
void setToZero ()
 set Vector to all zeros More...
 
T & operator[] (int ind)
 Get the value for the specified subscript. (int version) More...
 
operator[] (int ind) const
 A const version to get the value for the specified subscript. More...
 
T & operator[] (DtVectorOffset ind)
 Get the value for the specified subscript. (enum version) More...
 
operator[] (DtVectorOffset ind) const
 a const version to get the value for the specified subscript. (enum version) More...
 
int operator== (const DtVectorT< T > &vec) const
 Get whether another vector equals this vector. More...
 
int operator!= (const DtVectorT< T > &vec) const
 Get whether another vector does not equal this vector. More...
 
DtString string () const
 Get a string representation of the vector. More...
 
double magnitudeSquared () const
 Get the magnitude of the vector squared, i.e. More...
 
void normalize ()
 Normalize the vector; i.e., magnitude = 1. More...
 
bool isNormalized () const
 Returns true of the vector is Normalized. More...
 
bool magnitudeIsZero () const
 check if the magnitude of this vector is zero More...
 
bool magnitudeIsZero (double tolerance) const
 check if the magnitude of this vector is zero, within the tolerance passed. More...
 
std::ostream & printDataToStream (std::ostream &str) const
 prints out a formated string to the stream More...
 
void get (T &x, T &y, T &z) const
 get the x,y,z component of a Vector (faster than x(), y(), z() calls made separately) More...
 
void setAll (const T &x, const T &y, const T &z)
 set x, y, and z components More...
 
const T & x () const
 gets/sets the x component of a Vector More...
 
void setX (const T &x)
 gets/sets the x component of a Vector More...
 
const T & y () const
 gets/sets the y component of a Vector More...
 
void setY (const T &y)
 gets/sets the y component of a Vector More...
 
const T & z () const
 gets/sets the z component of a Vector More...
 
void setZ (const T &z)
 gets/sets the z component of a Vector More...
 
These functions reveal the internal representation of DtVector

and should not be used.

They are provided for backwards compatibility

 operator T * ()
 
 operator const T * () const
 

Protected Attributes

myRep [3]
 

Detailed Description

template<typename T>
class DtVectorT< T >

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 (or 3*4 for DtVector32) 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

template<typename T>
DtVectorT< T >::DtVectorT ( )
inline
template<typename T>
DtVectorT< T >::DtVectorT ( const T &  x,
const T &  y,
const T &  z 
)
inline

Construct from three doubles.

template<typename T>
DtVectorT< T >::~DtVectorT ( )
inline

destructor

template<typename T>
DtVectorT< T >::DtVectorT ( const DtVectorT< T > &  vec)
inline

copy constructor

Member Function Documentation

template<typename T>
void DtVectorT< T >::get ( T &  x,
T &  y,
T &  z 
) const
inline

get the x,y,z component of a Vector (faster than x(), y(), z() calls made separately)

template<typename T>
bool DtVectorT< T >::isNormalized ( ) const
inline

Returns true of the vector is Normalized.

template<typename T>
bool DtVectorT< T >::magnitudeIsZero ( ) const
inline

check if the magnitude of this vector is zero

template<typename T>
bool DtVectorT< T >::magnitudeIsZero ( double  tolerance) const
inline

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.

template<typename T>
double DtVectorT< T >::magnitudeSquared ( ) const
inline

Get the magnitude of the vector squared, i.e.

x^2 + y^2 + z^2

template<typename T>
void DtVectorT< T >::normalize ( )
inline

Normalize the vector; i.e., magnitude = 1.

template<typename T>
DtVectorT< T >::operator const T * ( ) const
inline
template<typename T>
DtVectorT< T >::operator T * ( )
inline
template<typename T>
int DtVectorT< T >::operator!= ( const DtVectorT< T > &  vec) const
inline

Get whether another vector does not equal this vector.

Warning: this operation calls operator== which tests floats for exact equality

template<typename T>
DtVectorT<T>& DtVectorT< T >::operator= ( const DtVectorT< T > &  vec)
inline

assignment operator

template<typename T>
int DtVectorT< T >::operator== ( const DtVectorT< T > &  vec) const
inline

Get whether another vector equals this vector.

Warning: This operation compares floats of exact equality.

template<typename T>
T& DtVectorT< T >::operator[] ( int  ind)
inline

Get the value for the specified subscript. (int version)

template<typename T>
T DtVectorT< T >::operator[] ( int  ind) const
inline

A const version to get the value for the specified subscript.

template<typename T>
T& DtVectorT< T >::operator[] ( DtVectorOffset  ind)
inline

Get the value for the specified subscript. (enum version)

template<typename T>
T DtVectorT< T >::operator[] ( DtVectorOffset  ind) const
inline

a const version to get the value for the specified subscript. (enum version)

template<typename T>
std::ostream& DtVectorT< T >::printDataToStream ( std::ostream &  str) const
inline

prints out a formated string to the stream

template<typename T>
void DtVectorT< T >::setAll ( const T &  x,
const T &  y,
const T &  z 
)
inline

set x, y, and z components

template<typename T>
void DtVectorT< T >::setToZero ( )
inline

set Vector to all zeros

template<typename T>
void DtVectorT< T >::setX ( const T &  x)
inline

gets/sets the x component of a Vector

Referenced by DtGeocentricToMgFlatEarth().

template<typename T>
void DtVectorT< T >::setY ( const T &  y)
inline

gets/sets the y component of a Vector

Referenced by DtGeocentricToMgFlatEarth().

template<typename T>
void DtVectorT< T >::setZ ( const T &  z)
inline

gets/sets the z component of a Vector

Referenced by DtGeocentricToMgFlatEarth().

template<typename T>
DtString DtVectorT< T >::string ( ) const
inline

Get a string representation of the vector.

template<typename T>
const T& DtVectorT< T >::x ( ) const
inline

gets/sets the x component of a Vector

template<typename T>
const T& DtVectorT< T >::y ( ) const
inline

gets/sets the y component of a Vector

template<typename T>
const T& DtVectorT< T >::z ( ) const
inline

gets/sets the z component of a Vector

Member Data Documentation

template<typename T>
T DtVectorT< T >::myRep[3]
protected

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

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)