如何向多边形的顶点和边缘添加曲率。
我正在尝试创建一些弯曲的多边形,例如curved vertices,curved edge shapes或even both
您将如何生成这些形状。 我研究了Bezier曲线,但是它们似乎很复杂,我想在提交此方法之前先知道是否有任何更简单的解决方案。
这是我的代码,用于在任何需要起点的情况下生成多边形。
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()