bezierjs
bezierjs copied to clipboard
`intersects(line)` returns `[]` When one of Bessel's endpoints is on a horizontal line segment
Hi!
intersects(line)
returns []
When one of Bessel's endpoints is on a horizontal line segment.
It is similar to #76 .
const { Bezier } = require("bezier-js");
const fromPos = [629, 340.5];
const fromPosCP = [791.875, 537.03515625];
const toPosCP = [741.75, 366.5];
const toPos = [920.75, 415.5];
const b = new Bezier([...fromPos, ...fromPosCP, ...toPosCP, ...toPos]);
const line = {
p1: { x: 900, y: 415.5 },
p2: { x: 950, y: 415.5 }
};
console.log(b.intersects(line)); // []
Obviously toPos
is on the line
, but intersects(line)
returns []
.
I can reproduce When I tilt the line a bit it works but an epsilon tilt is not enough
Ray cast using (0, 1)
vector from the center of the beetle
Ray cast using (1, 50)
vector from the center of the beetle
Could it be related to the fact that it this case the intersection occurs at the min/max point of a curve?
I think I got it wrong Will update next week with findings