(1) nx , ny 先平移 (-ox,-oy),得到 nx2, ny2
nx2 = nx - ox , ny2 = ny - oy
(2) nx2, ny2 經由旋轉矩陣,旋轉 theta 度,得到對應的 x, y
x = nx2 * cos(theta) + ny2 * sin(theta) + ox
(3) 再將 x, y 平移 (ox, oy)
y = -nx2 * sin(theta) + ny2 * cos(theta) + oy
Code Implement
沒有留言:
張貼留言