It seems perfectly horizontal or perfectly vertical straight-line paths are not being calculated properly.
For example below results in false
topLeft = CGPoint(x: 0, y: 0)
topRight = CGPoint(x: 100, y: 0)
let path = UIBezierPath()
path.move(to: topLeft)
path.addLine(to: topRight)
let lineLayer = CAShapeLayer()
lineLayer.path = path.cgPath
lineLayer.strokeColor = UIColor.orange.cgColor
lineLayer.lineWidth = 1.0
self.view.layer.addSublayer(lineLayer)
print(lineLayer.path.intersects(drawnPath)) // drawnPath is cgPath of hand drawn UIBezierPath()
but if you change to
topLeft = CGPoint(x: 0, y: 1)
then the line is not perfectly horizontal anymore and result is true
It seems perfectly horizontal or perfectly vertical straight-line paths are not being calculated properly.
For example below results in
falsebut if you change to
topLeft = CGPoint(x: 0, y: 1)then the line is not perfectly horizontal anymore and result is
true