判断一个坐标点是否在封闭曲线内的方法(swift)

移动开发 作者: 2024-08-24 18:10:01
1 //用playground运行即可 2 import UIKit 3 4 var str = "Hello, playground" 5 6 let lTestPointsOn
 1 //用playground运行即可
 2 import UIKit
 3 
 4 var str = "Hello,playground"
 5 
 6 let lTestPointsOne : [(Double,Double)]  = [(0,0)]
 7 let lTestPoints : [(Double,1)">0),(1),1)">1,1)">1 8 let lPoints : [(Double,1)">2),1)">2,1)">3,1)"> 9 
10 func judgeIf(point:(Double,Double),isIn pointArr:[(Double,Double)])->Bool{
11     if 0 == pointArr.count {
12         return false
13     }
14     let lPath = UIBezierPath.init()
15     let l1stPoint = pointArr.first
16     lPath.move(to: CGPoint.init(x: l1stPoint!.))
17     
18     for i in 1..<pointArr.count {
19         let lP = pointArr[i]
20         lPath.addLine(to: CGPoint.init(x: lP.21 22     
23     lPath.close()
24     return lPath.contains(CGPoint.init(x: point.25 }
26 
27 print(lPoints)
28 judgeIf(point: (),isIn: lPoints)
29 judgeIf(point: (30 judgeIf(point: (31 judgeIf(point: (0.5,1)">232 judgeIf(point: (33 judgeIf(point: (34 judgeIf(point: (0.535 judgeIf(point: (1.536 judgeIf(point: (37 judgeIf(point: (3.3,1)">8.138 
39 judgeIf(point: (40 judgeIf(point: (41 judgeIf(point: (42 judgeIf(point: (0.743 judgeIf(point: (0.144 judgeIf(point: (845 judgeIf(point: (46 
47 judgeIf(point: (48 judgeIf(point: (八叔技术之家为你收集整理的判断一个坐标点是否在封闭曲线内的方法(swift)全部内容,希望文章能够帮你解决判断一个坐标点是否在封闭曲线内的方法(swift)所遇到的程序开发问题。


       
原创声明
本站部分文章基于互联网的整理,我们会把真正“有用/优质”的文章整理提供给各位开发者。本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
本文链接:http://www.jiecseo.com/news/show_67953.html