Julia中有这样的功能吗?
拼命地试图从 MATLAB 迁移到 Julia,但仍然发现自己依赖它......
GeometricalPredicates 包有inpolygon
:https ://github.com/JuliaGeometry/GeometricalPredicates.jl
您还可以调查Luxor.jl:
using Luxor
p1 = Point(0, 0)
p2 = Point(10, 0)
p3 = Point(10, 10)
p4 = Point(0, 10)
isinside(Point(5, 5), [p1, p2, p3, p4]) # true
isinside(Point(15, 5), [p1, p2, p3, p4]) # false
但请确保检查顶点和边缘异常......