# HG changeset patch # User Sebastien Jodogne # Date 1520586419 -3600 # Node ID ab9c799f5de15dc447f18947aab4ab4f271c03d4 # Parent 15d92d93738b8582948eff92e374b41539549829 fix interpolation with negative coordinates diff -r 15d92d93738b -r ab9c799f5de1 UnitTestsSources/UnitTestsMain.cpp --- a/UnitTestsSources/UnitTestsMain.cpp Fri Mar 09 10:06:40 2018 +0100 +++ b/UnitTestsSources/UnitTestsMain.cpp Fri Mar 09 10:06:59 2018 +0100 @@ -140,10 +140,24 @@ ASSERT_FLOAT_EQ(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation (20.5f, 14.2f, 91, 210, 162, 95)); + ASSERT_NEAR(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation + (-20.5f, 14.2f, 91, 210, 162, 95), 0.0001f); + + ASSERT_NEAR(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation + (-20.5f, -8.8f, 91, 210, 162, 95), 0.0001f); + + ASSERT_NEAR(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation + (20.5f, -8.8f, 91, 210, 162, 95), 0.0001f); + ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation (20.5f, 15.2f, 5.7f, 91, 210, 162, 95, 51, 190, 80, 92)); + + ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation + (20.5f, 15.2f, -6.3f, + 91, 210, 162, 95, + 51, 190, 80, 92)); }