mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
whoops, logic error in clipping parabola to t1 and t2
This commit is contained in:
parent
e9240cfe24
commit
3f4d1aada2
@ -352,17 +352,23 @@ test_intersection_from_parabola(const CollisionEntry &entry) const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (t2 < parabola->get_t1() || t1 > parabola->get_t2()) {
|
||||
// The intersection points are before the start of the parabola
|
||||
// or after the end of the parabola. The finite subset of the
|
||||
// parabola is entirely in front of the plane.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Choose one of the intersecting points.
|
||||
t = t1;
|
||||
if (t < parabola->get_t1()) {
|
||||
if (t1 >= parabola->get_t1() && t1 <= parabola->get_t2()) {
|
||||
if (t2 >= parabola->get_t1() && t2 <= parabola->get_t2()) {
|
||||
// Both intersection points are within our segment of the
|
||||
// parabola. Choose the first of the two.
|
||||
t = min(t1, t2);
|
||||
} else {
|
||||
// Only t1 is within our segment.
|
||||
t = t1;
|
||||
}
|
||||
|
||||
} else if (t2 >= parabola->get_t1() && t2 <= parabola->get_t2()) {
|
||||
// Only t2 is within our segment.
|
||||
t = t2;
|
||||
|
||||
} else {
|
||||
// Neither intersection point is within our segment.
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user