Need all intersection points for curved corners

This commit is contained in:
Mark Tolmacs 2025-03-02 15:35:08 +01:00
parent e459ea0cc7
commit e1812c4c91

View file

@ -157,22 +157,13 @@ export function curveIntersectLineSegment<
return bezierEquation(c, t); return bezierEquation(c, t);
}; };
let solution = calculate(initial_guesses[0]); const solutions = [
if (solution) { calculate(initial_guesses[0]),
return [solution]; calculate(initial_guesses[1]),
} calculate(initial_guesses[2]),
].filter((x, i, a): x is Point => x !== null && a.indexOf(x) === i);
solution = calculate(initial_guesses[1]); return solutions;
if (solution) {
return [solution];
}
solution = calculate(initial_guesses[2]);
if (solution) {
return [solution];
}
return [];
} }
/** /**