CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: Normal3D.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_NORMAL3D_H 00015 #define HEP_NORMAL3D_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 Normal3D : public BasicVector3D<T> {}; 00036 00043 template<> 00044 class Normal3D<float> : public BasicVector3D<float> { 00045 public: 00048 Normal3D() {} 00049 00052 Normal3D(float x, float y, float z) : BasicVector3D<float>(x,y,z) {} 00053 00056 explicit Normal3D(const float * a) 00057 : BasicVector3D<float>(a[0],a[1],a[2]) {} 00058 00061 Normal3D(const Normal3D<float> & v) : BasicVector3D<float>(v) {} 00062 00065 Normal3D(const BasicVector3D<float> & v) : BasicVector3D<float>(v) {} 00066 00069 ~Normal3D() {} 00070 00073 Normal3D<float> & operator=(const Normal3D<float> & v) { 00074 set(v.x(),v.y(),v.z()); return *this; 00075 } 00076 00079 Normal3D<float> & operator=(const BasicVector3D<float> & v) { 00080 set(v.x(),v.y(),v.z()); return *this; 00081 } 00082 00085 Normal3D<float> & transform(const Transform3D & m); 00086 }; 00087 00092 Normal3D<float> 00093 operator*(const Transform3D & m, const Normal3D<float> & n); 00094 00101 template<> 00102 class Normal3D<double> : public BasicVector3D<double> { 00103 public: 00106 Normal3D() {} 00107 00110 Normal3D(double x, double y, double z) : BasicVector3D<double>(x,y,z) {} 00111 00114 explicit Normal3D(const float * a) 00115 : BasicVector3D<double>(a[0],a[1],a[2]) {} 00116 00119 explicit Normal3D(const double * a) 00120 : BasicVector3D<double>(a[0],a[1],a[2]) {} 00121 00124 Normal3D(const Normal3D<double> & v) : BasicVector3D<double>(v) {} 00125 00128 Normal3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {} 00129 00132 Normal3D(const BasicVector3D<double> & v) : BasicVector3D<double>(v) {} 00133 00136 ~Normal3D() {} 00137 00143 Normal3D(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 Normal3D<double> & operator=(const Normal3D<double> & v) { 00156 set(v.x(),v.y(),v.z()); return *this; 00157 } 00158 00161 Normal3D<double> & operator=(const BasicVector3D<float> & v) { 00162 set(v.x(),v.y(),v.z()); return *this; 00163 } 00164 00167 Normal3D<double> & operator=(const BasicVector3D<double> & v) { 00168 set(v.x(),v.y(),v.z()); return *this; 00169 } 00170 00173 Normal3D<double> & transform(const Transform3D & m); 00174 }; 00175 00180 Normal3D<double> 00181 operator*(const Transform3D & m, const Normal3D<double> & n); 00182 00183 } /* namespace HepGeom */ 00184 00185 #ifdef ENABLE_BACKWARDS_COMPATIBILITY 00186 // backwards compatibility will be enabled ONLY in CLHEP 1.9 00187 typedef HepGeom::Normal3D<double> HepNormal3D; 00188 #endif 00189 00190 #endif /* HEP_NORMAL3D_H */