Implement static Line.intersect() and use it to speed up Curve.getIntersections()

Unfortunately doesn't seem to have any impact!
This commit is contained in:
Jürg Lehni 2013-05-04 10:22:10 -07:00
parent 4eff5bf45e
commit f704b00e00
2 changed files with 28 additions and 2 deletions
src/path

View file

@ -753,8 +753,13 @@ statics: {
});
/*#*/ }
// See if the parametric equations of the lines interesct.
var point = new Line(v1[0], v1[1], v1[6], v1[7], false)
.intersect(new Line(v2[0], v2[1], v2[6], v2[7], false));
// var point = new Line(v1[0], v1[1], v1[6], v1[7], false)
// .intersect(new Line(v2[0], v2[1], v2[6], v2[7], false));
// Use static version without creation of Line objects, but it
// doesn't seem to yield measurable speed improvements!
var point = Line.intersect(
v1[0], v1[1], v1[6], v1[7],
v2[0], v2[1], v2[6], v2[7], false);
if (point) {
// Avoid duplicates when hitting segments (closed paths too)
var first = locations[0],