#author("2023-11-19T02:39:10+09:00","default:Miyashita","Miyashita") *MATLAB の inpolygon 的なことをやる [#w6102e87] ** [[GeometricalPredicates.jl>https://github.com/JuliaGeometry/GeometricalPredicates.jl]] [#v2f48e0b] バージョンがいつまでも v0.x のままだけど… #codeprettify(lang-julia){{ (@v1.6) pkg> status [fd0ad045] GeometricalPredicates v0.4.2 }} 何らかの頂点のデータ(xv,yv)に対して GeometricalPredicates.Point2D という型に変換して更に GeometricalPredicates.Polygon という型のポリゴンを作る.~ 内側か外側か評価する点(xp,yp)についても, GeometricalPredicates.Point2D という型の変数を使って, inpolygon で判定する. #codeprettify(lang-julia){{ using GeometricalPredicates poly = Polygon(Point.(xv,yv)...) points = Point.(xp,yp) inside = [inpolygon(poly, p) for p in points] }}