diff --git a/QPong/Particle.cpp b/QPong/Particle.cpp index 22cb841f4ea378d47ece574f7c5bd974ad9f3005..cc7ff930024fdd7e01619678b443db0a4fa5b5d1 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 87244ee9079dfbe6a2dbb6b82d10d946a8224ce1..379699e5388fef2662bd53dd4afbe004540d384a 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 c8ce49e14b6f10406d0f968a184226bd058d54df..0bf41768bcc3629d8a572000b04c6bc3794acbfe 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