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 8 of file Vector2DBase.h.

Member Typedef Documentation

◆ BaseClass

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

Definition at line 10 of file Vector2DBase.h.

◆ BasicVectorType

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

Definition at line 11 of file Vector2DBase.h.

◆ Polar

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

Definition at line 12 of file Vector2DBase.h.

Constructor & Destructor Documentation

◆ Vector2DBase() [1/5]

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 18 of file Vector2DBase.h.

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

18 {}

◆ Vector2DBase() [2/5]

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 24 of file Vector2DBase.h.

24 : BaseClass(p.basicVector()) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:10

◆ Vector2DBase() [3/5]

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

construct from cartesian coordinates

Definition at line 27 of file Vector2DBase.h.

27 : BaseClass(x, y) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:10

◆ Vector2DBase() [4/5]

template<class T, class FrameTag>
Vector2DBase< T, FrameTag >::Vector2DBase ( const Polar set)
inlineexplicit

construct from polar coordinates

Definition at line 30 of file Vector2DBase.h.

30 : BaseClass(set) {}
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:10

◆ Vector2DBase() [5/5]

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 37 of file Vector2DBase.h.

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

Member Function Documentation

◆ dot()

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 84 of file Vector2DBase.h.

84  {
85  return this->basicVector().dot(v.basicVector());
86  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37
T dot(const Basic2DVector &lh) const
Scalar product, or "dot" product, with a vector of same type.

◆ operator*=()

template<class T, class FrameTag>
Vector2DBase& Vector2DBase< T, FrameTag >::operator*= ( const T t)
inline

Scaling by a scalar value (multiplication)

Definition at line 66 of file Vector2DBase.h.

66  {
67  this->basicVector() *= t;
68  return *this;
69  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37

◆ operator+=()

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 48 of file Vector2DBase.h.

48  {
49  this->basicVector() += v.basicVector();
50  return *this;
51  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37

◆ operator-()

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

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

Definition at line 63 of file Vector2DBase.h.

63 { return Vector2DBase(-this->basicVector()); }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37

◆ operator-=()

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 57 of file Vector2DBase.h.

57  {
58  this->basicVector() -= v.basicVector();
59  return *this;
60  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37

◆ operator/=()

template<class T, class FrameTag>
Vector2DBase& Vector2DBase< T, FrameTag >::operator/= ( const T t)
inline

Scaling by a scalar value (division)

Definition at line 72 of file Vector2DBase.h.

72  {
73  this->basicVector() /= t;
74  return *this;
75  }
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37

◆ unit()

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 42 of file Vector2DBase.h.

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

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