CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Vector2DBase.h
Go to the documentation of this file.
1 #ifndef GeometryVector_Vector2DBase_h
2 #define GeometryVector_Vector2DBase_h
3 
4 
7 
8 template <class T, class FrameTag>
9 class Vector2DBase : public PV2DBase<T, VectorTag, FrameTag> {
10 public:
11 
14  typedef typename BaseClass::Polar Polar;
15 
21 
25  template <class U>
27 
29  Vector2DBase(const T& x, const T& y) : BaseClass(x, y) {}
30 
32  explicit Vector2DBase( const Polar& set) : BaseClass( set) {}
33 
38  template <class U>
39  explicit Vector2DBase( const Basic2DVector<U>& v) : BaseClass(v) {}
40 
44  Vector2DBase unit() const { return Vector2DBase( this->basicVector().unit());}
45 
49  template <class U>
51  this->basicVector() += v.basicVector();
52  return *this;
53  }
54 
58  template <class U>
60  this->basicVector() -= v.basicVector();
61  return *this;
62  }
63 
65  Vector2DBase operator-() const { return Vector2DBase(-this->basicVector());}
66 
68  Vector2DBase& operator*= ( const T& t) {
69  this->basicVector() *= t;
70  return *this;
71  }
72 
74  Vector2DBase& operator/= ( const T& t) {
75  this->basicVector() /= t;
76  return *this;
77  }
78 
85  template <class U>
87  dot( const Vector2DBase< U, FrameTag>& v) const {
88  return this->basicVector().dot( v.basicVector());
89  }
90 
91 };
92 
94 template <class T, class U, class FrameTag>
98  return RT(v1.basicVector() + v2.basicVector());
99 }
100 
101 template <class T, class U, class FrameTag>
105  return RT(v1.basicVector() - v2.basicVector());
106 }
107 
109 template <class T, class U, class FrameTag>
110 inline typename PreciseFloatType<T,U>::Type
112  return v1.basicVector() * v2.basicVector();
113 }
114 
118 template <class T, class FrameTag, class Scalar>
121  return Vector2DBase<T, FrameTag>( v.basicVector() * s);
122 }
123 
125 template <class T, class FrameTag, class Scalar>
128  return Vector2DBase<T, FrameTag>( v.basicVector() * s);
129 }
130 
134 template <class T, class FrameTag, class Scalar>
137  return Vector2DBase<T, FrameTag>( v.basicVector() / s);
138 }
139 
140 #endif // GeometryVector_Vector2DBase_h
Vector2DBase & operator+=(const Vector2DBase< U, FrameTag > &v)
Definition: Vector2DBase.h:50
PreciseFloatType< T, U >::Type dot(const Vector2DBase< U, FrameTag > &v) const
Definition: Vector2DBase.h:87
double Scalar
Definition: Definitions.h:27
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:12
Vector2DBase & operator*=(const T &t)
Scaling by a scalar value (multiplication)
Definition: Vector2DBase.h:68
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Vector2DBase & operator/=(const T &t)
Scaling by a scalar value (division)
Definition: Vector2DBase.h:74
Vector2DBase(const Vector2DBase< U, FrameTag > &p)
Definition: Vector2DBase.h:26
T dot(const Basic2DVector &lh) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Vector2DBase(const T &x, const T &y)
construct from cartesian coordinates
Definition: Vector2DBase.h:29
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
Vector2DBase & operator-=(const Vector2DBase< U, FrameTag > &v)
Definition: Vector2DBase.h:59
Vector2DBase(const Basic2DVector< U > &v)
Definition: Vector2DBase.h:39
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37
Vector2DBase operator-() const
Unary minus, returns a vector with components (-x(),-y())
Definition: Vector2DBase.h:65
Vector2DBase(const Polar &set)
construct from polar coordinates
Definition: Vector2DBase.h:32
BaseClass::Polar Polar
Definition: Vector2DBase.h:14
Vector2DBase unit() const
Definition: Vector2DBase.h:44
Basic2DVector< T > BasicVectorType
Definition: Vector2DBase.h:13
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
string s
Definition: asciidump.py:422
long double T
mathSSE::Vec4< T > v