Saturday, June 13, 2026
HomeiOS Developmentios - the way to discover the intersection level of two strains...

ios – the way to discover the intersection level of two strains in a single UIBezierPath?

[ad_1]

I’ve one UIBezierPath wherein the consumer provides random factors and features are constructed between the factors
Right here is my code

var lassoBezier: UIBezierPath?
 var lassoPoints: [CGPoint] = []

func addPont(level: CGPoint) {
 guard let lassoBezier = lassoBezier else {
            lassoBezier = UIBezierPath()
            addPont(level: level)
            return
        }
        if lassoPoints.isEmpty {
            lassoBezier.transfer(to: level)
        } else {
            lassoBezier.addLine(to: level)
        }
        lassoPoints.append(level)
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = lassoBezier.cgPath
        shapeLayer.strokeColor = UIColor.pink.cgColor

        shapeLayer.lineWidth = 4
        imageView?.layer.addSublayer(shapeLayer)
}

I must cease the power so as to add factors if a minimum of one line intersects with an present one, and discover the present intersection level

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments