diff --git a/libs/models/test/testclip.c b/libs/models/test/testclip.c index 3351273b8..34cf5715e 100644 --- a/libs/models/test/testclip.c +++ b/libs/models/test/testclip.c @@ -212,6 +212,11 @@ test_t tests[] = { { -16, 0, 8}, {16, 0, 24}, { 0.25, 0, 0, 1, 0}}, {"Box, Step 1", &box, &hull_step1, { -16, 0, 8}, {16, 0, 40}, { 0.25, 0, 0, 1, 0}}, + {"Box, Step 1", &box, &hull_step1, + { -16, 0, 8}, {16, 0, 135}, { 0.25, 0, 0, 1, 0}}, + // 136 is a corner case caused by back/front side issues and 0 + {"Box, Step 1", &box, &hull_step1, + { -16, 0, 8}, {16, 0, 137}, { 1, 0, 0, 1, 0}}, }; #define num_tests (sizeof (tests) / sizeof (tests[0])) diff --git a/libs/models/trace.c b/libs/models/trace.c index 54fa77842..6e2dac36a 100644 --- a/libs/models/trace.c +++ b/libs/models/trace.c @@ -209,9 +209,9 @@ MOD_TraceLine (hull_t *hull, int num, side = start_dist < 0; if (side) - frac = (start_dist + offset) / (start_dist - end_dist); - else frac = (start_dist - offset) / (start_dist - end_dist); + else + frac = (start_dist + offset) / (start_dist - end_dist); frac = bound (0, frac, 1); tstack->num = num;