Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def rotation_matrix(rx, ry, rz):
- """
- Not sure if the calculation is right.
- """
- rx, ry, rz = map(np.radians, (rx, ry, rz))
- rxs, rys, rzs = np.sin((rx, ry, rz))
- rxc, ryc, rzc = np.cos((rx, ry, rz))
- Rx = np.array([
- (1, 0, 0),
- (0, rxc, -rxs),
- (0, rxs, rxc)
- ])
- Ry = np.array([
- (ryc, 0, rys),
- (0, 1, 0),
- (-rys, 0, ryc)
- ])
- Rz = np.array([
- (rzc, -rzs, 0),
- (rzs, rzc, 0),
- (0, 0, 1)
- ])
- return Rz @ Ry @ Rx
- print(
- np.round(
- rotation_matrix(0, 0, 90),
- 1,
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement