GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
gear::Vector3D Class Reference

Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coordinate systems - internal reperesentation is cartesian. More...

#include <Vector3D.h>

Classes

struct  Cartesian
 
struct  Cylindrical
 
struct  Spherical
 

Public Member Functions

 Vector3D ()
 Default c'tor - zero vector.
 
 Vector3D (const float *v)
 Constructor for float array. More...
 
 Vector3D (const double *v)
 Constructor for double array. More...
 
template<class T >
 Vector3D (double x, double y, double z, T(&)())
 Templated c'tor - allows to have overloaded c'tors for different coordinates.
 
 Vector3D (double xx, double yy, double zz)
 Default corrdinate system for initialization is cartesian.
 
template<class T >
 Vector3D (const T &t)
 Copy c'tor for three vectors from other packages - requires T::x(),T::y(), T::z().
 
double x () const
 Cartesian x coordinate.
 
double y () const
 Cartesian y coordinate.
 
double z ()
 Cartesian cartesian z coordinate.
 
double x ()
 Assign to cartesian x coordinate.
 
double y ()
 Assign to cartesian y coordinate.
 
double z () const
 Assign to cartesian z coordinate.
 
double operator[] (int i) const
 Accessing x,y,z with bracket operator.
 
double & operator[] (int i)
 Accessing x,y,z with bracket operator for assignment.
 
double phi () const
 Azimuthal angle - cylindrical and spherical.
 
double rho () const
 Transversal component - cylindrical 'r'.
 
double trans () const
 Transversal component.
 
double trans2 () const
 Transversal component squared.
 
double r () const
 Spherical r/magnitude.
 
double r2 () const
 Spherical r/magnitude, squared.
 
double theta () const
 Polar angle - spherical.
 
double dot (const Vector3D &v)
 Scalar product.
 
Vector3D cross (const Vector3D &v)
 Vector product.
 
Vector3D unit ()
 Parallel unit vector.
 
template<class T >
 operator T ()
 Implicit templated conversion to anything that has a c'tor T(x,y,z) and accessor functions x(),y(),z(). More...
 
template<class T >
to ()
 Explicit, unchecked conversion to anything that has a c'tor T(x,y,z). More...
 
template<>
 Vector3D (double xx, double yy, double zz, Vector3D::Cartesian(&)())
 Cartesian c'tor - example:
Vector3D v( x, y, c , Vector3D::cartesian ) ;. More...
 

Static Public Member Functions

static Cartesian cartesian ()
 
static Cylindrical cylindrical ()
 
static Spherical spherical ()
 

Protected Attributes

double _x =0
 
double _y =0
 
double _z =0
 

Detailed Description

Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coordinate systems - internal reperesentation is cartesian.

Author
F. Gaede, DESY
Version
$Id$

Definition at line 18 of file Vector3D.h.

Constructor & Destructor Documentation

gear::Vector3D::Vector3D ( const float *  v)
inline

Constructor for float array.

Definition at line 27 of file Vector3D.h.

gear::Vector3D::Vector3D ( const double *  v)
inline

Constructor for double array.

Definition at line 30 of file Vector3D.h.

gear::Vector3D::Vector3D ( double  xx,
double  yy,
double  zz,
Vector3D::  Cartesian&)( 
)
inline

Cartesian c'tor - example:
Vector3D v( x, y, c , Vector3D::cartesian ) ;.

Spherical c'tor - example:
Vector3D v( r, phi, theta , Vector3D::spherical ) ;.

Cylindrical c'tor - example:
Vector3D v( rho, phi, z , Vector3D::cylindrical ) ;.

Definition at line 237 of file Vector3D.h.

Member Function Documentation

template<class T >
gear::Vector3D::operator T ( )
inline

Implicit templated conversion to anything that has a c'tor T(x,y,z) and accessor functions x(),y(),z().

For safety the result is checked which causes a small performance penalty.

See Also
to()

Definition at line 165 of file Vector3D.h.

template<class T >
T gear::Vector3D::to ( )
inline

Explicit, unchecked conversion to anything that has a c'tor T(x,y,z).

Example: CLHEP::Vector3D clhv = v.to< CLHEP::Vector3D>() ;

See Also
operator T()

Definition at line 183 of file Vector3D.h.


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