CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Vector3DBase.h
Go to the documentation of this file.
1 #ifndef GeometryVector_Vector3DBase_h
2 #define GeometryVector_Vector3DBase_h
3 
4 
7 
8 template <class T, class FrameTag>
9 class Vector3DBase : public PV3DBase<T, VectorTag, FrameTag> {
10 public:
11 
15  typedef typename BaseClass::Spherical Spherical;
16  typedef typename BaseClass::Polar Polar;
18 
24 
28  template <class U>
30 
32  Vector3DBase(const T& x, const T& y, const T& z) : BaseClass(x, y, z) {}
33 
36  explicit Vector3DBase( const Cylindrical& set) : BaseClass( set) {}
37 
39  explicit Vector3DBase( const Polar& set) : BaseClass( set) {}
40 
45  const Geom::Phi<T>& ph, const T& r) : BaseClass(th,ph,r) {}
46 
51  template <class U>
52  explicit Vector3DBase( const Basic3DVector<U>& v) : BaseClass(v) {}
53 
57  Vector3DBase unit() const { return Vector3DBase( this->basicVector().unit());}
58 
59  // equality
60  bool operator==(const Vector3DBase & rh) const {
61  return this->basicVector()==rh.basicVector();
62  }
63 
64 
68  template <class U>
70  this->theVector += v.basicVector();
71  return *this;
72  }
73 
77  template <class U>
79  this->theVector -= v.basicVector();
80  return *this;
81  }
82 
84  Vector3DBase operator-() const { return Vector3DBase(-this->basicVector());}
85 
86 
88  Vector3DBase& operator*= ( const T& t) {
89  this->theVector *= t;
90  return *this;
91  }
92 
94  Vector3DBase& operator/= ( const T& t) {
95  this->theVector /= t;
96  return *this;
97  }
98 
105  template <class U>
107  dot( const Vector3DBase< U, FrameTag>& v) const {
108  return this->theVector.dot( v.basicVector());
109  }
110 
117  template <class U>
121  return RT( this->theVector.cross( v.basicVector()));
122  }
123 
124 };
125 
127 template <class T, class U, class FrameTag>
131  return RT(v1.basicVector() + v2.basicVector());
132 }
133 
134 template <class T, class U, class FrameTag>
138  return RT(v1.basicVector() - v2.basicVector());
139 }
140 
142 template <class T, class U, class FrameTag>
143 inline typename PreciseFloatType<T,U>::Type
145  return v1.basicVector() * v2.basicVector();
146 }
147 
151 template <class T, class FrameTag, class Scalar>
154  return Vector3DBase<T, FrameTag>( v.basicVector() * s);
155 }
156 
158 template <class T, class FrameTag, class Scalar>
161  return Vector3DBase<T, FrameTag>( v.basicVector() * s);
162 }
163 
167 template <class T, class FrameTag, class Scalar>
170  return Vector3DBase<T, FrameTag>( v.basicVector() / s);
171 }
172 
173 #endif // GeometryVector_Vector3DBase_h
tuple t
Definition: tree.py:139
Vector3DBase< T, FrameTag > VectorType
Definition: Vector3DBase.h:13
bool operator==(const Vector3DBase &rh) const
Definition: Vector3DBase.h:60
double Scalar
Definition: Definitions.h:27
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Vector3DBase(const Cylindrical &set)
Definition: Vector3DBase.h:36
Vector3DBase(const Geom::Theta< T > &th, const Geom::Phi< T > &ph, const T &r)
Definition: Vector3DBase.h:44
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or &quot;cross&quot; product, with a vector of same type.
BaseClass::Spherical Spherical
Definition: Vector3DBase.h:15
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
Vector3DBase(const Basic3DVector< U > &v)
Definition: Vector3DBase.h:52
Vector3DBase(const Polar &set)
construct from polar coordinates
Definition: Vector3DBase.h:39
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
BaseClass::Polar Polar
Definition: Vector3DBase.h:16
Vector3DBase & operator/=(const T &t)
Scaling by a scalar value (division)
Definition: Vector3DBase.h:94
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
Vector3DBase & operator+=(const Vector3DBase< U, FrameTag > &v)
Definition: Vector3DBase.h:69
BaseClass::Cylindrical Cylindrical
Definition: Vector3DBase.h:14
Vector3DBase & operator*=(const T &t)
Scaling by a scalar value (multiplication)
Definition: Vector3DBase.h:88
Vector3DBase(const T &x, const T &y, const T &z)
construct from cartesian coordinates
Definition: Vector3DBase.h:32
Vector3DBase unit() const
Definition: Vector3DBase.h:57
Vector3DBase(const Vector3DBase< U, FrameTag > &v)
Definition: Vector3DBase.h:29
PV3DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector3DBase.h:12
Vector3DBase & operator-=(const Vector3DBase< U, FrameTag > &v)
Definition: Vector3DBase.h:78
BaseClass::BasicVectorType BasicVectorType
Definition: Vector3DBase.h:17
Vector3DBase operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Definition: Vector3DBase.h:84
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
long double T
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
Definition: Phi.h:20
T dot(const Basic3DVector &rh) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.