求各位大神解釋下代碼
import math
def move(x, y, step, angle):
nx = x + step * math.cos(angle)
ny = y - step * math.sin(angle)
return nx, ny
沒理解,一步步是什么意思呀?
import math
def move(x, y, step, angle):
nx = x + step * math.cos(angle)
ny = y - step * math.sin(angle)
return nx, ny
沒理解,一步步是什么意思呀?
2018-03-28
舉報
2018-03-28
import math #導入math函數庫
def move(x,y,step,angle):? ?#定義一個包含四個量的函數,這個函數用于在已知原坐標的情況下,通過輸入的位移和角度算出新的坐標點
nx=x+step*math.cos(angle)? #新的x坐標是原坐標與位移的余弦之和
ny=y-step*math.sin(angle)? #新的y坐標是原坐標與位移的正弦之差,這里應該也是求和,不知道是否輸入錯誤啊
return nx,ny? #返回新的坐標值
2018-05-31
ny=y-step*math.sin(angle) 這里為什么是求差了呢?不是很理解,能不能麻煩幫忙解答一下,非常感謝。