Open saraedum opened 3 years ago
Hi, @saraedum , sorry for delay with response Do you mean that two segments touch in one point but touching is not exact? You'd better add data example Thanks, Alex
I believe that there should be an intersection point reported here since the two segments touch (modulo tolerance):
const {Point, Segment} = require("@flatten-js/core");
const a = new Segment(new Point(-1, 0), new Point(0, 0));
const b = new Segment(new Point(1e-30, 0), new Point(1, 0));
a.intersect(b)
However, a.intersect(b)
is empty.
Looking at the implementation, I understand that
Segment.intersect(Segment)
should return a single point if two segments are collinear and touch. (The documentation does not really mention this I think.)However, the implementation eventually calls
intersectSegment2Segment
which compares the bounding boxes without adding an epsilon: https://github.com/alexbol99/flatten-js/blob/master/src/algorithms/intersection.js#L141I think this leads to points that are touching up to an epsilon not always to be reported as such.
I could try to create a reproducer for this. But I am not sure if this is the desired behavior.