From 2c849c9b3675626f6027e067b20d0988223e1fcb Mon Sep 17 00:00:00 2001 From: darkrose Date: Sat, 8 Mar 2014 14:28:49 +1000 Subject: [PATCH] some noise tweaks --- src/noise.cpp | 8 ++------ src/noise.h | 4 +++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/noise.cpp b/src/noise.cpp index 9b5854a..0602daf 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -32,15 +32,11 @@ double cos_lookup[16] = { 1.0,-0.9238,-0.7071,-0.3826,0,0.3826,0.7071,0.9238 }; -double dotProduct(double vx, double vy, double wx, double wy){ +inline double dotProduct(double vx, double vy, double wx, double wy){ return vx*wx+vy*wy; } -double easeCurve(double t){ - return 6*pow(t,5)-15*pow(t,4)+10*pow(t,3); -} - -double linearInterpolation(double x0, double x1, double t){ +inline double linearInterpolation(double x0, double x1, double t){ return x0+(x1-x0)*t; } diff --git a/src/noise.h b/src/noise.h index 35db781..5ef7e80 100644 --- a/src/noise.h +++ b/src/noise.h @@ -59,7 +59,9 @@ private: int m_next; }; -double easeCurve(double t); +inline double easeCurve(double t){ + return t * t * t * (6. * t * t - 15. * t + 10.); +} // Return value: -1 ... 1 double noise2d(int x, int y, int seed);