BASE::RCVector Class Reference

A 3 dimensionl vector with an additional factor. More...

Inherits BASE::RCStringValueInterface.

Inheritance diagram for BASE::RCVector:

Inheritance graph
[legend]
Collaboration diagram for BASE::RCVector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RCVector ()
 RCVector (TReal nX, TReal nY, TReal nZ, TReal nW=1.0)
 RCVector (const RCTriple &Pos)
 RCVector (const TReal *naSource, TBool b3D=true)
 RCVector (const RCVector &Source)
const RCVectoroperator= (const RCVector &Source)
const TRealData () const
TRealoperator[] (TInt nIndex)
const TRealoperator[] (TInt nIndex) const
RCVector operator+ (const RCVector &rhs) const
RCVector operator- (const RCVector &rhs) const
RCVector operator * (TReal rhs) const
RCVector operator/ (TReal rhs) const
RCVector operator- () const
const RCVectoroperator+= (const RCVector &rhs)
const RCVectoroperator-= (const RCVector &rhs)
const RCVectoroperator *= (TReal rhs)
const RCVectoroperator/= (TReal rhs)
TBool IsZero () const
TReal DotProduct (const RCVector &rhs) const
RCVector CrossProduct (const RCVector &rhs) const
TBool IsDirection () const
TBool IsUnfactorized () const
void Unfactorize ()
RCVector Unfactorized () const
void Normalize ()
RCVector Normalized () const
TReal Length () const
virtual TBool FromString (const RCString &sValue)
virtual const RCStringToString () const

Static Public Attributes

static const RCVector INFINITE
static const RCVector ZERO

Detailed Description

A 3 dimensionl vector with an additional factor.

Author:
Patrik Stellmann
The 4th value is used for scaling the oher 3 values. To get the correct values for x, y and z these values must be devided by the 4th value. Thus a 4th value of 0 means the vector points to infinite and represents a direction rather than a position. If the vector is fectorizes this means the 4th element is not equal 1.


Constructor & Destructor Documentation

RCVector::RCVector  )  [inline]
 

Creates an unfactorized zero vector.

RCVector::RCVector TReal  nX,
TReal  nY,
TReal  nZ,
TReal  nW = 1.0
[inline]
 

Creates a vector with the specified values.

RCVector::RCVector const TReal naSource,
TBool  b3D = true
[inline, explicit]
 

Creates a vector with the values stored in the specified array. If b3D is true the array is expected to hold at least 3 values and the 4th will be set to 1. Otherwise 4 values are copied from the array.

RCVector::RCVector const RCVector Source  )  [inline]
 

Creates a copy of the specified vector.


Member Function Documentation

RCVector RCVector::CrossProduct const RCVector rhs  )  const [inline]
 

Returns the crossproduct of this and the specified vector. Neither vector needs to be factorized but if either this or the specified vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown. The result is always unfactorized.

const TReal * RCVector::Data  )  const [inline]
 

Returns a constant pointer to the internally stored data containing 4 values.

TReal RCVector::DotProduct const RCVector rhs  )  const [inline]
 

Returns the dotproduct of this and the specified vector. Neither vector needs to be factorized but if either this or the specified vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown.

TBool RCVector::IsDirection  )  const [inline]
 

Returns true if this vector represents a direction, that is, if the 4th element is zero.

TReal RCVector::Length  )  const [inline]
 

Returns the length of this vector, that is, the euclid norm of the first 3 elements devided by the 4th. If this vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown.

void RCVector::Normalize  )  [inline]
 

Normalizes this vector, that is, scales the elements that way that the lenght of the vector becomes 1. If this vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown. If this vector is no direction teh result will also be unfactorized.

RCVector RCVector::Normalized  )  const [inline]
 

Returns a copy of this vector that is normalized.

RCVector RCVector::operator * TReal  rhs  )  const [inline]
 

Returns a copy of this vector multiplied by the specified factor. In general the result is factorized.

const RCVector & RCVector::operator *= TReal  rhs  )  [inline]
 

Multiplies this vector by the specified value. In general the result is factorized.

RCVector RCVector::operator+ const RCVector rhs  )  const [inline]
 

Returns a vector that is the sum of this and the specified one. The result is always unfactorizes. If either this or the specified vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown.

const RCVector & RCVector::operator+= const RCVector rhs  )  [inline]
 

Adds the specified vector to this one. The result is always unfactorized. If either this or the specified vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown.

RCVector RCVector::operator-  )  const [inline]
 

Returns a copy of this vector with negated elements.

RCVector RCVector::operator- const RCVector rhs  )  const [inline]
 

Returns a vector that is the difference of this and the specified one. The result is always unfactorizes. If either this or the specified vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown.

const RCVector & RCVector::operator-= const RCVector rhs  )  [inline]
 

Subtracts the specified vector fromthis one. The result is always unfactorized. If either this or the specified vector is a direction an assertion will occure in debug version. In realease version an exception (division by zero) is thrown.

RCVector RCVector::operator/ TReal  rhs  )  const [inline]
 

Returns a copy of this vector multiplied by the specified factor. In general the result is factorized. Calling the operator with 0 as argument will result in a vector pointing in the same direction as this vector does but with infinite length.

const RCVector & RCVector::operator/= TReal  rhs  )  [inline]
 

Devides this vector by the specified value. In general the result is factorized. Calling the function with 0 as argument will result in a vector pointing in the same direction as before but with infinite length.

const RCVector & RCVector::operator= const RCVector Source  )  [inline]
 

Assigns the specifed vextor to this one.

const TReal & RCVector::operator[] TInt  nIndex  )  const [inline]
 

Returns a constant reference to the nIndex'th element of the vector. The index needs to be less than 4.

TReal & RCVector::operator[] TInt  nIndex  )  [inline]
 

Returns a reference to the nIndex'th element of the vector. The index needs to be less than 4.

void RCVector::Unfactorize  )  [inline]
 

Unfactorizes this vector by deviding the first 3 elements by the 4th. If this vector is a direction the function will scale the elements that way that the element with highest norm will be TRealMax (or TRealMin for negative values). In both cases the 4th element will be set to 1 and thus the vector is unfactorized.


The documentation for this class was generated from the following files:
Generated on Thu Feb 16 12:46:18 2006 for Simulator Bob by  doxygen 1.4.6-NO