gpt4 book ai didi

python - !从无序列表中绘制一个形状 Python

转载 作者:行者123 更新时间:2023-12-03 17:31:46 25 4
gpt4 key购买 nike

The list of coordinates plotted
是否有任何算法/函数可以获得这样的结果?
我不能使用凸包算法,因为不会绘制中心的矩形
Result
如果这可以帮助坐标可以是包含整个图片的矩阵的元组列表或索引

更新
External shape only using TSP algorithm
计算时间:4.14秒
点数:140

最佳答案

import turtle as t

points = [(0, 0), (0, 9), (9, 9), (9, 0), (0, 0)]

for p in points:
print(p)
x, y = p
t.goto(x, y)
此代码迭代 points 中的点列表。 Turtle 会到达我在 points 中声明的每个点列表。
这段代码是一个正方形。

关于python - !从无序列表中绘制一个形状 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52580517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com