From 59e82949575656102e92369cca1017accd43e976 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de>
Date: Thu, 19 Nov 2020 16:34:02 +0100
Subject: [PATCH] removed utl::sgn usage

---
 corsika/detail/framework/geometry/CoordinateSystem.inl | 10 ++++------
 corsika/detail/framework/utility/COMBoost.inl          |  1 -
 corsika/framework/geometry/CoordinateSystem.hpp        |  1 -
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/corsika/detail/framework/geometry/CoordinateSystem.inl b/corsika/detail/framework/geometry/CoordinateSystem.inl
index 608c33da8..4ec390bd2 100644
--- a/corsika/detail/framework/geometry/CoordinateSystem.inl
+++ b/corsika/detail/framework/geometry/CoordinateSystem.inl
@@ -14,7 +14,6 @@
 #include <Eigen/Dense>
 #include <stdexcept>
 #include <corsika/framework/core/PhysicalUnits.hpp>
-#include <corsika/framework/utility/sgn.hpp>
 
 
 namespace corsika {
@@ -38,14 +37,12 @@ namespace corsika {
     auto CoordinateSystem::RotateToZ(Vector<TDim> vVec) const
     {
       auto const a = vVec.normalized().GetComponents(*this).eVector;
-      auto const a1 = a(0), a2 = a(1);
-
-      auto const s = corsika::sgn(a(2));
-      auto const c = 1 / (1 + s * a(2));
+      auto const a1 = a(0), a2 = a(1), a3 = a(2);
 
       Eigen::Matrix3d A, B;
 
-      if (s > 0) {
+      if (a3 > 0) {
+        auto const c = 1 / (1 + a3);
         A << 1, 0, -a1,                     // comment to prevent clang-format
             0, 1, -a2,                      // .
             a1, a2, 1;                      // .
@@ -54,6 +51,7 @@ namespace corsika {
             0, 0, -(a1 * a1 + a2 * a2) * c; // .
 
       } else {
+        auto const c = 1 / (1 - a3);
         A << 1, 0, a1,                      // .
             0, -1, -a2,                     // .
             a1, a2, -1;                     // .
diff --git a/corsika/detail/framework/utility/COMBoost.inl b/corsika/detail/framework/utility/COMBoost.inl
index 352ee4e6c..338114b9f 100644
--- a/corsika/detail/framework/utility/COMBoost.inl
+++ b/corsika/detail/framework/utility/COMBoost.inl
@@ -18,7 +18,6 @@
 #include <corsika/framework/geometry/FourVector.hpp>
 #include <corsika/framework/geometry/Vector.hpp>
 #include <corsika/framework/logging/Logging.h>
-#include <corsika/framework/utility/sgn.hpp>
 
 // using namespace corsika::units::si;
 
diff --git a/corsika/framework/geometry/CoordinateSystem.hpp b/corsika/framework/geometry/CoordinateSystem.hpp
index 901968cf4..9b6b6ac02 100644
--- a/corsika/framework/geometry/CoordinateSystem.hpp
+++ b/corsika/framework/geometry/CoordinateSystem.hpp
@@ -10,7 +10,6 @@ n/*
 
 #include <corsika/framework/core/PhysicalUnits.hpp>
 #include <corsika/framework/geometry/QuantityVector.hpp>
-#include <corsika/framework/utility/sgn.hpp>
 
 #include <Eigen/Dense>
 #include <stdexcept>
-- 
GitLab