制作使用Python

问题描述 投票:0回答:1

我做了一个小计划,要求宽度,房间的lenght并计算为M2。我需要图形表示电缆在地板上的应有图形表示。这是我的拱门代码:

# Add C-shaped curves at the end of each section for i in range(int(width // spacing)): theta = np.linspace(0, np.pi, 100) x_curve = length + (spacing / 2) * np.cos(theta) y_curve = (i + 1) * spacing + (spacing / 2) * np.sin(theta) color = 'blue' if total_length < 5 else 'red' ax.plot(x_curve, y_curve, color=color) total_length += np.pi * (spacing / 2)
我是一个初学者,所以我尝试了到目前为止所知道的。如果有人可以指导我或尽可能地帮助我。 This i what i got from my code

当您绘制

y_curve
时,使用Theta的余弦而不是正弦将其旋转。另外,由于您想连接线条,因此将半圆的中心提升到两个相邻的线之间:
(i + 0.5)

。这是为我显示正确Y坐标的行:

python graphics
1个回答
0
投票


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.