Coding/Python 삽질기
[Python] 회전 이동
chobocho
2009. 8. 25. 21:52
# 원점에서 100만큼 떨어진 점 (0, 100)을 원점을 중심으로 15도씩 회전 하였을 때의 좌표
# 리스트를 계산하는 코드
import math
point_xy = []
for idx in range (0, 24) :
end_y = -100;
degree = 15.0 * idx
rad = math.pi * degree / 180.0
new_end_x = int(-end_y * math.sin(rad))
new_end_y = int(end_y * math.cos(rad))
point_xy.append((new_end_x, new_end_y))
print point_xy
[(0, -100), (25, -96), (49, -86), (70, -70), (86, -50), (96, -25), (100, 0), (96, 25), (86, 49), (70, 70), (49, 86), (25, 96), (0, 100), (-25, 96), (-50, 86), (-70, 70), (-86, 50), (-96, 25), (-100, 0), (-96, -25), (-86, -50), (-70, -70), (-50, -86), (-25, -96)]