DD4hep  01.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
dd4hep::rec::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. More...
 
 Vector3D (const Vector3D &v)
 Copy constructor. More...
 
 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. More...
 
 Vector3D (double x_val, double y_val, double z_val)
 Default corrdinate system for initialization is cartesian. More...
 
Vector3Doperator= (const Vector3D &v)
 Copy c'tor for three vectors from other packages - requires T::x(),T::y(), T::z(). More...
 
template<class T >
const Vector3Dfill (const T &v)
 fill vector from arbitrary class that defines operator[] More...
 
const Vector3Dfill (const double *v)
 fill vector from double array More...
 
const Vector3Dfill (double x_val, double y_val, double z_val)
 fill from double values More...
 
double x () const
 Cartesian x coordinate. More...
 
double y () const
 Cartesian y coordinate. More...
 
double z () const
 Cartesian cartesian z coordinate. More...
 
double & x ()
 Assign to cartesian x coordinate. More...
 
double & y ()
 Assign to cartesian y coordinate. More...
 
double & z ()
 Assign to cartesian z coordinate. More...
 
double operator[] (int i) const
 Accessing x,y,z with bracket operator. More...
 
double & operator[] (int i)
 Accessing x,y,z with bracket operator for assignment. More...
 
double phi () const
 Azimuthal angle - cylindrical and spherical. More...
 
double rho () const
 Transversal component - cylindrical 'r'. More...
 
double trans () const
 Transversal component. More...
 
double trans2 () const
 Transversal component squared. More...
 
double r () const
 Spherical r/magnitude. More...
 
double r2 () const
 Spherical r/magnitude, squared. More...
 
double theta () const
 Polar angle - spherical. More...
 
double dot (const Vector3D &v) const
 Scalar product. More...
 
Vector3D cross (const Vector3D &v) const
 Vector product. More...
 
Vector3D unit () const
 Parallel unit vector. More...
 
 operator const double * () const
 direct access to data as const double* More...
 
const double * const_array () const
 direct access to data as const double* More...
 
double * array ()
 direct access to data as double* - allows modification More...
 
bool isEqual (const Vector3D &b, double epsilon=1e-6)
 Component wise comparison of two vectors - true if all components differ less than epsilon. More...
 
template<class T >
to () const
 Implicit templated conversion to anything that has a c'tor T(x,y,z) and accessor functions x(),y(),z(). More...
 
template<>
 Vector3D (double x_val, double y_val, double z_val, 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
 
double _y
 
double _z
 

Detailed Description

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

(copy of original version from gear).

Author
F. Gaede, DESY
Version
$Id$
Date
Apr 6 2014

Definition at line 32 of file Vector3D.h.

Constructor & Destructor Documentation

dd4hep::rec::Vector3D::Vector3D ( )
inline

Default c'tor - zero vector.

Definition at line 37 of file Vector3D.h.

Referenced by cross(), and unit().

dd4hep::rec::Vector3D::Vector3D ( const Vector3D v)
inline

Copy constructor.

Definition at line 41 of file Vector3D.h.

dd4hep::rec::Vector3D::Vector3D ( const float *  v)
inline

Constructor for float array.

Definition at line 44 of file Vector3D.h.

dd4hep::rec::Vector3D::Vector3D ( const double *  v)
inline

Constructor for double array.

Definition at line 47 of file Vector3D.h.

template<class T >
dd4hep::rec::Vector3D::Vector3D ( double  x,
double  y,
double  z,
T(&)()   
)

Templated c'tor - allows to have overloaded c'tors for different coordinates.

dd4hep::rec::Vector3D::Vector3D ( double  x_val,
double  y_val,
double  z_val 
)
inline

Default corrdinate system for initialization is cartesian.

Definition at line 56 of file Vector3D.h.

dd4hep::rec::Vector3D::Vector3D ( double  x_val,
double  y_val,
double  z_val,
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 326 of file Vector3D.h.

Member Function Documentation

double* dd4hep::rec::Vector3D::array ( )
inline
static Cartesian dd4hep::rec::Vector3D::cartesian ( )
inlinestatic

Definition at line 277 of file Vector3D.h.

const double* dd4hep::rec::Vector3D::const_array ( ) const
inline
Vector3D dd4hep::rec::Vector3D::cross ( const Vector3D v) const
inline
static Cylindrical dd4hep::rec::Vector3D::cylindrical ( )
inlinestatic
double dd4hep::rec::Vector3D::dot ( const Vector3D v) const
inline

Scalar product.

Definition at line 185 of file Vector3D.h.

References _x, _y, _z, x(), y(), and z().

Referenced by dd4hep::rec::operator*().

template<class T >
const Vector3D& dd4hep::rec::Vector3D::fill ( const T &  v)
inline

fill vector from arbitrary class that defines operator[]

Definition at line 82 of file Vector3D.h.

References _x, _y, and _z.

Referenced by dd4hep::rec::Surface::getLines(), and dd4hep::rec::Surface::initialize().

const Vector3D& dd4hep::rec::Vector3D::fill ( const double *  v)
inline

fill vector from double array

Definition at line 89 of file Vector3D.h.

References _x, _y, and _z.

const Vector3D& dd4hep::rec::Vector3D::fill ( double  x_val,
double  y_val,
double  z_val 
)
inline

fill from double values

Definition at line 96 of file Vector3D.h.

References _x, _y, and _z.

bool dd4hep::rec::Vector3D::isEqual ( const Vector3D b,
double  epsilon = 1e-6 
)
inline

Component wise comparison of two vectors - true if all components differ less than epsilon.

Definition at line 222 of file Vector3D.h.

References x(), y(), and z().

dd4hep::rec::Vector3D::operator const double * ( ) const
inline

direct access to data as const double*

Definition at line 207 of file Vector3D.h.

References _x.

Vector3D& dd4hep::rec::Vector3D::operator= ( const Vector3D v)
inline

Copy c'tor for three vectors from other packages - requires T::x(),T::y(), T::z().

Definition at line 73 of file Vector3D.h.

References _x, _y, and _z.

double dd4hep::rec::Vector3D::operator[] ( int  i) const
inline

Accessing x,y,z with bracket operator.

Definition at line 122 of file Vector3D.h.

References _x, _y, and _z.

double& dd4hep::rec::Vector3D::operator[] ( int  i)
inline

Accessing x,y,z with bracket operator for assignment.

Definition at line 131 of file Vector3D.h.

References _x, _y, and _z.

double dd4hep::rec::Vector3D::phi ( ) const
inline
double dd4hep::rec::Vector3D::r ( ) const
inline

Spherical r/magnitude.

Definition at line 166 of file Vector3D.h.

References _x, _y, and _z.

Referenced by dd4hep::rec::operator<<(), and unit().

double dd4hep::rec::Vector3D::r2 ( ) const
inline

Spherical r/magnitude, squared.

Definition at line 173 of file Vector3D.h.

References _x, _y, and _z.

double dd4hep::rec::Vector3D::rho ( ) const
inline
static Spherical dd4hep::rec::Vector3D::spherical ( )
inlinestatic
double dd4hep::rec::Vector3D::theta ( ) const
inline
template<class T >
T dd4hep::rec::Vector3D::to ( ) const
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()Explicit, unchecked conversion to anything that has a c'tor T(x,y,z). Example: CLHEP::Vector3D clhv = v.to< CLHEP::Vector3D>() ;
operator T()

Definition at line 261 of file Vector3D.h.

References _x, _y, and _z.

double dd4hep::rec::Vector3D::trans ( ) const
inline

Transversal component.

Definition at line 154 of file Vector3D.h.

References _x, and _y.

Referenced by rho().

double dd4hep::rec::Vector3D::trans2 ( ) const
inline

Transversal component squared.

Definition at line 160 of file Vector3D.h.

References _x, and _y.

Vector3D dd4hep::rec::Vector3D::unit ( ) const
inline

Parallel unit vector.

Definition at line 199 of file Vector3D.h.

References _x, _y, _z, r(), and Vector3D().

Referenced by dd4hep::rec::VolCylinderImpl::VolCylinderImpl().

double dd4hep::rec::Vector3D::x ( ) const
inline
double& dd4hep::rec::Vector3D::x ( )
inline

Assign to cartesian x coordinate.

Definition at line 112 of file Vector3D.h.

References _x.

double dd4hep::rec::Vector3D::y ( ) const
inline
double& dd4hep::rec::Vector3D::y ( )
inline

Assign to cartesian y coordinate.

Definition at line 115 of file Vector3D.h.

References _y.

double dd4hep::rec::Vector3D::z ( ) const
inline
double& dd4hep::rec::Vector3D::z ( )
inline

Assign to cartesian z coordinate.

Definition at line 118 of file Vector3D.h.

References _z.

Member Data Documentation

double dd4hep::rec::Vector3D::_x
protected
double dd4hep::rec::Vector3D::_y
protected

Definition at line 266 of file Vector3D.h.

Referenced by cross(), dot(), fill(), operator=(), operator[](), phi(), r(), r2(), theta(), to(), trans(), trans2(), unit(), and y().

double dd4hep::rec::Vector3D::_z
protected

Definition at line 266 of file Vector3D.h.

Referenced by cross(), dot(), fill(), operator=(), operator[](), r(), r2(), theta(), to(), unit(), and z().


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