CMS 3D CMS Logo

Basic2DVector.h File Reference

#include "DataFormats/GeometryVector/interface/Phi.h"
#include "DataFormats/GeometryVector/interface/PreciseFloatType.h"
#include "DataFormats/GeometryVector/interface/CoordinateSets.h"
#include <cmath>

Go to the source code of this file.

Classes

class  Basic2DVector< T >

Functions

template<class T, class Scalar>
Basic2DVector< T > operator * (const Scalar &s, const Basic2DVector< T > &v)
 Same as operator*( Vector, Scalar).
template<class T, class Scalar>
Basic2DVector< T > operator * (const Basic2DVector< T > &v, const Scalar &s)
 Multiplication by scalar, does not change the precision of the vector.
template<class T, class U>
PreciseFloatType< T, U >::Type operator * (const Basic2DVector< T > &v1, const Basic2DVector< U > &v2)
 scalar product of vectors of different precision
template<class T>
operator * (const Basic2DVector< T > &v1, const Basic2DVector< T > &v2)
template<class T, class U>
Basic2DVector< typename
PreciseFloatType< T, U >::Type > 
operator+ (const Basic2DVector< T > &a, const Basic2DVector< U > &b)
 vector sum and subtraction of vectors of possibly different precision
template<class T, class U>
Basic2DVector< typename
PreciseFloatType< T, U >::Type > 
operator- (const Basic2DVector< T > &a, const Basic2DVector< U > &b)
template<class T, class Scalar>
Basic2DVector< T > operator/ (const Basic2DVector< T > &v, const Scalar &s)
 Division by scalar, does not change the precision of the vector.


Function Documentation

template<class T, class Scalar>
Basic2DVector<T> operator * ( const Scalar &  s,
const Basic2DVector< T > &  v 
) [inline]

Same as operator*( Vector, Scalar).

Definition at line 164 of file Basic2DVector.h.

References t, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

00164                                                                                {
00165   T t = static_cast<T>(s);
00166   return Basic2DVector<T>(v.x()*t, v.y()*t);
00167 }

template<class T, class Scalar>
Basic2DVector<T> operator * ( const Basic2DVector< T > &  v,
const Scalar &  s 
) [inline]

Multiplication by scalar, does not change the precision of the vector.

The return type is the same as the type of the vector argument.

Definition at line 157 of file Basic2DVector.h.

References t, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

00157                                                                                {
00158   T t = static_cast<T>(s);
00159   return Basic2DVector<T>(v.x()*t, v.y()*t);
00160 }

template<class T, class U>
PreciseFloatType<T,U>::Type operator * ( const Basic2DVector< T > &  v1,
const Basic2DVector< U > &  v2 
) [inline]

scalar product of vectors of different precision

Definition at line 148 of file Basic2DVector.h.

References Basic2DVector< T >::x(), and Basic2DVector< T >::y().

00149                                                                                    {
00150   return v1.x()*v2.x() + v1.y()*v2.y();
00151 }

template<class T>
T operator * ( const Basic2DVector< T > &  v1,
const Basic2DVector< T > &  v2 
) [inline]

Definition at line 142 of file Basic2DVector.h.

References Basic2DVector< T >::dot().

00142                                                                             {
00143   return v1.dot(v2);
00144 }

template<class T, class U>
Basic2DVector<typename PreciseFloatType<T,U>::Type> operator+ ( const Basic2DVector< T > &  a,
const Basic2DVector< U > &  b 
) [inline]

vector sum and subtraction of vectors of possibly different precision

Definition at line 125 of file Basic2DVector.h.

References Basic2DVector< T >::x(), and Basic2DVector< T >::y().

00125                                                                  {
00126   typedef Basic2DVector<typename PreciseFloatType<T,U>::Type> RT;
00127   return RT(a.x()+b.x(), a.y()+b.y());
00128 }

template<class T, class U>
Basic2DVector<typename PreciseFloatType<T,U>::Type> operator- ( const Basic2DVector< T > &  a,
const Basic2DVector< U > &  b 
) [inline]

Definition at line 132 of file Basic2DVector.h.

References Basic2DVector< T >::x(), and Basic2DVector< T >::y().

00132                                                                  {
00133   typedef Basic2DVector<typename PreciseFloatType<T,U>::Type> RT;
00134   return RT(a.x()-b.x(), a.y()-b.y());
00135 }

template<class T, class Scalar>
Basic2DVector<T> operator/ ( const Basic2DVector< T > &  v,
const Scalar &  s 
) [inline]

Division by scalar, does not change the precision of the vector.

The return type is the same as the type of the vector argument.

Definition at line 173 of file Basic2DVector.h.

References t, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

00173                                                                                {
00174   T t = static_cast<T>(s);
00175   return Basic2DVector<T>(v.x()/t, v.y()/t);
00176 }


Generated on Tue Jun 9 17:52:06 2009 for CMSSW by  doxygen 1.5.4