From 9587022d2e53011ea0228721aa291cd983145d14 Mon Sep 17 00:00:00 2001
From: Evgueni Tcherniaev <Evgueni.Tcherniaev@cern.ch>
Date: Fri, 20 Apr 2018 22:12:51 +0200
Subject: [PATCH] Back to original G4AffineTransform

---
 .../management/include/G4AffineTransform.hh   |  3 +-
 .../management/include/G4AffineTransform.icc  | 56 +++++--------------
 2 files changed, 15 insertions(+), 44 deletions(-)

diff --git a/source/geometry/management/include/G4AffineTransform.hh b/source/geometry/management/include/G4AffineTransform.hh
index 453549c638..420a50e797 100644
--- a/source/geometry/management/include/G4AffineTransform.hh
+++ b/source/geometry/management/include/G4AffineTransform.hh
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 //
-// $Id: G4AffineTransform.hh 98307 2016-07-06 10:28:35Z gcosmo $
+// $Id: G4AffineTransform.hh 98309 2016-07-06 10:30:15Z gcosmo $
 //
 //
 // class G4AffineTransform
@@ -168,7 +168,6 @@ private:
   G4double ryx,ryy,ryz;
   G4double rzx,rzy,rzz;
   G4double tx,ty,tz;
-  G4bool NoRotation;
 };
 
 std::ostream& operator << (std::ostream& os, const G4AffineTransform& transf);
diff --git a/source/geometry/management/include/G4AffineTransform.icc b/source/geometry/management/include/G4AffineTransform.icc
index 0bfb6600b8..ba7764802a 100644
--- a/source/geometry/management/include/G4AffineTransform.icc
+++ b/source/geometry/management/include/G4AffineTransform.icc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 //
-// $Id: G4AffineTransform.icc 98307 2016-07-06 10:28:35Z gcosmo $
+// $Id: G4AffineTransform.icc 98309 2016-07-06 10:30:15Z gcosmo $
 //
 //
 // G4AffineTransformation Inline implementation
@@ -35,38 +35,30 @@ inline G4AffineTransform::G4AffineTransform()
  : rxx(1),rxy(0),rxz(0),
    ryx(0),ryy(1),ryz(0),
    rzx(0),rzy(0),rzz(1),
-   tx(0),ty(0),tz(0),
-   NoRotation(true)
+   tx(0),ty(0),tz(0)
 {}
 
 inline G4AffineTransform::G4AffineTransform(const G4ThreeVector& tlate)
  : rxx(1),rxy(0),rxz(0),
    ryx(0),ryy(1),ryz(0),
    rzx(0),rzy(0),rzz(1),
-   tx(tlate.x()),ty(tlate.y()),tz(tlate.z()),
-   NoRotation(true)
+   tx(tlate.x()),ty(tlate.y()),tz(tlate.z())
 {}
 
 inline G4AffineTransform::G4AffineTransform(const G4RotationMatrix& rot)
  : rxx(rot.xx()),rxy(rot.xy()),rxz(rot.xz()),
    ryx(rot.yx()),ryy(rot.yy()),ryz(rot.yz()),
    rzx(rot.zx()),rzy(rot.zy()),rzz(rot.zz()),
-   tx(0),ty(0),tz(0),NoRotation(false)
-
-{
-  if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; } 
-}
+   tx(0),ty(0),tz(0)
+{}
 
 inline G4AffineTransform::G4AffineTransform( const G4RotationMatrix& rot,
                                              const G4ThreeVector& tlate   )
  : rxx(rot.xx()),rxy(rot.xy()),rxz(rot.xz()),
    ryx(rot.yx()),ryy(rot.yy()),ryz(rot.yz()),
    rzx(rot.zx()),rzy(rot.zy()),rzz(rot.zz()),
-   tx(tlate.x()),ty(tlate.y()),tz(tlate.z()),
-   NoRotation(false)
-{
-  if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; } 
-}
+   tx(tlate.x()),ty(tlate.y()),tz(tlate.z())
+{}
 
 inline G4AffineTransform::G4AffineTransform( const G4RotationMatrix* rot,
                                              const G4ThreeVector& tlate)
@@ -77,15 +69,12 @@ inline G4AffineTransform::G4AffineTransform( const G4RotationMatrix* rot,
       rxx=rot->xx();rxy=rot->xy();rxz=rot->xz();
       ryx=rot->yx();ryy=rot->yy();ryz=rot->yz();
       rzx=rot->zx();rzy=rot->zy();rzz=rot->zz();
-      NoRotation = false;
-      if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; }
     }
   else
     {
       rxx=1; rxy=0; rxz=0;
       ryx=0; ryy=1; ryz=0;
       rzx=0; rzy=0; rzz=1;
-      NoRotation = true;
     }
 }
 
@@ -99,10 +88,7 @@ G4AffineTransform( const G4double prxx,const G4double prxy,const G4double prxz,
    ryx(pryx),ryy(pryy),ryz(pryz),
    rzx(przx),rzy(przy),rzz(przz),
    tx(ptx),ty(pty),tz(ptz)
-{
-   NoRotation = false;
-   if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; }
-}
+{}
 
 inline G4AffineTransform
 G4AffineTransform::operator * (const G4AffineTransform& tf) const
@@ -151,8 +137,6 @@ G4AffineTransform::operator *= (const G4AffineTransform& tf)
         ryx=nryx; ryy=nryy; ryz=nryz;
         rzx=nrzx; rzy=nrzy; rzz=nrzz;
 
-        NoRotation = false;
-        if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; }
         return *this;
 }
 
@@ -176,8 +160,6 @@ G4AffineTransform::Product(const G4AffineTransform& tf1,
         ty=tf1.tx*tf2.rxy + tf1.ty*tf2.ryy + tf1.tz*tf2.rzy   + tf2.ty;
         tz=tf1.tx*tf2.rxz + tf1.ty*tf2.ryz + tf1.tz*tf2.rzz   + tf2.tz; 
         
-        NoRotation = false;
-        if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; }
         return *this;
 }
 
@@ -205,31 +187,23 @@ G4AffineTransform::InverseProduct( const G4AffineTransform& tf1,
         ty=tf1.tx*tf2.ryx+tf1.ty*tf2.ryy+tf1.tz*tf2.ryz+itf2ty;
         tz=tf1.tx*tf2.rzx+tf1.ty*tf2.rzy+tf1.tz*tf2.rzz+itf2tz;
 
-        NoRotation = false;
-        if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; }
         return *this;
 }
 
 inline
 G4ThreeVector G4AffineTransform::TransformPoint(const G4ThreeVector& vec) const
 {
-        G4double vecx = vec.x(), vecy = vec.y(), vecz = vec.z();
-    if (rxx + ryy + rzz == 3) return G4ThreeVector(vecx + tx, vecy + ty, vecz + tz);
-        //if (NoRotation) return G4ThreeVector(vecx + tx, vecy + ty, vecz + tz);
-        return G4ThreeVector(vecx*rxx + vecy*ryx + vecz*rzx + tx,
-                             vecx*rxy + vecy*ryy + vecz*rzy + ty,
-                             vecx*rxz + vecy*ryz + vecz*rzz + tz);
+        return G4ThreeVector( vec.x()*rxx + vec.y()*ryx + vec.z()*rzx   + tx,
+                              vec.x()*rxy + vec.y()*ryy + vec.z()*rzy   + ty,
+                              vec.x()*rxz + vec.y()*ryz + vec.z()*rzz   + tz  );
 }
 
 inline
 G4ThreeVector G4AffineTransform::TransformAxis(const G4ThreeVector& axis) const
 {
-    if (rxx + ryy + rzz == 3) return axis;
-        //if (NoRotation) return axis;
-        G4double axisx = axis.x(), axisy = axis.y(), axisz = axis.z();
-        return G4ThreeVector(axisx*rxx + axisy*ryx + axisz*rzx,
-                             axisx*rxy + axisy*ryy + axisz*rzy,
-                             axisx*rxz + axisy*ryz + axisz*rzz);
+        return G4ThreeVector( axis.x()*rxx + axis.y()*ryx + axis.z()*rzx,
+                              axis.x()*rxy + axis.y()*ryy + axis.z()*rzy,
+                              axis.x()*rxz + axis.y()*ryz + axis.z()*rzz  );
 }
 
 inline
@@ -412,8 +386,6 @@ void G4AffineTransform::SetNetRotation(const G4RotationMatrix& rot)
         rzx=rot.zx();
         rzy=rot.zy();
         rzz=rot.zz();
-        NoRotation = false;
-        if (rxx + ryy + rzz == 3) { rxy = rxz = ryx = ryz = rzx = rzy = 0; NoRotation = true; }
 }
 
 inline
-- 
GitLab