Computer Graphics Rotation

Posted by Packy on August 12, 2019

Coordinate Frames  All of discussion in terms of operating on points  But can also change coordinate system  Example, motion means either point moves  backward, or coordinate system moves forward

移动可以是点的移动,也可以是坐标系的移动

Coordinate Frames  All of discussion in terms of operating on points  But can also change coordinate system  Example, motion means either point moves  backward, or coordinate system moves forward  p = (1,1)

Can differ both origin and orientation (e.g. 2 people)  One good example: World, camera coord frames (HI )  Camera  x  World

Coordinate Frames: In general  Can differ both origin and orientation (e.g. 2 people)  One good example: World, camera coord frames (HI )  Camera  x  0.5u  —0.6v  Camera  0.9y  2x  World  o  World

在不同坐标系下,同一个点 位置不一样。

作业

import numpy as np

def rotation_matrix_2d(deg):

  cosi = np.cos(deg*np.pi/180)

  sini = np.sin(deg*np.pi/180)

  rotation = np.matrix([[cosi,-sini],[sini, cosi]])

  return rotation

 

i = np.matrix([2,2]).T

translation_matrix = np.matrix([-1.0,-1.0]).T

rotation_matrix = rotation_matrix_2d(215.0)

\#print(rotation_matrix*i + translation_matrix)

\#print(rotation_matrix*i + rotation_matrix*translation_matrix)

print(rotation_matrix_2d(-45))

print(rotation_matrix_2d(-45)*i + rotation_matrix_2d(-45)*translation_matrix)