如何向多边形的顶点和边添加曲率
我正在尝试创建一些曲线多边形,例如curved vertices、curved edge shapes或even both
您将如何生成这些形状。 我已经研究过贝塞尔曲线,但它们似乎非常复杂,我想知道在我使用这种方法之前是否有更简单的解决方案
如果有人需要一个起点,下面是我生成多边形的代码
def gen_poly(sides, radius=1, rotation=0):
seg = math.pi * 2 / sides
x_list = []
y_list = []
for i in range(sides):
x = math.sin(seg * i + rotation) * radius
y = math.cos(seg * i + rotation) * radius
x_list.append(x)
y_list.append(y)
x_list.append(x_list[0])
y_list.append(y_list[0])
return x_list,y_list
x,y=polygon(5)
fig = plt.figure()
ax = plt.subplot(111)
ax.plot(x, y, marker='.')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
目前没有回答
相关问题 更多 >
编程相关推荐