有没有办法让十字形的所有边缘都弯曲?

时间:2021-07-19 02:07:58

标签: python matlab matplotlib

我试图使十字形的所有边缘都弯曲,以减少 3D 打印图形时的压力。 我现在的代码是:

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

# DATA
L = 0.1 #m, length of arm of cross
t = L/2 #m, thickness

# VECTORS OF COORDINATES OF THE CROSS
X = np.array([L, t/2, t/2, -t/2, -t/2, -L, -L, -t/2, -t/2, t/2, t/2, L, L])
Y = np.array([t/2, t/2, L, L, t/2, t/2, -t/2, -t/2, -L, -L, -t/2, -t/2, t/2])

# PLOT
fig, ax = plt.subplots(figsize=(8,8))
ax.plot(X,Y,color='C1', linewidth=2.5)
ax.axis('equal')

circle2 = plt.Circle((L - t/2, 0), t/4, color='b', fill=False)
circle3 = plt.Circle((-L + t/2, 0), t/4, color='b', fill=False)
circle4 = plt.Circle((0, L-t/2), t/4, color='b', fill=False)
circle5 = plt.Circle((0, -L+t/2), t/4, color='b', fill=False)
circle6 = plt.Circle((0, 0), t/4, color='b', fill=False)

ax.add_patch(circle2)
ax.add_patch(circle3)
ax.add_patch(circle4)
ax.add_patch(circle5)
ax.add_patch(circle6)
plt.axis('off')
plt.show()

axis_off = ax.axis('off')

我希望弯曲四个内角和十字架两端的八个角。image of the figure the code above creates

0 个答案:

没有答案
相关问题