diff --git a/src/lol/math/simplex_interpolator.h b/src/lol/math/simplex_interpolator.h index 812fe9c9..d428f1fc 100644 --- a/src/lol/math/simplex_interpolator.h +++ b/src/lol/math/simplex_interpolator.h @@ -117,7 +117,7 @@ protected: { // Finding floor point index for (int i = 0 ; i < N ; ++i) - floor_point[i] = (int) simplex_position[i]; + floor_point[i] = ((int) simplex_position[i]) - (simplex_position[i] < 0 ? 1 : 0); // Extracting decimal part from simplex sample for (int i = 0 ; i < N ; ++i) diff --git a/src/t/math/simplex_interpolator.cpp b/src/t/math/simplex_interpolator.cpp index c8b83888..50d3a629 100644 --- a/src/t/math/simplex_interpolator.cpp +++ b/src/t/math/simplex_interpolator.cpp @@ -226,9 +226,9 @@ lolunit_declare_fixture(SimplexInterpolatorTest) s.SetGradients(gradients); std::cout << std::endl; - for (int i = 0 ; i < 32 ; ++i) + for (int i = -64 ; i < 64 ; ++i) { - for (int j = 0 ; j < 32 ; ++j) + for (int j = -64 ; j < 64 ; ++j) { std::cout << s.Interp(vec_t({i * 0.1f, j * 0.1f})) << ", "; }