@Test
public void testCalcMean() {
int width = 10;
HeightTile instance = new HeightTile(0, 0, width, width, 1e-6, 10, 10).setCalcMean(true);
DataAccess heights = new RAMDirectory().find("tmp");
heights.create(2 * 10 * 10);
instance.setHeights(heights);
init(heights, width, width, 1);
heights.setShort(2 * (9 * width + 0), (short) 10);
heights.setShort(2 * (7 * width + 1), (short) 70);
heights.setShort(2 * (8 * width + 2), (short) 90);
assertEquals((70 + 4) / 5d, instance.getHeight(2, 1), 1e-3);
assertEquals((70 + 90 + 3) / 5d, instance.getHeight(2.5, 2.5), 1e-3);
assertEquals((90 + 3) / 4d, instance.getHeight(-0.5, 2.5), 1e-3);
assertEquals((10 + 2) / 3d, instance.getHeight(-0.5, -0.5), 1e-3);
}