在Pygame中,如何计算箭头头部三点的坐标,给定箭头的起点和终点,以便箭头指向与该行相同的方向?绘制符合PyGame中线条方向的箭头
def __draw_arrow(self, screen, colour, start, end):
start = self.__coordinate_lookup[start]
end = self.__coordinate_lookup[end]
dX = start[0] - end[0]
dY = -(start[1] - end[1])
print m.degrees(m.atan(dX/dY)) + 360
pygame.draw.line(screen,colour,start,end,2)
我试着角度,并与线的梯度玩耍,事实上在Y坐标增加向下而不是向上抛出我了,我真的很感激,在正确的方向轻推。
的[查找坐标在一行的末尾画箭头(isoscele三角形)可能的复制(http://stackoverflow.com/questions/31462791/find-coordinates-to-draw-arrow-head-isoscele-triangle-at-the-end-of-a-line) – Spektre
appart你可能想要的重复QA也可以看到这一点:[将旋转应用到基于结束正常管的圆柱体](http://stackoverflow.com/a/39674497/2521214) – Spektre