CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
Vector2DBase< T, FrameTag > Class Template Reference

#include <Vector2DBase.h>

Inheritance diagram for Vector2DBase< T, FrameTag >:
PV2DBase< T, VectorTag, FrameTag >

Public Types

typedef PV2DBase< T, VectorTag, FrameTag > BaseClass
 
typedef Basic2DVector< TBasicVectorType
 
typedef BaseClass::Polar Polar
 
- Public Types inherited from PV2DBase< T, VectorTag, FrameTag >
typedef Basic2DVector< TBasicVectorType
 
typedef BasicVectorType::MathVector MathVector
 
typedef BasicVectorType::Polar Polar
 
typedef T ScalarType
 

Public Member Functions

template<class U >
PreciseFloatType< T, U >::Type dot (const Vector2DBase< U, FrameTag > &v) const
 
Vector2DBaseoperator*= (const T &t)
 Scaling by a scalar value (multiplication) More...
 
template<class U >
Vector2DBaseoperator+= (const Vector2DBase< U, FrameTag > &v)
 
Vector2DBase operator- () const
 Unary minus, returns a vector with components (-x(),-y()) More...
 
template<class U >
Vector2DBaseoperator-= (const Vector2DBase< U, FrameTag > &v)
 
Vector2DBaseoperator/= (const T &t)
 Scaling by a scalar value (division) More...
 
Vector2DBase unit () const
 
 Vector2DBase ()
 
template<class U >
 Vector2DBase (const Vector2DBase< U, FrameTag > &p)
 
 Vector2DBase (const T &x, const T &y)
 construct from cartesian coordinates More...
 
 Vector2DBase (const Polar &set)
 construct from polar coordinates More...
 
template<class U >
 Vector2DBase (const Basic2DVector< U > &v)
 
- Public Member Functions inherited from PV2DBase< T, VectorTag, FrameTag >
T barePhi () const
 
const BasicVectorTypebasicVector () const
 
T mag () const
 
T mag2 () const
 
MathVector const & mathVector () const
 
MathVectormathVector ()
 
Geom::Phi< Tphi () const
 
 PV2DBase ()
 
 PV2DBase (const T &x, const T &y)
 construct from cartesian coordinates More...
 
 PV2DBase (const Polar &set)
 construct from polar coordinates More...
 
 PV2DBase (const Basic2DVector< U > &v)
 
T r () const
 
T x () const
 
T y () const
 

Additional Inherited Members

- Protected Member Functions inherited from PV2DBase< T, VectorTag, FrameTag >
BasicVectorTypebasicVector ()
 
- Protected Attributes inherited from PV2DBase< T, VectorTag, FrameTag >
BasicVectorType theVector
 

Detailed Description

template<class T, class FrameTag>
class Vector2DBase< T, FrameTag >

Definition at line 9 of file Vector2DBase.h.

Member Typedef Documentation

template<class T, class FrameTag>
typedef PV2DBase<T, VectorTag, FrameTag> Vector2DBase< T, FrameTag >::BaseClass

Definition at line 12 of file Vector2DBase.h.

template<class T, class FrameTag>
typedef Basic2DVector<T> Vector2DBase< T, FrameTag >::BasicVectorType

Definition at line 13 of file Vector2DBase.h.

template<class T, class FrameTag>
typedef BaseClass::Polar Vector2DBase< T, FrameTag >::Polar

Definition at line 14 of file Vector2DBase.h.

Constructor & Destructor Documentation

template<class T, class FrameTag>
Vector2DBase< T, FrameTag >::Vector2DBase ( )
inline

default constructor uses default constructor of T to initialize the components. For built-in floating-point types this means initialization to zero

Definition at line 20 of file Vector2DBase.h.

Referenced by Vector2DBase< float, GlobalTag >::operator-(), and Vector2DBase< float, GlobalTag >::unit().

20 {}
template<class T, class FrameTag>
template<class U >
Vector2DBase< T, FrameTag >::Vector2DBase ( const Vector2DBase< U, FrameTag > &  p)
inline

Construct from another vector in the same reference frame, possiblly with different precision

Definition at line 26 of file Vector2DBase.h.

26 : BaseClass( p.basicVector()) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:12
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
Vector2DBase< T, FrameTag >::Vector2DBase ( const T x,
const T y 
)
inline

construct from cartesian coordinates

Definition at line 29 of file Vector2DBase.h.

29 : BaseClass(x, y) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:12
template<class T, class FrameTag>
Vector2DBase< T, FrameTag >::Vector2DBase ( const Polar set)
inlineexplicit

construct from polar coordinates

Definition at line 32 of file Vector2DBase.h.

32 : BaseClass( set) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:12
template<class T, class FrameTag>
template<class U >
Vector2DBase< T, FrameTag >::Vector2DBase ( const Basic2DVector< U > &  v)
inlineexplicit

Explicit constructor from BasicVectorType, bypasses consistency checks for point/vector and for coordinate frame. To be used as carefully as e.g. const_cast.

Definition at line 39 of file Vector2DBase.h.

39 : BaseClass(v) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:12

Member Function Documentation

template<class T, class FrameTag>
template<class U >
PreciseFloatType<T,U>::Type Vector2DBase< T, FrameTag >::dot ( const Vector2DBase< U, FrameTag > &  v) const
inline

Scalar (or dot) product with a vector of possibly different precision, defined in the same reference frame. The product is computed without loss of precision. The type of the returned scalar is the more precise of the scalar types of the two vectors.

Definition at line 87 of file Vector2DBase.h.

87  {
88  return this->basicVector().dot( v.basicVector());
89  }
T dot(const Basic2DVector &lh) const
Scalar product, or "dot" product, with a vector of same type.
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
Vector2DBase& Vector2DBase< T, FrameTag >::operator*= ( const T t)
inline

Scaling by a scalar value (multiplication)

Definition at line 68 of file Vector2DBase.h.

68  {
69  this->basicVector() *= t;
70  return *this;
71  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
template<class U >
Vector2DBase& Vector2DBase< T, FrameTag >::operator+= ( const Vector2DBase< U, FrameTag > &  v)
inline

Increment by another Vector of possibly different precision, defined in the same reference frame

Definition at line 50 of file Vector2DBase.h.

50  {
51  this->basicVector() += v.basicVector();
52  return *this;
53  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
Vector2DBase Vector2DBase< T, FrameTag >::operator- ( ) const
inline

Unary minus, returns a vector with components (-x(),-y())

Definition at line 65 of file Vector2DBase.h.

65 { return Vector2DBase(-this->basicVector());}
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
template<class U >
Vector2DBase& Vector2DBase< T, FrameTag >::operator-= ( const Vector2DBase< U, FrameTag > &  v)
inline

Decrement by another Vector of possibly different precision, defined in the same reference frame

Definition at line 59 of file Vector2DBase.h.

59  {
60  this->basicVector() -= v.basicVector();
61  return *this;
62  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
Vector2DBase& Vector2DBase< T, FrameTag >::operator/= ( const T t)
inline

Scaling by a scalar value (division)

Definition at line 74 of file Vector2DBase.h.

74  {
75  this->basicVector() /= t;
76  return *this;
77  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
template<class T, class FrameTag>
Vector2DBase Vector2DBase< T, FrameTag >::unit ( ) const
inline

Unit vector parallel to this. If mag() is zero, a zero vector is returned.

Definition at line 44 of file Vector2DBase.h.

Referenced by Vector2DBase< float, GlobalTag >::unit().

44 { return Vector2DBase( this->basicVector().unit());}
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
Vector2DBase unit() const
Definition: Vector2DBase.h:44