diff options
Diffstat (limited to 'src/simulation/Gravity.cpp')
| -rw-r--r-- | src/simulation/Gravity.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/simulation/Gravity.cpp b/src/simulation/Gravity.cpp index 1a74566..b0372a3 100644 --- a/src/simulation/Gravity.cpp +++ b/src/simulation/Gravity.cpp @@ -1,4 +1,4 @@ -#include <math.h> +#include <cmath> #include <sys/types.h> #include <pthread.h> #include "Config.h" @@ -237,9 +237,9 @@ void Gravity::grav_fft_init() for (x=0; x<xblock2; x++) { if (x==XRES/CELL && y==YRES/CELL) continue; - distance = sqrtf(pow(x-(XRES/CELL), 2) + pow(y-(YRES/CELL), 2)); - th_ptgravx[y*xblock2+x] = scaleFactor*(x-(XRES/CELL)) / pow(distance, 3); - th_ptgravy[y*xblock2+x] = scaleFactor*(y-(YRES/CELL)) / pow(distance, 3); + distance = sqrtf(pow(x-(XRES/CELL), 2.0f) + pow(y-(YRES/CELL), 2.0f)); + th_ptgravx[y*xblock2+x] = scaleFactor*(x-(XRES/CELL)) / pow(distance, 3.0f); + th_ptgravy[y*xblock2+x] = scaleFactor*(y-(YRES/CELL)) / pow(distance, 3.0f); } } th_ptgravx[yblock2*xblock2/2+xblock2/2] = 0.0f; |
