CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Vector3D.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Vector3D.h,v 1.3 2003/10/23 21:29:50 garren Exp $
00003 // ---------------------------------------------------------------------------
00004 //
00005 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00006 //
00007 // History:
00008 // 09.09.96 E.Chernyaev - initial version
00009 // 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple
00010 //                        the functionality from CLHEP::Hep3Vector
00011 // 01.04.03 E.Chernyaev - CLHEP-1.9: template version
00012 //
00013 
00014 #ifndef HEP_VECTOR3D_H
00015 #define HEP_VECTOR3D_H
00016 
00017 #include <iosfwd>
00018 #include "CLHEP/Geometry/defs.h"
00019 #include "CLHEP/Vector/ThreeVector.h"
00020 #include "CLHEP/Geometry/BasicVector3D.h"
00021 
00022 namespace HepGeom {
00023 
00024   class Transform3D;
00025 
00034   template<class T>
00035   class Vector3D : public BasicVector3D<T> {};
00036 
00043   template<>
00044   class Vector3D<float> : public BasicVector3D<float> {
00045   public:
00048     Vector3D() {}
00049 
00052     Vector3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
00053 
00056     explicit Vector3D(const float * a)
00057       : BasicVector3D<float>(a[0],a[1],a[2]) {}
00058 
00061     Vector3D(const Vector3D<float> & v) : BasicVector3D<float>(v) {}
00062 
00065     Vector3D(const BasicVector3D<float> & v) : BasicVector3D<float>(v) {}
00066 
00069     ~Vector3D() {}
00070 
00073     Vector3D<float> & operator=(const Vector3D<float> & v) {
00074       set(v.x(),v.y(),v.z()); return *this;
00075     }
00076 
00079     Vector3D<float> & operator=(const BasicVector3D<float> & v) {
00080       set(v.x(),v.y(),v.z()); return *this;
00081     }
00082 
00085     Vector3D<float> & transform(const Transform3D & m);
00086   };
00087 
00092   Vector3D<float>
00093   operator*(const Transform3D & m, const Vector3D<float> & v);
00094 
00101   template<>
00102   class Vector3D<double> : public BasicVector3D<double> {
00103   public:
00106     Vector3D() {}
00107 
00110     Vector3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
00111 
00114     explicit Vector3D(const float * a)
00115       : BasicVector3D<double>(a[0],a[1],a[2]) {}
00116 
00119     explicit Vector3D(const double * a)
00120       : BasicVector3D<double>(a[0],a[1],a[2]) {}
00121 
00124     Vector3D(const Vector3D<double> & v) : BasicVector3D<double>(v) {}
00125 
00128     Vector3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {}
00129 
00132     Vector3D(const BasicVector3D<double> & v) : BasicVector3D<double>(v) {}
00133 
00136     ~Vector3D() {}
00137 
00143     Vector3D(const CLHEP::Hep3Vector & v)
00144       : BasicVector3D<double>(v.x(),v.y(),v.z()) {}
00145 
00151     operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
00152 
00155     Vector3D<double> & operator=(const Vector3D<double> & v) {
00156       set(v.x(),v.y(),v.z()); return *this;
00157     }
00158 
00161     Vector3D<double> & operator=(const BasicVector3D<float> & v) {
00162       set(v.x(),v.y(),v.z()); return *this;
00163     }
00164 
00167     Vector3D<double> & operator=(const BasicVector3D<double> & v) {
00168       set(v.x(),v.y(),v.z()); return *this;
00169     }
00170 
00173     Vector3D<double> & transform(const Transform3D & m);
00174   };
00175 
00180   Vector3D<double>
00181   operator*(const Transform3D & m, const Vector3D<double> & v);
00182 
00183 } /* namespace HepGeom */
00184 
00185 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00186 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00187 typedef HepGeom::Vector3D<double> HepVector3D;
00188 #endif
00189 
00190 #endif /* HEP_VECTOR3D_H */

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7