From cfe2a28d4ecb0b94f60da55b93836696b7834262 Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Wed, 3 Feb 2021 09:42:28 +0100
Subject: [PATCH] PhysicalGeometry

---
 corsika/detail/framework/geometry/Plane.inl |  2 +-
 corsika/framework/core/PhysicalGeometry.hpp | 15 +++++++++++++++
 corsika/framework/geometry/Helix.hpp        | 17 ++++++++---------
 corsika/framework/geometry/Plane.hpp        | 12 +++++-------
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/corsika/detail/framework/geometry/Plane.inl b/corsika/detail/framework/geometry/Plane.inl
index d32167cf1..54e60157c 100644
--- a/corsika/detail/framework/geometry/Plane.inl
+++ b/corsika/detail/framework/geometry/Plane.inl
@@ -26,7 +26,7 @@ namespace corsika {
 
   inline Point const& Plane::getCenter() const { return center_; }
 
-  inline Plane::DimLessVec const& Plane::getNormal() const { return normal_; }
+  inline DirectionVector const& Plane::getNormal() const { return normal_; }
 
   inline std::string Plane::asString() const {
     std::ostringstream txt;
diff --git a/corsika/framework/core/PhysicalGeometry.hpp b/corsika/framework/core/PhysicalGeometry.hpp
index 36b897f75..2d5b1d9bf 100644
--- a/corsika/framework/core/PhysicalGeometry.hpp
+++ b/corsika/framework/core/PhysicalGeometry.hpp
@@ -20,6 +20,21 @@
 
 namespace corsika {
 
+  /**
+   * A 3D vector defined in a specific coordinate system with units HEPMomentumType
+   **/
   typedef Vector<hepmomentum_d> MomentumVector;
 
+  /**
+   * A 3D vector defined in a specific coordinate system with no units. But, note, this is
+   * not automatically normaliyed! It is not a "NormalVector".
+   **/
+  typedef Vector<dimensionless_d> DirectionVector;
+
+  /**
+   * A 3D vector defined in a specific coordinate system with units "velocity_t".
+   * 
+   **/
+  typedef Vector<SpeedType::dimension_type> VelocityVector;
+
 } // namespace corsika
diff --git a/corsika/framework/geometry/Helix.hpp b/corsika/framework/geometry/Helix.hpp
index 0ed762d6a..386238988 100644
--- a/corsika/framework/geometry/Helix.hpp
+++ b/corsika/framework/geometry/Helix.hpp
@@ -8,11 +8,13 @@
 
 #pragma once
 
-#include <cmath>
 #include <corsika/framework/core/PhysicalUnits.hpp>
+#include <corsika/framework/core/PhysicalGeometry.hpp>
 #include <corsika/framework/geometry/Point.hpp>
 #include <corsika/framework/geometry/Vector.hpp>
 
+#include <cmath>
+
 namespace corsika {
 
   /*!
@@ -31,12 +33,9 @@ namespace corsika {
 
   class Helix {
 
-    ///! \todo move VelocityVec into PhysicalUnits
-    using VelocityVec = Vector<SpeedType::dimension_type>;
-
   public:
-    Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVec const& pvPar,
-          VelocityVec const& pvPerp)
+    Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVector const& pvPar,
+          VelocityVector const& pvPerp)
         : r0_(pR0)
         , omegaC_(pOmegaC)
         , vPar_(pvPar)
@@ -48,7 +47,7 @@ namespace corsika {
 
     Point getPosition(TimeType const t) const;
 
-    VelocityVec getVelocity(TimeType const t) const;
+    VelocityVector getVelocity(TimeType const t) const;
 
     Point getPositionFromArclength(LengthType const l) const;
 
@@ -60,8 +59,8 @@ namespace corsika {
     Point r0_;             ///! origin of helix, but this is in the center of the
                            ///! "cylinder" on which the helix rotates
     FrequencyType omegaC_; ///! speed of angular rotation
-    VelocityVec vPar_;     ///! speed along direction of "cylinder"
-    VelocityVec vPerp_, uPerp_;
+    VelocityVector vPar_;  ///! speed along direction of "cylinder"
+    VelocityVector vPerp_, uPerp_;
     LengthType radius_;
   };
 
diff --git a/corsika/framework/geometry/Plane.hpp b/corsika/framework/geometry/Plane.hpp
index 7218e6b35..454b527fd 100644
--- a/corsika/framework/geometry/Plane.hpp
+++ b/corsika/framework/geometry/Plane.hpp
@@ -9,6 +9,7 @@
 #pragma once
 
 #include <corsika/framework/core/PhysicalUnits.hpp>
+#include <corsika/framework/core/PhysicalGeometry.hpp>
 #include <corsika/framework/geometry/Point.hpp>
 #include <corsika/framework/geometry/Vector.hpp>
 
@@ -18,27 +19,24 @@ namespace corsika {
 
   class Plane {
 
-    ///! \todo move to PhysicalUnits
-    using DimLessVec = Vector<dimensionless_d>;
-
   public:
-    Plane(Point const& vCenter, DimLessVec const& vNormal)
+    Plane(Point const& vCenter, DirectionVector const& vNormal)
         : center_(vCenter)
         , normal_(vNormal.normalized()) {}
 
     bool isAbove(Point const& vP) const;
 
-    LengthType getDistanceTo(corsika::Point const& vP) const;
+    LengthType getDistanceTo(Point const& vP) const;
 
     Point const& getCenter() const;
 
-    DimLessVec const& getNormal() const;
+    DirectionVector const& getNormal() const;
 
     std::string asString() const;
 
   public:
     Point const center_;
-    DimLessVec const normal_;
+    DirectionVector const normal_;
   };
 
 } // namespace corsika
-- 
GitLab