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

Optimized settings.

parent 40f43a3a
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
namespace QPong namespace QPong
{ {
constexpr int arrayWidth = 512; constexpr int arrayWidth = 768;
constexpr int arrayHeight = 512; constexpr int arrayHeight = 768;
constexpr unsigned arraySize = arrayWidth * arrayHeight; constexpr unsigned arraySize = arrayWidth * arrayHeight;
......
...@@ -50,29 +50,29 @@ const double batPotential(double x, double y, Position pos) ...@@ -50,29 +50,29 @@ const double batPotential(double x, double y, Position pos)
{ {
y -= pos.y; y -= pos.y;
constexpr double vx = 100000.0 / 2.0; constexpr double vx = 0.0001;
double E = 0.0; double E = 0.0;
constexpr double height = 0.31; constexpr double height = 0.31;
if (y >= height) if (y >= height)
{ {
double d = sqr(x-pos.x) + sqr(y-height); double d = sqr(x-pos.x) + sqr(y-height);
E = 1.0 / (sqrt(d) * vx); E = 1.0 / sqrt(d) * vx;
} }
else if (y <= (-height)) else if (y <= (-height))
{ {
double d = sqr(x-pos.x) + sqr((-y)-height); double d = sqr(x-pos.x) + sqr((-y)-height);
E = 1.0 / (sqrt(d) * vx); E = 1.0 / sqrt(d) * vx;
} }
else if ( x >= pos.x && y < height && y>-height) else if ( x >= pos.x && y < height && y>-height)
{ {
double d = x-pos.x; double d = x-pos.x;
E = 1.0 / (d * vx); E = 1.0 / d * vx;
} }
else if (x < pos.x && y < height && y > -height) else if (x < pos.x && y < height && y > -height)
{ {
double d = pos.x-x; double d = pos.x-x;
E = 1.0 / (d * vx); E = 1.0 / d * vx;
} }
return E; return E;
} }
...@@ -171,7 +171,7 @@ const double pyAt(int iy) ...@@ -171,7 +171,7 @@ const double pyAt(int iy)
return iy * M_PI * hbar; return iy * M_PI * hbar;
} }
constexpr double dt = 0.05; constexpr double dt = 0.15;
void Particle::manipulateParticleInPosition(int indexFrom, int indexTo) void Particle::manipulateParticleInPosition(int indexFrom, int indexTo)
{ {
...@@ -208,7 +208,7 @@ void Particle::manipulateParticleInPosition(int indexFrom, int indexTo) ...@@ -208,7 +208,7 @@ void Particle::manipulateParticleInPosition(int indexFrom, int indexTo)
std::complex<double> tmp = m_psi[index] * exp(-Ci * dt / hbar * (playerOneBat + playerTwoBat + horizontalBorders)); std::complex<double> tmp = m_psi[index] * exp(-Ci * dt / hbar * (playerOneBat + playerTwoBat + horizontalBorders));
m_psi[index] = tmp; m_psi[index] = tmp;
m_bufPositionRepresentation->updateBuffer(index, tmp * 75.0, (playerOneBat + playerTwoBat + horizontalBorders)*400); m_bufPositionRepresentation->updateBuffer(index, tmp * 125.0, (playerOneBat + playerTwoBat + horizontalBorders)*200);
} }
m_players[Player::One]->addScore(sumScorePlayerOne); m_players[Player::One]->addScore(sumScorePlayerOne);
m_players[Player::Two]->addScore(sumScorePlayerTwo); m_players[Player::Two]->addScore(sumScorePlayerTwo);
......
...@@ -53,19 +53,20 @@ const QColor ParticleImage::getValue(unsigned index) ...@@ -53,19 +53,20 @@ const QColor ParticleImage::getValue(unsigned index)
c.g = r*r + i*i + obs / 2; c.g = r*r + i*i + obs / 2;
c.b = i*i; c.b = i*i;
if (c.r >= 1.0) constexpr double max = 0.9;
if (c.r >= max)
{ {
c.r = 0.99; c.r = max;
} }
if (c.g >= 0.99) if (c.g >= max)
{ {
c.g = 0.99; c.g = max;
} }
if (c.b >= 1.0) if (c.b >= 1.0)
{ {
c.b = 0.99; c.b = max;
} }
return c; return c;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment