CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
Vector3D.h
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: Vector3D.h,v 1.3 2003/10/23 21:29:50 garren Exp $
3// ---------------------------------------------------------------------------
4//
5// This file is a part of the CLHEP - a Class Library for High Energy Physics.
6//
7// History:
8// 09.09.96 E.Chernyaev - initial version
9// 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple
10// the functionality from CLHEP::Hep3Vector
11// 01.04.03 E.Chernyaev - CLHEP-1.9: template version
12//
13
14#ifndef HEP_VECTOR3D_H
15#define HEP_VECTOR3D_H
16
17#include <iosfwd>
18#include "CLHEP/Geometry/defs.h"
21
22namespace HepGeom {
23
24 class Transform3D;
25
34 template<class T>
35 class Vector3D : public BasicVector3D<T> {};
36
43 template<>
44 class Vector3D<float> : public BasicVector3D<float> {
45 public:
48 Vector3D() = default;
49
52 Vector3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
53
56 explicit Vector3D(const float * a)
57 : BasicVector3D<float>(a[0],a[1],a[2]) {}
58
61 Vector3D(const Vector3D<float> &) = default;
62
66
70
73 ~Vector3D() = default;
74
78
83 return *this;
84 }
85
89
93 };
94
100 operator*(const Transform3D & m, const Vector3D<float> & v);
101
108 template<>
109 class Vector3D<double> : public BasicVector3D<double> {
110 public:
113 Vector3D() = default;
114
117 Vector3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
118
121 explicit Vector3D(const float * a)
122 : BasicVector3D<double>(a[0],a[1],a[2]) {}
123
126 explicit Vector3D(const double * a)
127 : BasicVector3D<double>(a[0],a[1],a[2]) {}
128
131 Vector3D(const Vector3D<double> &) = default;
132
136
139 Vector3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {}
140
144
147 ~Vector3D() = default;
148
155 : BasicVector3D<double>(v.x(),v.y(),v.z()) {}
156
162 operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
163
167
172 return *this;
173 }
174
179 return *this;
180 }
181
185
189 };
190
197
198} /* namespace HepGeom */
199
200#ifdef ENABLE_BACKWARDS_COMPATIBILITY
201// backwards compatibility will be enabled ONLY in CLHEP 1.9
202typedef HepGeom::Vector3D<double> HepVector3D;
203#endif
204
205#endif /* HEP_VECTOR3D_H */
BasicVector3D< T > & operator=(const BasicVector3D< T > &)=default
Vector3D(const CLHEP::Hep3Vector &v)
Definition Vector3D.h:154
Vector3D(Vector3D< double > &&)=default
Vector3D< double > & operator=(const Vector3D< double > &)=default
Vector3D(float x1, float y1, float z1)
Definition Vector3D.h:52
Vector3D(const BasicVector3D< double > &v)
Definition Vector3D.h:143
Vector3D< double > & operator=(const BasicVector3D< float > &v)
Definition Vector3D.h:170
Vector3D(const BasicVector3D< float > &v)
Definition Vector3D.h:139
Vector3D< double > & operator=(Vector3D< double > &&)=default
Vector3D< float > & operator=(const BasicVector3D< float > &v)
Definition Vector3D.h:81
Vector3D(const double *a)
Definition Vector3D.h:126
Vector3D< double > & operator=(const BasicVector3D< double > &v)
Definition Vector3D.h:177
Vector3D(const float *a)
Definition Vector3D.h:121
Vector3D(const BasicVector3D< float > &v)
Definition Vector3D.h:69
Vector3D< float > & operator=(Vector3D< float > &&)=default
Vector3D(const float *a)
Definition Vector3D.h:56
Vector3D< float > operator*(const Transform3D &m, const Vector3D< float > &v)
Vector3D< float > & operator=(const Vector3D< float > &)=default
Vector3D< double > operator*(const Transform3D &m, const Vector3D< double > &v)
Vector3D< double > & transform(const Transform3D &m)
Vector3D(double x1, double y1, double z1)
Definition Vector3D.h:117
Vector3D< float > & transform(const Transform3D &m)
Vector3D(const Vector3D< double > &)=default
Vector3D(const Vector3D< float > &)=default
Vector3D(Vector3D< float > &&)=default