Reputation: 11
i cannot find the definition of scipy's coordinate system. i have tried several values (assuming a right hand system) but got a strange result. for example:
from scipy.spatial.transform import Rotation as R
R.from_euler('zyx', angles=np.array([90,0,0]), degrees=True).as_matrix()
[ [ 0., -1., 0.], [ 1., 0., 0.], [ 0., 0., 1.]]
meaninig the counterclockwise rotation about the z axis (true for a right hand system) is inverse (meaning a left coordinate system)...
where can i find the definition??
Thanks!!!
Upvotes: 1
Views: 1368
Reputation: 41
In short, I think giving positive angle means negative rotation about the axis, since it makes sense with the result.
Normally, positive direction of rotation about z-axis is rotating from x-axis to y-axis; negative direction is from y to x.
The Documentation shows that using from_euler to initial a counter-clockwise rotation of 90 degrees about the z-axis is
R.from_euler('z', 90, degrees=True)
I guess "the counter-clockwise rotation about z-axis" from doc means "negative direction about z-axis" instead of "positive direction about z-axis".
Upvotes: 0
Reputation: 4547
The full documentation for Scipy's Rotation module can be found here. For your problem in particular, I am not sure there actually is a problem. Looking at Wikipedia, a 90-degree rotation is indeed counter-clockwise so that a vector originally aligned with the x-axis becomes aligned with the y-axis. This, I believe, is in agreement with the result of the code below.
from scipy.spatial.transform import Rotation as R
point = (5, 0, -2)
print(R.from_euler('z', angles=90, degrees=True).as_matrix() @ point)
# [0, 5, -2]
Upvotes: 1