连接点列表

时间:2015-12-31 08:03:46

标签: c#

我有一个积分清单。我需要通过所有点的线路来创建一个凸包。

var list = new List<PointD>()
{
    new PointD(1, 2),
    new PointD(1, -2),
    new PointD(4, 2),
    new PointD(2, 3),
    new PointD(2, 2),
    new PointD(2, -2),
    new PointD(4, -3),
    new PointD(2, -3),
    new PointD(4, -2),
    new PointD(6, 3),
    new PointD(6, -2),
    new PointD(5, 2),
    new PointD(5, 3),
    new PointD(4, 3)
};

我需要的是一个排序的点列表,可以通过线连接以形成如下的多边形。

  • 预先处理点数列表,因此总会有答案,不会遗漏任何分数。
  • 这些点仅通过水平或垂直线连接

enter image description here

1 个答案:

答案 0 :(得分:-1)

因此,要总结评论,您可以查看Sort Anticlockwise the points of rectilinear polygonOrthogonal convex hull