From db35df0abbb2919652a985821dea1295c79c370c Mon Sep 17 00:00:00 2001
From: Armin <armin.co@hs-bochum.de>
Date: Sun, 31 Jan 2021 19:30:22 +0100
Subject: [PATCH] MorseBox

---
 QPong/Particle.cpp | 2 +-
 QPong/Utils.cpp    | 4 ++--
 QPong/Utils.hpp    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/QPong/Particle.cpp b/QPong/Particle.cpp
index 22cb841..cc7ff93 100644
--- a/QPong/Particle.cpp
+++ b/QPong/Particle.cpp
@@ -84,7 +84,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn
     else
     {
         // "Simulation"
-        calculateGaussBox(m_staticBorders, m_xAt, m_yAt, m_properties.elements());
+        calculateMorseBox(m_staticBorders, m_xAt, m_yAt, m_properties.elements());
         m_leftBat.moveAway();
         m_rightBat.moveAway();
     }
diff --git a/QPong/Utils.cpp b/QPong/Utils.cpp
index 87244ee..379699e 100644
--- a/QPong/Utils.cpp
+++ b/QPong/Utils.cpp
@@ -85,7 +85,7 @@ void calculateBorderPotential(float *potential, [[maybe_unused]] double *xAt, do
     }
 }
 
-void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElements)
+void calculateMorseBox(float *potential, double *xAt, double *yAt, int arrayElements)
 {
     constexpr double grow = 0.1;
     constexpr double scalePotential = 1.0;
@@ -94,7 +94,7 @@ void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElem
         auto x = xAt[i] * grow;
         auto y = yAt[i] * grow;
         auto d = sqrt(pow2(x) + pow2(y));
-        // V(x) = 1 / cosh^2(x) ~= 1 / (1/2 * (cosh(2x)+1))
+        // V(x) = 1 / cosh^2(x) = 1 / (1/2 * (cosh(2x)+1))
         auto V = 1.0 / ( 0.5 * (cosh(2.0 * d) + 1.0));
         V *= scalePotential;
         potential[i] = 1.0 - V;
diff --git a/QPong/Utils.hpp b/QPong/Utils.hpp
index c8ce49e..0bf4176 100644
--- a/QPong/Utils.hpp
+++ b/QPong/Utils.hpp
@@ -17,5 +17,5 @@ void calculatePointPositions(float *points, int arraySize);
 void calculateMomentumViewPositions(float *points, int arraySize);
 void calculateTriangleIndices(uint32_t *indices, int arraySize);
 void calculateBorderPotential(float *potential, double *xAt, double *yAt, int arrayElements);
-void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElemnts);
+void calculateMorseBox(float *potential, double *xAt, double *yAt, int arrayElemnts);
 #endif
\ No newline at end of file
-- 
GitLab