mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
more fixes
This commit is contained in:
parent
26a1985992
commit
b97325c1cc
@ -136,10 +136,23 @@ intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2,
|
|||||||
FLOATTYPE c = normal.dot(parabola.get_c()) + _v.v._3;
|
FLOATTYPE c = normal.dot(parabola.get_c()) + _v.v._3;
|
||||||
|
|
||||||
if (IS_NEARLY_ZERO(a)) {
|
if (IS_NEARLY_ZERO(a)) {
|
||||||
// No intersection.
|
// It's not quadratic. The equation is actually:
|
||||||
|
// b * t + c == 0.
|
||||||
|
// Which means:
|
||||||
|
// t = -c / b.
|
||||||
|
|
||||||
|
if (IS_NEARLY_ZERO(b)) {
|
||||||
|
// It's not even linear. The parabola must be completely
|
||||||
|
// parallel to the plane, or if c == 0, it's completely within
|
||||||
|
// the plane. In both cases, we'll call it no intersection.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t1 = -c / b;
|
||||||
|
t2 = t1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Now use the quadratic equation to solve for t.
|
// Now use the quadratic equation to solve for t.
|
||||||
FLOATTYPE discriminant = b * b - 4.0 * a * c;
|
FLOATTYPE discriminant = b * b - 4.0 * a * c;
|
||||||
if (discriminant < 0.0f) {
|
if (discriminant < 0.0f) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user