在多边形内获取一个

在多边形内获取一个

本文介绍了在多边形内获取一个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一列点是描述多边形的闭合路径,我如何得到一个必须位于多边形区域内的点? 我不知道凹多边形的情况,但当凸起多边形的情况下,所有点的平均值位于多边形内。I have a list of points that is a closed path to describe the polygon, how can I get a point that must locate inside the polygon area?I have no idea with the case of concave polygon,but the average of all the points locate inside the polygon when the case come to convex polygon.推荐答案 https://mathoverflow.net/questions/56655 / get-a-point-inside-a-polygon链接到: http://www.exaflop.org/docs/cgafaq/cga2.html#Subject%202.06:%20How%20do%20I%20find%20a%20single%20point%20inside%20a%20simple%20polygon部分说明:which says, in part:Given a simple polygon, find some point inside it. Here is a method based on the proof thatthere exists an internal diagonal, in [O'Rourke, 13-14]. The idea is that the midpoint ofa diagonal is interior to the polygon.1. Identify a convex vertex v; let its adjacent vertices be a and b.2. For each other vertex q do:2a. If q is inside avb, compute distance to v (orthogonal to ab).2b. Save point q if distance is a new min.3. If no point is inside, return midpoint of ab, or centroid of avb.4. Else if some point inside, qv is internal: return its midpoint. 这篇关于在多边形内获取一个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 08:03