Skip to content

Commit d2367d8

Browse files
committed
demo: Adjust simplifySeam test a bit to correct border misconceptions
The seam vertices here have Z coordinate that is higher than zero; because of this, positional errors are not exactly zero. This is a good thing since it allows us to get a more stable result across fp environments and algorithm changes. We adjust the data a little bit to make the bump less pronounced and fix the comments accordingly.
1 parent e42624d commit d2367d8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

demo/tests.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1347,12 +1347,12 @@ static void simplifySeam()
13471347
0, 1, 0, 1,
13481348
0, 2, 0, 1,
13491349
1, 0, 0, 0,
1350-
1, 1, 1, 0,
1351-
1, 1, 1, 1,
1350+
1, 1, 0.3f, 0,
1351+
1, 1, 0.3f, 1,
13521352
1, 2, 0, 1,
13531353
2, 0, 0, 0,
1354-
2, 1, 0, 0,
1355-
2, 1, 0, 1,
1354+
2, 1, 0.1f, 0,
1355+
2, 1, 0.1f, 1,
13561356
2, 2, 0, 1,
13571357
3, 0, 0, 0,
13581358
3, 1, 0, 0,
@@ -1402,12 +1402,12 @@ static void simplifySeam()
14021402

14031403
assert(meshopt_simplify(res, ib, 36, vb, 16, 16, 18, 1.f, 0, &error) == 18);
14041404
assert(memcmp(res, expected, sizeof(expected)) == 0);
1405-
assert(fabsf(error - 0.22f) < 0.01f); // TODO: this is higher than normal due to border errors?
1405+
assert(fabsf(error - 0.04f) < 0.01f); // note: the error is not zero because there is a small difference in height between the seam vertices
14061406

14071407
float aw = 1;
14081408
assert(meshopt_simplifyWithAttributes(res, ib, 36, vb, 16, 16, vb + 3, 16, &aw, 1, NULL, 18, 2.f, 0, &error) == 18);
14091409
assert(memcmp(res, expected, sizeof(expected)) == 0);
1410-
assert(fabsf(error - 0.22f) < 0.01f); // note: this is the same error as above because the attribute is constant on either side of the seam
1410+
assert(fabsf(error - 0.04f) < 0.01f); // note: this is the same error as above because the attribute is constant on either side of the seam
14111411
}
14121412

14131413
static void adjacency()

0 commit comments

Comments
 (0)