我正在为傅里叶变换模拟编码。在这里我要画很多本轮。我有一个一些半径值小于1,如:7x10^-14,0等。因此,当我绘制圆并将边框宽度指定为1时,我得到一个值错误:宽度大于半径。如果我把边框宽度设为零,那么圆圈就会被颜色填满,看起来很难看。所以,请告诉我一种方法,如何绘制边界和半径值小于1的圆环。代码如下:
radius_list = [0.0, 8.539660890638339e-15, 66.66666666666669, 3.3275832379191784e-14, `
1.1234667099445444e-14, 2.534379764899661e-14, 33.333333333333336, 1.018719954857117e-14,
2.0236265985141534e-14, 2.4825216024150285e-14, 66.66666666666674, 1.5953403096630258e-13`]
run = False
while not run:
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
x = x_pos
y = y_pos
for i in range(iteration):
prevx = x
prevy = y
frequency = freq_list[i]
radius = radius_list[i]
phase = phase_list[i]
print(radius)
x+= int(radius*math.cos((frequency*time) + phase + math.pi/2))
y+= int(radius*math.sin((frequency*time) + phase + math.pi/2))
**pygame.draw.circle(screen, white, (prevx, prevy), int(radius),1)**
你不能。PyGame中的绘图单位是像素。PyGame无法绘制半像素。绘制尺寸小于1的对象是没有意义的,因为PyGame无法做到:
确保最小半径为1:
您所能做的就是跳过半径小于0.5的圆:
相关问题 更多 >
编程相关推荐