-
Global to Local coordinate, Local to Global coordinateMathematics 2020. 9. 10. 17:45
Basic Concept
Base code
import numpy as np def get_R(theta): """ theta: [rad] """ R = np.array([ [np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)] ]) return R pos = np.array([1, 0]).reshape(-1, 1) heading_ang = 90 * (np.pi/180) # [rad] R = get_R(heading_ang) inv_R = np.linalg.inv(R)
Global to local coordinate
# global to local xy_local = np.dot(R, pos) print(xy_local) # [[0], [1]]
Local to global coordinate
# local to global x_global = np.dot(inv_R, xy_local) print(x_global) # [[1], [0]]
and this is the inline code
var
just like this!'Mathematics' 카테고리의 다른 글
Fuzzy System - tutorial.pdf, code (0) 2020.09.10 iterative mean, std (standard deviation) (0) 2020.09.10 [Kalman filter] code, example (0) 2020.09.10