mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
prevent infinite recursion
This commit is contained in:
parent
81bef7355c
commit
336fb90627
@ -767,15 +767,17 @@ intersects_parabola(double &t, const Parabolaf ¶bola,
|
|||||||
// point and comparing its distance from the linear intervening
|
// point and comparing its distance from the linear intervening
|
||||||
// point.
|
// point.
|
||||||
double tmid = (t1 + t2) * 0.5;
|
double tmid = (t1 + t2) * 0.5;
|
||||||
LPoint3f pmid = parabola.calc_point(tmid);
|
if (tmid != t1 && tmid != t2) {
|
||||||
LPoint3f pmid2 = (p1 + p2) * 0.5f;
|
LPoint3f pmid = parabola.calc_point(tmid);
|
||||||
|
LPoint3f pmid2 = (p1 + p2) * 0.5f;
|
||||||
|
|
||||||
if ((pmid - pmid2).length_squared() > 0.001f) {
|
if ((pmid - pmid2).length_squared() > 0.001f) {
|
||||||
// Subdivide.
|
// Subdivide.
|
||||||
if (intersects_parabola(t, parabola, t1, tmid, p1, pmid)) {
|
if (intersects_parabola(t, parabola, t1, tmid, p1, pmid)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
return intersects_parabola(t, parabola, tmid, t2, pmid, p2);
|
||||||
}
|
}
|
||||||
return intersects_parabola(t, parabola, tmid, t2, pmid, p2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The line segment is sufficiently close; compare the segment itself.
|
// The line segment is sufficiently close; compare the segment itself.
|
||||||
|
@ -853,15 +853,18 @@ intersects_parabola(double &t, const Parabolaf ¶bola,
|
|||||||
// point and comparing its distance from the linear intervening
|
// point and comparing its distance from the linear intervening
|
||||||
// point.
|
// point.
|
||||||
double tmid = (t1 + t2) * 0.5;
|
double tmid = (t1 + t2) * 0.5;
|
||||||
LPoint3f pmid = parabola.calc_point(tmid);
|
|
||||||
LPoint3f pmid2 = (p1 + p2) * 0.5f;
|
|
||||||
|
|
||||||
if ((pmid - pmid2).length_squared() > 0.001f) {
|
if (tmid != t1 && tmid != t2) {
|
||||||
// Subdivide.
|
LPoint3f pmid = parabola.calc_point(tmid);
|
||||||
if (intersects_parabola(t, parabola, t1, tmid, p1, pmid)) {
|
LPoint3f pmid2 = (p1 + p2) * 0.5f;
|
||||||
return true;
|
|
||||||
|
if ((pmid - pmid2).length_squared() > 0.001f) {
|
||||||
|
// Subdivide.
|
||||||
|
if (intersects_parabola(t, parabola, t1, tmid, p1, pmid)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return intersects_parabola(t, parabola, tmid, t2, pmid, p2);
|
||||||
}
|
}
|
||||||
return intersects_parabola(t, parabola, tmid, t2, pmid, p2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The line segment is sufficiently close; compare the segment itself.
|
// The line segment is sufficiently close; compare the segment itself.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user