gcode预览测试
This commit is contained in:
25
refer/test_rot.py
Normal file
25
refer/test_rot.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import numpy as np
|
||||
import math
|
||||
|
||||
rx = math.radians(-60.0)
|
||||
rz = math.radians(45.0)
|
||||
cosX, sinX = math.cos(rx), math.sin(rx)
|
||||
cosZ, sinZ = math.cos(rz), math.sin(rz)
|
||||
# Original code rotation matrix
|
||||
rot = np.array([
|
||||
[cosZ, -sinZ*cosX, sinZ*sinX, 0],
|
||||
[sinZ, cosZ*cosX, -cosZ*sinX, 0],
|
||||
[0, sinX, cosX, 0],
|
||||
[0, 0, 0, 1]
|
||||
])
|
||||
print("Original rot:\\n", rot)
|
||||
|
||||
# Correct orbit Rx @ Rz
|
||||
rot_correct = np.array([
|
||||
[cosZ, -sinZ, 0, 0],
|
||||
[cosX*sinZ, cosX*cosZ, -sinX, 0],
|
||||
[sinX*sinZ, sinX*cosZ, cosX, 0],
|
||||
[0, 0, 0, 1]
|
||||
])
|
||||
print("Rx @ Rz:\\n", rot_correct)
|
||||
|
||||
Reference in New Issue
Block a user