Correct the sign for the shift in frac.

However, this is not entirely correct as the new start point when testing
the other side of the plane also needs to be calculated.
This commit is contained in:
Bill Currie 2011-11-12 18:53:05 +09:00
parent b82d9f5894
commit fa6390a46a
2 changed files with 7 additions and 2 deletions

View file

@ -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]))

View file

@ -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;