在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