Exposed exaggeration factor when rendering heightmap.

Added checkbox to select whether to run autoleveled program or not.
Heightmap can handle non integer from_x and to_x.
This commit is contained in:
2023-05-23 14:28:08 +03:00
parent 4e7e059e22
commit b7b9fed0dd
8 changed files with 118 additions and 143 deletions
+23
View File
@@ -23,4 +23,27 @@ TEST(heightmap, get_z_at) {
z = grid.get_z_at(1, 0.5f);
EXPECT_EQ(2, z);
}
TEST(heightmap, get_z_at_non_zero_origin) {
auto grid = grbl::heightmap::from_params(0 - 0.123, 0 + 0.234, 1 - 0.123, 1 + 0.234, 1);
grid.vertices[0].z = 0;
grid.vertices[1].z = 1;
grid.vertices[2].z = 2;
grid.vertices[3].z = 3;
auto z = grid.get_z_at(0.5f - 0.123f, 0.5f + 0.234f);
EXPECT_EQ(true, grbl::float_equal(1.5, z));
z = grid.get_z_at(0.5f - 0.123f, 0 + 0.234f);
EXPECT_EQ(true, grbl::float_equal(0.5, z));
z = grid.get_z_at(0.5f - 0.123f, 1 + 0.234f);
EXPECT_EQ(true, grbl::float_equal(2.5, z));
z = grid.get_z_at(0 - 0.123f, 0.5f + 0.234f);
EXPECT_EQ(true, grbl::float_equal(1, z));
z = grid.get_z_at(1 - 0.123f, 0.5f + 0.234f);
EXPECT_EQ(true, grbl::float_equal(2, z));
}