Metron
Metron copied to clipboard
LineSegment.intersection(with:) not working properly
Confirming that LineSegment.intersection(with:)
may return nil
for valid intersection cases:
let s1 = LineSegment(a: .init(x: 187.50440979003906, y: 543.5147094726562), b: .init(x: 333.1461486816406, y: -109.8446273803711))
let s2 = LineSegment(a: .init(x: 0, y: 0), b: .init(x: 375, y: 0))
let intersection = s1.intersection(with: s2) // nil
Should not be nil
, as the two segments are intersecting at a point:
Off-topic: What software did you use to create that image?