Python 坐标点平移:沿 60 度角下降
import math
def move(x, y, step, angle=0): angle = math.radians(60) # 将角度转换为弧度 nx = x + step * math.cos(angle) ny = y - step * math.sin(angle) return nx, ny
测试
x, y = 10, 20 step = 2 new_x, new_y = move(x, y, step) print('原坐标点:({}, {})'.format(x, y)) print('新坐标点:({}, {})'.format(new_x, new_y))
原文地址: https://www.cveoy.top/t/topic/nZPB 著作权归作者所有。请勿转载和采集!