简体   繁体   English

长顶点的排序列表以在C#中形成多边形

[英]order list of Lat long vertices to form a polygon in C#

I have list of Lat long that form a polygon around a center point. 我有一些Lat long列表,它们围绕一个中心点形成一个多边形。 I would like to get ordered List of Lat-Long clockwise so as to connect Lat-Long Vertices in that ordered list and form non-convex polygon. 我想顺时针获取Lat-Long的有序列表,以便在该有序列表中连接Lat-Long顶点并形成非凸多边形。

The generation of a polygon from a set of vertices is ill-defined, as can be seen in the following example. 如下面的示例所示,从一组顶点生成多边形的定义不明确。

Let

A = ( 0, 0)
B = ( 3,-3)
C = ( 6,-1)
D = ( 4,-1)
E = ( 4, 1)
F = ( 6, 1)
G = ( 3, 3)

One possibility to form a polygon clockwise is 顺时针形成多边形的一种可能性是

AGFEDCBA

and the ordering 和顺序

AGEFCDBA

is a different one. 是不同的。 The first polygon is concave and the second aon is convex. 第一个多边形是凹面,第二个正负面是凸面。 If A is removed and the remaining points are mirrored at the axis GB , it is even possible to define two non-convex polygons from the given set of vertices. 如果删除A且其余点在GB轴上镜像,则甚至可以从给定的顶点集中定义两个非凸多边形。 More precisely, the set of vertices would be 更确切地说,这组顶点是

B = ( 3,-3)
C = ( 6,-1)
D = ( 4,-1)
E = ( 4, 1)
F = ( 6, 1)
G = ( 3, 3)

E' = ( 2, 1)
F' = ( 0, 1)
D' = ( 2,-1)
C' = ( 0,-1)

and the two different polygons are 而两个不同的多边形是

GEFCDB-C'-D'-E'-F'-G

and

GFEDCB-D'-C'-F'-E'-G . GFEDCB-D'-C'-F'-E'-G

However, if one ins interested in the convex hull polygon (the boundary of the convex hull) of the given vertices, there are many different algorithms to compute it. 但是,如果一个人对给定顶点的凸包多边形(凸包的边界)感兴趣,则有很多不同的算法可以计算出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM