如何将一组 2D 点(多点)转换为多边形?
我有一组密集的、不规则分布的二维点(“分散在各处”)。它们可以存储在单个 MULTIPOINT WKT 对象中,包括“孔”或(如果需要)作为 delaunay 三角形。
您如何将其转换为多边形,即一个外部边界和零个、一个或多个内部边界?
PS 这不是我正在寻找的最大封闭多边形(可以通过 ConvexHull 或 ConcaveHull 解决)。我正在寻找与分散点集(包括内部边界)具有相同形状的真实多边形。
I have a set of dense, irregurarly distributed 2D points ("scattered all over the place"). They can be stored in a single MULTIPOINT WKT object including "holes" or - if needed - as delaunay triangles.
How would you convert this into a polygon, i.e. one outer boundary and zero, one or more inner boundaries?
P.S. It's not the largest enclosing polygon I'm looking for (that would be solved by ConvexHull or ConcaveHull). I'm looking for a true polygon with the same shape as the scattered point set (including inner boundary).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题对我来说就像“找到一个具有给定点集作为顶点的多边形”。这种解释正确吗?
如果是这样,您可以执行以下操作: 创建点的凸包。从考虑中删除这些点,并取剩余点的凸包。以此类推,直到没有剩余点为止。中间结果将是一系列相互嵌套的凸多边形。您可以通过连接每个后续的多边形对将它们变成单个多边形。您可以通过从每个多边形中删除一条边来连接两个多边形,然后“以相反的方式”连接生成的端点。必须注意这些连接不要与其他任何内容重叠,但这应该不会太难。
请注意,当我阅读时,有许多可能的结果满足规范。如果您需要特定的选择,则必须提供有关该选择标准的详细信息。
Your question reads to me like “find a polygon which has a given set of points as vertices.” Is that interpretation correct?
If so, you can do the following: Create the convex hull of your points. Remove those points from consideration, and take the convex hull of the remaining points. Proceed in this fashion until there are no more remaining points. The intermediate result will be a sequence of convex polygones nested inside one another. You can turn them into a single polygon by connecting each subsequent pair of polygons. You connect two polygons by removing an edge from each, and connecting the resulting endpoints ”the other way round”. Some care has to be taken that these connections don't overlap anything else, but that shouldn't be too hard.
Note that there are many possible results fulfilling the specification as I read it. If you need a specific one, you'll have to give details on the criteria for that choice.
使用 QHull:http://www.qhull.org/
这是事实上的 此类事情的标准。
Use QHull: http://www.qhull.org/
It is the de facto standard for this sort of thing.