From 036545d937fcafcdb5650d7b8ae213c541759447 Mon Sep 17 00:00:00 2001 From: Armin <armin.co@hs-bochum.de> Date: Sun, 31 Jan 2021 20:56:16 +0100 Subject: [PATCH] H2 --- QPong/Utils.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/QPong/Utils.cpp b/QPong/Utils.cpp index a597a94..4e0ae38 100644 --- a/QPong/Utils.cpp +++ b/QPong/Utils.cpp @@ -118,15 +118,29 @@ void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElem void calculateH2Box(float *potential, double *xAt, double *yAt, int arrayElements) { - constexpr double grow = 1.0; - constexpr double scalePotential = 0.005; + constexpr double grow = 0.001; for (int i{0}; i < arrayElements; ++i) { auto x = xAt[i] * grow; auto y = yAt[i] * grow; - auto d = sqrt(pow2(x) + pow2(y)); - auto V = d; - V *= scalePotential; - potential[i] = V; + auto d = sqrt(pow2(x) + pow2(y)) + 0.1; + auto V = 0.10035 / d; + potential[i] = 1.0 - V; } } + + +// void Kegel(float *potential, double *xAt, double *yAt, int arrayElements) +// { +// constexpr double grow = 1.0; +// constexpr double scalePotential = 0.005; +// for (int i{0}; i < arrayElements; ++i) +// { +// auto x = xAt[i] * grow; +// auto y = yAt[i] * grow; +// auto d = sqrt(pow2(x) + pow2(y)); +// auto V = d; +// V *= scalePotential; +// potential[i] = V; +// } +// } \ No newline at end of file -- GitLab