Clarify the conventions for rotations in left and right handed coordinate system#1563
Conversation
|
I think your comment has the clockwise/anticlockwise mixed up for when viewing from the origin: RH CS has positive as clockwise and LH has that as anticlockwise. |
b99c055 to
29d23e9
Compare
EDIT: Sorry, you are right. It says "When viewed at a position along the positive z-axis", which basically means you are looking towards the origin. But we are looking from the origin towards inf. |
Co-authored-by: Peter Chang <peter.chang@diamond.ac.uk>
Co-authored-by: Peter Chang <peter.chang@diamond.ac.uk>
|
@PeterC-DLS thanks for the suggestions, I think this is much cleaner now. I have decided now to change the viewing direction from the positive end of the axis towards the origin. This is much easier to visualize and also the common convention (see the wiki article linked above). The conclusion stays the same. I also double-checked the additional documentation around transformations (specifically here), I don't think that there is anything there that is in contrast to the rotation conventions we define here. |
Co-authored-by: Peter Chang <peter.chang@diamond.ac.uk>
|
From Telco: this doesn't need a vote as it's more of a bugfix. Thanks for the contribution and discussion. |
There was a long-ish discussion in #1415 about which rotation convention to apply for left- and right-handed coordinate systems. Initially, it was agreed that if the
NXtransformationdepends on a coordinate system (i.e., itsdepends_onattribute points to an instanceNXcoordinate_system), the rotation is always right handed in that coordinate system, even if the the coordinate system itself is left-handed (as defined by the determinant of its base vectors.@PeterC-DLS suggested that this should not be the case. Rather, the rotation conventions should follow the handedness of the coordinate system because then the matrices don't have to be changed. So:
Rotations in left-handed coordinate systems are left-handed (i.e., they follow the left-hand rule). In a left-handed coordinate system, positive rotation about an axis is clockwise when looking from the end of the positive axis in the direction of the origin (from infinity towards the origin).
Rotations in right-handed coordinate systems are right-handed (i.e., the follow the right-hand rule). In a right-handed coordinate system, positive rotation about an axis is counter-clockwise when looking from the end of the positive axis in the direction of the origin (from infinity towards the origin).
Most importantly, the matrix transformation does not depend on handness and the same matrices can be used for left- and right-handed coordinate system (same Rodrigues' formula). Only the interpretation (“positive” direction of rotation) is different because the coordinate systems are mirror images! This will it also easier for most existing tools around
NXtransformationsto work with left-handed coordinate systems.This is also the convention that most graphic packages and math/physics textbooks follow, from what I could gather.
I am not sure if a vote is needed for these documentation changes, but they should definitely be discussed.