CMS 3D CMS Logo

Public Types | Public Member Functions

Vector2DBase< T, FrameTag > Class Template Reference

#include <Vector2DBase.h>

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

List of all members.

Public Types

typedef PV2DBase< T, VectorTag,
FrameTag > 
BaseClass
typedef Basic2DVector< T > BasicVectorType
typedef BaseClass::Polar Polar

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)
template<class U >
Vector2DBaseoperator+= (const Vector2DBase< U, FrameTag > &v)
Vector2DBase operator- () const
 Unary minus, returns a vector with components (-x(),-y())
template<class U >
Vector2DBaseoperator-= (const Vector2DBase< U, FrameTag > &v)
Vector2DBaseoperator/= (const T &t)
 Scaling by a scalar value (division)
Vector2DBase unit () const
 Vector2DBase (const T &x, const T &y)
 construct from cartesian coordinates
template<class U >
 Vector2DBase (const Vector2DBase< U, FrameTag > &p)
template<class U >
 Vector2DBase (const Basic2DVector< U > &v)
 Vector2DBase ()
 Vector2DBase (const Polar &set)
 construct from polar coordinates

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

Reimplemented from PV2DBase< T, VectorTag, FrameTag >.

Definition at line 13 of file Vector2DBase.h.

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

Reimplemented from PV2DBase< T, VectorTag, FrameTag >.

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().

{}
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.

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.

: BaseClass(x, y) {}
template<class T, class FrameTag>
Vector2DBase< T, FrameTag >::Vector2DBase ( const Polar set) [inline, explicit]

construct from polar coordinates

Definition at line 32 of file Vector2DBase.h.

: BaseClass( set) {}
template<class T, class FrameTag>
template<class U >
Vector2DBase< T, FrameTag >::Vector2DBase ( const Basic2DVector< U > &  v) [inline, explicit]

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.

: BaseClass(v) {}

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.

                                                  { 
    return this->basicVector().dot( v.basicVector());
  }
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.

                                         { 
    this->basicVector() *= t;
    return *this;
  } 
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.

                                                                 {
    this->basicVector() += v.basicVector();
    return *this;
  } 
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.

{ return Vector2DBase(-this->basicVector());}
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.

                                                                 {
    this->basicVector() -= v.basicVector();
    return *this;
  } 
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.

                                         { 
    this->basicVector() /= t;
    return *this;
  } 
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().

{ return Vector2DBase( this->basicVector().unit());}