comparison UnitTestsSources/UnitTestsMain.cpp @ 176:ab9c799f5de1 wasm

fix interpolation with negative coordinates
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Mar 2018 10:06:59 +0100
parents 8d50e6be565d
children 83200c4d07ca
comparison
equal deleted inserted replaced
175:15d92d93738b 176:ab9c799f5de1
138 { 138 {
139 // https://en.wikipedia.org/wiki/Bilinear_interpolation#Application_in_image_processing 139 // https://en.wikipedia.org/wiki/Bilinear_interpolation#Application_in_image_processing
140 ASSERT_FLOAT_EQ(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation 140 ASSERT_FLOAT_EQ(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation
141 (20.5f, 14.2f, 91, 210, 162, 95)); 141 (20.5f, 14.2f, 91, 210, 162, 95));
142 142
143 ASSERT_NEAR(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation
144 (-20.5f, 14.2f, 91, 210, 162, 95), 0.0001f);
145
146 ASSERT_NEAR(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation
147 (-20.5f, -8.8f, 91, 210, 162, 95), 0.0001f);
148
149 ASSERT_NEAR(146.1f, OrthancStone::GeometryToolbox::ComputeBilinearInterpolation
150 (20.5f, -8.8f, 91, 210, 162, 95), 0.0001f);
151
143 ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation 152 ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation
144 (20.5f, 15.2f, 5.7f, 153 (20.5f, 15.2f, 5.7f,
154 91, 210, 162, 95,
155 51, 190, 80, 92));
156
157 ASSERT_FLOAT_EQ(123.35f, OrthancStone::GeometryToolbox::ComputeTrilinearInterpolation
158 (20.5f, 15.2f, -6.3f,
145 91, 210, 162, 95, 159 91, 210, 162, 95,
146 51, 190, 80, 92)); 160 51, 190, 80, 92));
147 } 161 }
148 162
149 163