Boolean -fix: Interpolate to find the parameter of intersection in linear curve segments

This commit is contained in:
hkrish 2013-09-21 17:26:14 +02:00
parent 0a22211393
commit f9b4321a56

View file

@ -1393,13 +1393,16 @@ new function() { // Scope for methods that require numerical integration
var point = Curve.evaluate(vcr, t, 0); var point = Curve.evaluate(vcr, t, 0);
// We do have a point on the infinite line. Check if it falls on // We do have a point on the infinite line. Check if it falls on
// the line *segment*. // the line *segment*.
if (point.x >= 0 && point.x <= rl2x) if (point.x >= 0 && point.x <= rl2x){
// Interpolate for the parameter for the intersection on line
var tl = point.x / rl2x;
if(flip) if(flip)
addLocation(locations, curve1, undefined, Curve.evaluate(vc, t, 0), addLocation(locations, curve1, tl, Curve.evaluate(vl, tl, 0),
curve2, t, Curve.evaluate(vc, t, 0)); curve2, t, Curve.evaluate(vc, t, 0));
else else
addLocation(locations, curve1, t, addLocation(locations, curve1, t, Curve.evaluate(vc, t, 0),
Curve.evaluate(vc, t, 0), curve2); curve2, tl, Curve.evaluate(vl, tl, 0));
}
} }
} }
} }