Skip to content
Snippets Groups Projects
Commit db35df0a authored by Armin Co's avatar Armin Co
Browse files

MorseBox

parent 2279f396
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
......@@ -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;
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment