MULTIBODY SIMULATION SOFTWARE - API documentation

chrono::ChVector< Real > Class Template Reference

#include <CHvector.h>

List of all members.

Public Member Functions

 ChVector (const Real nx, const Real ny, const Real nz)
 ChVector (const ChVector< Real > &other)
template<class RealB>
 ChVector (const ChVector< RealB > &other)
ChVector< Real > & operator= (const ChVector< Real > &other)
template<class RealB>
ChVector< Real > & operator= (const ChVector< RealB > &other)
ChVector< Real > operator- () const
Real & operator() (const int el)
const Real & operator() (const int el) const
ChVector< Real > operator+ (const ChVector< Real > &other) const
ChVector< Real > & operator+= (const ChVector< Real > &other)
ChVector< Real > operator- (const ChVector< Real > &other) const
ChVector< Real > & operator-= (const ChVector< Real > &other)
ChVector< Real > operator * (const ChVector< Real > &other) const
ChVector< Real > & operator *= (const ChVector< Real > &other)
ChVector< Real > operator * (const Real v) const
ChVector< Real > & operator *= (const Real v)
ChVector< Real > operator/ (const ChVector< Real > &other) const
ChVector< Real > & operator/= (const ChVector< Real > &other)
ChVector< Real > operator/ (const Real v) const
ChVector< Real > & operator/= (const Real v)
ChVector< Real > operator% (const ChVector< Real > &other) const
ChVector< Real > & operator%= (const ChVector< Real > &other) const
double operator^ (const ChVector< Real > &other) const
bool operator<= (const ChVector< Real > &other) const
bool operator>= (const ChVector< Real > &other) const
bool operator< (const ChVector< Real > &other) const
bool operator> (const ChVector< Real > &other) const
bool operator== (const ChVector< Real > &other) const
bool operator!= (const ChVector< Real > &other) const
void Set (const Real nx, const Real ny, const Real nz)
void Set (const ChVector< Real > &p)
void Set (const Real p)
void SetNull ()
bool Equals (const ChVector< Real > &other) const
bool Equals (const ChVector< Real > &other, Real tol) const
void Add (const ChVector< Real > A, const ChVector< Real > B)
void Sub (const ChVector< Real > A, const ChVector< Real > B)
void Cross (const ChVector< Real > A, const ChVector< Real > B)
double Dot (const ChVector< Real > A, const ChVector< Real > B)
double Dot (const ChVector< Real > B)
void Mul (const ChVector< Real > A, const Real v)
void Scale (const Real v)
double Length ()
double Length2 ()
double LengthInf ()
bool Normalize ()
void SetLength (Real v)
void StreamOUT (ChStreamOutAscii &mstream)
void StreamOUT (ChStreamOutBinary &mstream)
void StreamIN (ChStreamInBinary &mstream)

Public Attributes

Real x
Real y
Real z


Detailed Description

template<class Real = double>
class chrono::ChVector< Real >

VECTOR: a class for general purpose 3d vectorial variables, such as points in 3D. It implements the vectorisl algebra in 3D (Gibbs products).

The vector object comes either with the template "ChVector<type>" mode, either in the 'shortcut' flavour, that is "Vector", which assumes the type of x,y,z is double precision, so it is faster to type. For example, for a declaration, you can write "ChVector<double> foo;", as well as "Vector foo;" (less typing effort for the second..)


Constructor & Destructor Documentation

template<class Real = double>
chrono::ChVector< Real >::ChVector ( const ChVector< Real > &  other  ) 

Copy constructor.

template<class Real = double>
template<class RealB>
chrono::ChVector< Real >::ChVector ( const ChVector< RealB > &  other  ) 

Copy constructor between vectors float<->double etc.


Member Function Documentation

template<class Real = double>
ChVector<Real>& chrono::ChVector< Real >::operator= ( const ChVector< Real > &  other  ) 

Assignment operator: copy from another vector.

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator- (  )  const

Operator for sign change.

template<class Real = double>
Real& chrono::ChVector< Real >::operator() ( const int  el  ) 

Operator for indexed access (0=x, 1=y, 2=z). Not so much performance..may be useful sometimes..

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator+ ( const ChVector< Real > &  other  )  const

Operator for vector sum.

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator- ( const ChVector< Real > &  other  )  const

Operator for vector difference.

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator * ( const ChVector< Real > &  other  )  const

Operator for element-wise multiplication (note that this is neither dot product nor cross product!)

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator * ( const Real  v  )  const

Operator for scaling the vector by a scalar value, as v*s.

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator/ ( const ChVector< Real > &  other  )  const

Operator for element-wise division (note that 3D vector algebra is a skew field, non-divisional algebra, so this division operation is just an element-by element division)

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator/ ( const Real  v  )  const

Operator for scaling the vector by inverse of a scalar value, as v/s.

template<class Real = double>
ChVector<Real> chrono::ChVector< Real >::operator% ( const ChVector< Real > &  other  )  const

Operator for cross product: AB means the vector cross-product AxB Note: pay attention to operator low precedence (see C++ precedence rules!)

template<class Real = double>
double chrono::ChVector< Real >::operator^ ( const ChVector< Real > &  other  )  const

Operator for dot product: A^B means the scalar dot-product A*B Note: pay attention to operator low precedence (see C++ precedence rules!)

template<class Real = double>
void chrono::ChVector< Real >::Set ( const Real  nx,
const Real  ny,
const Real  nz 
)

Sets the three values of the vector at once.

template<class Real = double>
void chrono::ChVector< Real >::Set ( const ChVector< Real > &  p  ) 

Sets the vector as a copy of another vector.

template<class Real = double>
void chrono::ChVector< Real >::Set ( const Real  p  ) 

Sets the vector with three components as a sample scalar.

template<class Real = double>
void chrono::ChVector< Real >::SetNull (  ) 

Sets the vector as a null vector.

template<class Real = double>
bool chrono::ChVector< Real >::Equals ( const ChVector< Real > &  other  )  const

Returns true if vector is identical to other vector.

template<class Real = double>
bool chrono::ChVector< Real >::Equals ( const ChVector< Real > &  other,
Real  tol 
) const

Returns true if vector equals another vector, within a tolerance 'tol'.

template<class Real = double>
void chrono::ChVector< Real >::Add ( const ChVector< Real >  A,
const ChVector< Real >  B 
)

The vector becomes the sum of the two vectors A and B: this=A+B

template<class Real = double>
void chrono::ChVector< Real >::Sub ( const ChVector< Real >  A,
const ChVector< Real >  B 
)

The vector becomes the difference of the two vectors A and B: this=A-B

template<class Real = double>
void chrono::ChVector< Real >::Cross ( const ChVector< Real >  A,
const ChVector< Real >  B 
)

The vector becomes the cross product of the two vectors A and B: this=AxB

template<class Real = double>
double chrono::ChVector< Real >::Dot ( const ChVector< Real >  A,
const ChVector< Real >  B 
)

Gives the dot product of the two vectors A and B:.

template<class Real = double>
double chrono::ChVector< Real >::Dot ( const ChVector< Real >  B  ) 

Gives the dot product with another vector: result=this*B

template<class Real = double>
void chrono::ChVector< Real >::Mul ( const ChVector< Real >  A,
const Real  v 
)

The vector becomes the product of a vectors A and a scalar v: this=A*v

template<class Real = double>
void chrono::ChVector< Real >::Scale ( const Real  v  ) 

The vector is multiplied by a scalar factor 's' this*=v

template<class Real = double>
double chrono::ChVector< Real >::Length (  ) 

Computes the euclidean norm of the vector, that is its length or magnitude

template<class Real = double>
double chrono::ChVector< Real >::Length2 (  ) 

Computes the euclidean norm of the vector, squared (i.e. as Length(), but skipping the square root)

template<class Real = double>
double chrono::ChVector< Real >::LengthInf (  ) 

Computes the infinite norm of the vector, that is the maximum absolute value of one of its elements

template<class Real = double>
bool chrono::ChVector< Real >::Normalize (  ) 

Normalize this vector, so that its euclidean length is 1. Returns false if original vector had zero length (in such a case it will be defaulted as VECT_X) otherwise returns true for success.

template<class Real = double>
void chrono::ChVector< Real >::SetLength ( Real  v  ) 

Impose a new length to the vector, keeping the direction unchanged.

template<class Real = double>
void chrono::ChVector< Real >::StreamOUT ( ChStreamOutAscii mstream  ) 

Method to allow serialization of transient data in ascii, as a readable item, for example "chrono::GetLog() << myobject;"

template<class Real = double>
void chrono::ChVector< Real >::StreamOUT ( ChStreamOutBinary mstream  ) 

Method to allow serializing transient data into a persistent binary archive (ex: a file).

template<class Real = double>
void chrono::ChVector< Real >::StreamIN ( ChStreamInBinary mstream  ) 

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.


CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on 17 Jul 2009 by Doxygen