Geant4 Cross Reference |
1 // -*- C++ -*- 1 // -*- C++ -*- 2 // ------------------------------------------- 2 // --------------------------------------------------------------------------- 3 3 4 #include "CLHEP/Geometry/Point3D.h" 4 #include "CLHEP/Geometry/Point3D.h" 5 #include "CLHEP/Geometry/Transform3D.h" 5 #include "CLHEP/Geometry/Transform3D.h" 6 6 7 namespace HepGeom { 7 namespace HepGeom { 8 //------------------------------------------ 8 //-------------------------------------------------------------------------- 9 Point3D<float> & 9 Point3D<float> & 10 Point3D<float>::transform(const Transform3D 10 Point3D<float>::transform(const Transform3D & m) { 11 double vx = x(), vy = y(), vz = z(); 11 double vx = x(), vy = y(), vz = z(); 12 set(m.xx()*vx + m.xy()*vy + m.xz()*vz + m. 12 set(m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), 13 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), 13 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), 14 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); 14 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); 15 return *this; 15 return *this; 16 } 16 } 17 17 18 //------------------------------------------ 18 //-------------------------------------------------------------------------- 19 Point3D<float> 19 Point3D<float> 20 operator*(const Transform3D & m, const Point 20 operator*(const Transform3D & m, const Point3D<float> & v) { 21 double vx = v.x(), vy = v.y(), vz = v.z(); 21 double vx = v.x(), vy = v.y(), vz = v.z(); 22 return Point3D<float> 22 return Point3D<float> 23 (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.d 23 (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), 24 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.d 24 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), 25 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.d 25 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); 26 } 26 } 27 27 28 //------------------------------------------ 28 //-------------------------------------------------------------------------- 29 Point3D<double> & 29 Point3D<double> & 30 Point3D<double>::transform(const Transform3D 30 Point3D<double>::transform(const Transform3D & m) { 31 double vx = x(), vy = y(), vz = z(); 31 double vx = x(), vy = y(), vz = z(); 32 set(m.xx()*vx + m.xy()*vy + m.xz()*vz + m. 32 set(m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), 33 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), 33 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), 34 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); 34 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); 35 return *this; 35 return *this; 36 } 36 } 37 37 38 //------------------------------------------ 38 //-------------------------------------------------------------------------- 39 Point3D<double> 39 Point3D<double> 40 operator*(const Transform3D & m, const Point 40 operator*(const Transform3D & m, const Point3D<double> & v) { 41 double vx = v.x(), vy = v.y(), vz = v.z(); 41 double vx = v.x(), vy = v.y(), vz = v.z(); 42 return Point3D<double> 42 return Point3D<double> 43 (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.d 43 (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), 44 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.d 44 m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), 45 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.d 45 m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); 46 } 46 } 47 } /* namespace HepGeom */ 47 } /* namespace HepGeom */ 48 48