File indexing completed on 2024-04-06 12:04:16
0001 #ifndef GeometryVector_Point3DBase_h
0002 #define GeometryVector_Point3DBase_h
0003
0004 #include "DataFormats/GeometryVector/interface/PointTag.h"
0005 #include "DataFormats/GeometryVector/interface/PV3DBase.h"
0006 #include "DataFormats/GeometryVector/interface/Point2DBase.h"
0007 #include "DataFormats/GeometryVector/interface/Vector3DBase.h"
0008
0009 template <class T, class FrameTag>
0010 class Point3DBase : public PV3DBase<T, PointTag, FrameTag> {
0011 public:
0012 typedef PV3DBase<T, PointTag, FrameTag> BaseClass;
0013 typedef Vector3DBase<T, FrameTag> VectorType;
0014 typedef typename BaseClass::Cylindrical Cylindrical;
0015 typedef typename BaseClass::Spherical Spherical;
0016 typedef typename BaseClass::Polar Polar;
0017 typedef typename BaseClass::BasicVectorType BasicVectorType;
0018
0019
0020
0021
0022
0023 Point3DBase() {}
0024
0025
0026
0027
0028 template <class U>
0029 Point3DBase(const Point3DBase<U, FrameTag>& p) : BaseClass(p.basicVector()) {}
0030
0031
0032 Point3DBase(const T& x, const T& y, const T& z) : BaseClass(x, y, z) {}
0033
0034
0035
0036 explicit Point3DBase(const Cylindrical& set) : BaseClass(set) {}
0037
0038
0039 explicit Point3DBase(const Polar& set) : BaseClass(set) {}
0040
0041
0042
0043
0044 Point3DBase(const Geom::Theta<T>& th, const Geom::Phi<T>& ph, const T& r) : BaseClass(th, ph, r) {}
0045
0046
0047
0048
0049 Point3DBase(const T& x, const T& y) : BaseClass(x, y, 0) {}
0050 explicit Point3DBase(Point2DBase<T, FrameTag> p) : BaseClass(p.x(), p.y(), 0) {}
0051
0052
0053
0054
0055
0056 template <class U>
0057 explicit Point3DBase(const Basic3DVector<U>& v) : BaseClass(v) {}
0058
0059
0060 bool operator==(const Point3DBase& rh) const { return this->basicVector() == rh.basicVector(); }
0061
0062
0063
0064
0065 template <class U>
0066 Point3DBase& operator+=(const Vector3DBase<U, FrameTag>& v) {
0067 this->theVector += v.basicVector();
0068 return *this;
0069 }
0070
0071 template <class U>
0072 Point3DBase& operator-=(const Vector3DBase<U, FrameTag>& v) {
0073 this->theVector -= v.basicVector();
0074 return *this;
0075 }
0076 };
0077
0078
0079
0080
0081
0082 template <typename T, typename U, class Frame>
0083 inline Point3DBase<typename PreciseFloatType<T, U>::Type, Frame> operator+(const Point3DBase<T, Frame>& p,
0084 const Vector3DBase<U, Frame>& v) {
0085 typedef Point3DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0086 return RT(p.basicVector() + v.basicVector());
0087 }
0088
0089
0090
0091 template <typename T, typename U, class Frame>
0092 inline Point3DBase<typename PreciseFloatType<T, U>::Type, Frame> operator+(const Vector3DBase<T, Frame>& p,
0093 const Point3DBase<U, Frame>& v) {
0094 typedef Point3DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0095 return RT(p.basicVector() + v.basicVector());
0096 }
0097
0098
0099
0100
0101
0102 template <typename T, typename U, class Frame>
0103 inline Vector3DBase<typename PreciseFloatType<T, U>::Type, Frame> operator-(const Point3DBase<T, Frame>& p1,
0104 const Point3DBase<U, Frame>& p2) {
0105 typedef Vector3DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0106 return RT(p1.basicVector() - p2.basicVector());
0107 }
0108
0109
0110
0111
0112
0113 template <typename T, typename U, class Frame>
0114 inline Point3DBase<typename PreciseFloatType<T, U>::Type, Frame> operator-(const Point3DBase<T, Frame>& p,
0115 const Vector3DBase<U, Frame>& v) {
0116 typedef Point3DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0117 return RT(p.basicVector() - v.basicVector());
0118 }
0119 #endif