我有一组代表闭合形状的坐标。数据似乎是随机的。当我以点为单位绘制数据时,它显示为封闭形状。但是,当我用线绘制时,线会在整个地方绘制。我使用的数据如下:
[[-43.2812, -45.9857, 104.0], [-43.2812, -45.9857, 104.0], [-43.2812, -44.9857, 104.0], [-43.2812, -43.9857, 104.0], [-43.2812, -42.9857, 104.0], [-43.2812, -41.9857, 104.0], [-43.2812, -40.9857, 104.0], [-43.2812, -39.9857, 104.0], [-43.2812, -38.9857, 104.0], [-43.2812, -37.9857, 104.0], [-43.2812, -36.9857, 104.0], [-43.2812, -35.9857, 104.0], [-43.2812, -34.9857, 104.0], [-43.2812, -33.9857, 104.0], [-43.2812, -32.9857, 104.0], [-43.2812, -31.9857, 104.0], [-43.2812, -30.9857, 104.0], [-43.2812, -29.9857, 104.0], [-43.2812, -28.9857, 104.0], [-43.2812, -27.9857, 104.0], [-43.2812, -26.9857, 104.0], [-43.2812, -25.9857, 104.0], [-43.2812, -24.9857, 104.0], [-43.2812, -23.9857, 104.0], [-43.2812, -22.9857, 104.0], [-43.2812, -21.9857, 104.0], [-43.2812, -20.9857, 104.0], [-42.9688, -20.375, 104.0], [-42.2812, -45.9857, 104.0], [-42.1875, -21.1563, 104.0], [-41.4062, -21.9375, 104.0], [-41.2812, -45.9857, 104.0], [-40.625, -21.9375, 104.0], [-40.2812, -45.9857, 104.0], [-39.8438, -22.7188, 104.0], [-39.2812, -45.9857, 104.0], [-39.0625, -23.5, 104.0], [-38.2812, -45.9857, 104.0], [-38.2812, -23.5, 104.0], [-37.5, -46.0944, 104.0], [-37.5, -24.2813, 104.0], [-36.7188, -46.2067, 104.0], [-36.7188, -25.0625, 104.0], [-35.9375, -46.2883, 104.0], [-35.9375, -25.8438, 104.0], [-35.1562, -46.3765, 104.0], [-35.1562, -25.8438, 104.0], [-34.375, -46.5072, 104.0], [-34.375, -26.625, 104.0], [-33.5938, -46.6558, 104.0], [-33.5938, -27.4063, 104.0], [-32.8125, -46.8131, 104.0], [-32.8125, -27.4063, 104.0], [-32.0312, -46.99, 104.0], [-32.0312, -28.1875, 104.0], [-31.25, -47.1963, 104.0], [-31.25, -28.9688, 104.0], [-30.4688, -47.4449, 104.0], [-30.4688, -28.9688, 104.0], [-29.6875, -47.7461, 104.0], [-29.6875, -29.75, 104.0], [-28.9062, -48.0825, 104.0], [-28.9062, -30.5313, 104.0], [-28.125, -48.3963, 104.0], [-28.125, -30.5313, 104.0], [-27.3438, -48.6363, 104.0], [-27.3438, -31.3125, 104.0], [-26.5625, -48.8008, 104.0], [-26.5625, -32.0938, 104.0], [-25.7812, -48.9242, 104.0], [-25.7812, -32.0938, 104.0], [-25.0, -49.041, 104.0], [-25.0, -32.875, 104.0], [-24.2188, -49.1659, 104.0], [-24.2188, -33.6563, 104.0], [-23.4375, -49.3011, 104.0], [-23.4375, -34.4375, 104.0], [-22.6562, -49.4438, 104.0], [-22.6562, -34.4375, 104.0], [-21.875, -49.5863, 104.0], [-21.875, -35.2188, 104.0], [-21.0938, -49.7496, 104.0], [-21.0938, -36.0, 104.0], [-20.3125, -49.9611, 104.0], [-20.3125, -36.0, 104.0], [-19.5312, -50.1867, 104.0], [-19.5312, -36.7813, 104.0], [-18.75, -50.3973, 104.0], [-18.75, -36.7813, 104.0], [-17.9688, -50.619, 104.0], [-17.9688, -36.7813, 104.0], [-17.1875, -50.8665, 104.0], [-17.1875, -37.5625, 104.0], [-16.4062, -51.1327, 104.0], [-16.4062, -37.5625, 104.0], [-15.625, -51.4081, 104.0], [-15.625, -38.3438, 104.0], [-14.8438, -51.6841, 104.0], [-14.8438, -38.3438, 104.0], [-14.0625, -51.9588, 104.0], [-14.0625, -38.3438, 104.0], [-13.2812, -52.2506, 104.0], [-13.2812, -39.125, 104.0], [-12.5, -52.6026, 104.0], [-12.5, -39.125, 104.0], [-11.7188, -53.0506, 104.0], [-11.7188, -39.125, 104.0], [-10.9375, -53.6015, 104.0], [-10.9375, -39.9063, 104.0], [-10.1562, -54.2475, 104.0], [-10.1562, -39.9063, 104.0], [-9.375, -54.9717, 104.0], [-9.375, -39.9063, 104.0], [-8.5938, -55.7477, 104.0], [-8.5938, -40.6875, 104.0], [-7.8125, -56.553, 104.0], [-7.8125, -40.6875, 104.0], [-7.0312, -57.3676, 104.0], [-7.0312, -40.6875, 104.0], [-6.25, -58.1727, 104.0], [-6.25, -40.6875, 104.0], [-5.4688, -58.9652, 104.0], [-5.4688, -40.6875, 104.0], [-4.6875, -59.7491, 104.0], [-4.6875, -40.6875, 104.0], [-3.9062, -60.5174, 104.0], [-3.9062, -40.6875, 104.0], [-3.125, -61.2621, 104.0], [-3.125, -40.6875, 104.0], [-2.3438, -61.9772, 104.0], [-2.3438, -40.6875, 104.0], [-1.5625, -62.6538, 104.0], [-1.5625, -40.6875, 104.0], [-0.7812, -63.2874, 104.0], [-0.7812, -40.6875, 104.0], [0.0, -63.8728, 104.0], [0.0, -40.6875, 104.0], [0.7812, -64.4057, 104.0], [0.7812, -40.6875, 104.0], [1.5625, -64.8889, 104.0], [1.5625, -40.6875, 104.0], [2.3438, -65.3276, 104.0], [2.3438, -40.6875, 104.0], [3.125, -65.7259, 104.0], [3.125, -40.6875, 104.0], [3.9062, -66.0813, 104.0], [3.9062, -40.6875, 104.0], [4.6875, -66.385, 104.0], [4.6875, -40.6875, 104.0], [5.4688, -66.6281, 104.0], [5.4688, -40.6875, 104.0], [6.25, -66.8054, 104.0], [6.25, -40.6875, 104.0], [7.0312, -66.9169, 104.0], [7.0312, -40.6875, 104.0], [7.8125, -66.9709, 104.0], [7.8125, -39.9063, 104.0], [8.5938, -66.9871, 104.0], [8.5938, -39.9063, 104.0], [9.375, -39.9063, 104.0], [9.5938, -66.9871, 104.0], [10.1562, -39.9063, 104.0], [10.5938, -66.9871, 104.0], [10.9375, -39.9063, 104.0], [11.5938, -66.9871, 104.0], [11.7188, -39.125, 104.0], [12.5, -39.125, 104.0], [12.5938, -66.9871, 104.0], [13.2812, -38.3438, 104.0], [13.5938, -66.9871, 104.0], [14.0625, -38.3438, 104.0], [14.5938, -66.9871, 104.0], [14.8438, -38.3438, 104.0], [15.5938, -66.9871, 104.0], [15.625, -37.5625, 104.0], [16.4062, -37.5625, 104.0], [16.5938, -66.9871, 104.0], [17.1875, -36.7813, 104.0], [17.5938, -66.9871, 104.0], [17.9688, -36.7813, 104.0], [18.5938, -66.9871, 104.0], [18.75, -36.0, 104.0], [19.5312, -36.0, 104.0], [19.5938, -66.9871, 104.0], [20.3125, -35.2188, 104.0], [20.5938, -66.9871, 104.0], [21.0938, -34.4375, 104.0], [21.5938, -66.9871, 104.0], [21.875, -34.4375, 104.0], [22.5938, -66.9871, 104.0], [22.6562, -33.6563, 104.0], [23.4375, -32.875, 104.0], [23.5938, -66.9871, 104.0], [24.2188, -32.875, 104.0], [24.5938, -66.9871, 104.0], [25.0, -32.0938, 104.0], [25.5938, -66.9871, 104.0], [25.7812, -31.3125, 104.0], [26.5625, -31.3125, 104.0], [26.5938, -66.9871, 104.0], [27.3438, -30.5313, 104.0], [27.5938, -66.9871, 104.0], [28.125, -29.75, 104.0], [28.5938, -66.9871, 104.0], [28.5938, -66.9871, 104.0], [28.5938, -65.9871, 104.0], [28.5938, -64.9871, 104.0], [28.5938, -63.9871, 104.0], [28.5938, -62.9871, 104.0], [28.5938, -61.9871, 104.0], [28.5938, -60.9871, 104.0], [28.5938, -59.9871, 104.0], [28.5938, -58.9871, 104.0], [28.5938, -57.9871, 104.0], [28.5938, -56.9871, 104.0], [28.5938, -55.9871, 104.0], [28.5938, -54.9871, 104.0], [28.5938, -53.9871, 104.0], [28.5938, -52.9871, 104.0], [28.5938, -51.9871, 104.0], [28.5938, -50.9871, 104.0], [28.5938, -49.9871, 104.0], [28.5938, -48.9871, 104.0], [28.5938, -47.9871, 104.0], [28.5938, -46.9871, 104.0], [28.5938, -45.9871, 104.0], [28.5938, -44.9871, 104.0], [28.5938, -43.9871, 104.0], [28.5938, -42.9871, 104.0], [28.5938, -41.9871, 104.0], [28.5938, -40.9871, 104.0], [28.5938, -39.9871, 104.0], [28.5938, -38.9871, 104.0], [28.5938, -37.9871, 104.0], [28.5938, -36.9871, 104.0], [28.5938, -35.9871, 104.0], [28.5938, -34.9871, 104.0], [28.5938, -33.9871, 104.0], [28.5938, -32.9871, 104.0], [28.5938, -31.9871, 104.0], [28.5938, -30.9871, 104.0], [28.5938, -29.9871, 104.0]]
有没有一种方法可以对这些点进行排序,以使它们井然有序。当我画线时,我想要一个闭合的形状。
我需要数据按此特定顺序排列,因为我想导出它。立即导出数据时,该数据无法在我正在使用的其他程序中使用。
谢谢。
答案 0 :(得分:1)
在对您的问题发表的评论中,我提到了convex hull。以下算法确实不是必然会产生“ 凸” 船体,但它会产生船体(可能是凹面),并且可能适合您的目的。