点列表的 RGeo 凸包

RGeo convex hull of list of points

RGeo有可用的凸包方法,但在这方面根本没有文档。

给定一组点,如何找到它们的凸包?

好问题。事实证明,有一种名为“MultiPoint”的几何类型适用于此。我做了一个简单的例子来测试它,它似乎运行良好。

f = RGeo::Geos.factory(:srid => 3361, :buffer_resolution => 8) #my typical local rectilinear projection factory with my default settings.
coords = [[1,1], [2,2], [1,3]]
points = []
coords.each {|x,y| points << f.point(x,y)}

f.multi_point(points).convex_hull