File indexing completed on 2025-01-30 10:03:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef HEP_VECTOR3D_H
0015 #define HEP_VECTOR3D_H
0016
0017 #include <iosfwd>
0018 #include "CLHEP/Geometry/defs.h"
0019 #include "CLHEP/Vector/ThreeVector.h"
0020 #include "CLHEP/Geometry/BasicVector3D.h"
0021
0022 namespace HepGeom {
0023
0024 class Transform3D;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 template<class T>
0035 class Vector3D : public BasicVector3D<T> {};
0036
0037
0038
0039
0040
0041
0042
0043 template<>
0044 class Vector3D<float> : public BasicVector3D<float> {
0045 public:
0046
0047
0048 Vector3D() = default;
0049
0050
0051
0052 Vector3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
0053
0054
0055
0056 explicit Vector3D(const float * a)
0057 : BasicVector3D<float>(a[0],a[1],a[2]) {}
0058
0059
0060
0061 Vector3D(const Vector3D<float> &) = default;
0062
0063
0064
0065 Vector3D(Vector3D<float> &&) = default;
0066
0067
0068
0069 Vector3D(const BasicVector3D<float> & v) : BasicVector3D<float>(v) {}
0070
0071
0072
0073 ~Vector3D() = default;
0074
0075
0076
0077 Vector3D<float> & operator=(const Vector3D<float> &) = default;
0078
0079
0080
0081 Vector3D<float> & operator=(const BasicVector3D<float> & v) {
0082 this->BasicVector3D<float>::operator=(v);
0083 return *this;
0084 }
0085
0086
0087
0088 Vector3D<float> & operator=(Vector3D<float> &&) = default;
0089
0090
0091
0092 Vector3D<float> & transform(const Transform3D & m);
0093 };
0094
0095
0096
0097
0098
0099 Vector3D<float>
0100 operator*(const Transform3D & m, const Vector3D<float> & v);
0101
0102
0103
0104
0105
0106
0107
0108 template<>
0109 class Vector3D<double> : public BasicVector3D<double> {
0110 public:
0111
0112
0113 Vector3D() = default;
0114
0115
0116
0117 Vector3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
0118
0119
0120
0121 explicit Vector3D(const float * a)
0122 : BasicVector3D<double>(a[0],a[1],a[2]) {}
0123
0124
0125
0126 explicit Vector3D(const double * a)
0127 : BasicVector3D<double>(a[0],a[1],a[2]) {}
0128
0129
0130
0131 Vector3D(const Vector3D<double> &) = default;
0132
0133
0134
0135 Vector3D(Vector3D<double> &&) = default;
0136
0137
0138
0139 Vector3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {}
0140
0141
0142
0143 Vector3D(const BasicVector3D<double> & v) : BasicVector3D<double>(v) {}
0144
0145
0146
0147 ~Vector3D() = default;
0148
0149
0150
0151
0152
0153
0154 Vector3D(const CLHEP::Hep3Vector & v)
0155 : BasicVector3D<double>(v.x(),v.y(),v.z()) {}
0156
0157
0158
0159
0160
0161
0162 operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
0163
0164
0165
0166 Vector3D<double> & operator=(const Vector3D<double> &) = default;
0167
0168
0169
0170 Vector3D<double> & operator=(const BasicVector3D<float> & v) {
0171 this->BasicVector3D<double>::operator=(v);
0172 return *this;
0173 }
0174
0175
0176
0177 Vector3D<double> & operator=(const BasicVector3D<double> & v) {
0178 this->BasicVector3D<double>::operator=(v);
0179 return *this;
0180 }
0181
0182
0183
0184 Vector3D<double> & operator=(Vector3D<double> &&) = default;
0185
0186
0187
0188 Vector3D<double> & transform(const Transform3D & m);
0189 };
0190
0191
0192
0193
0194
0195 Vector3D<double>
0196 operator*(const Transform3D & m, const Vector3D<double> & v);
0197
0198 }
0199
0200 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0201
0202 typedef HepGeom::Vector3D<double> HepVector3D;
0203 #endif
0204
0205 #endif