Closed philippeseil closed 3 years ago
I have honestly never looked at the mathematics for the rotation code in detail, but I believe you are indeed right. And you are also right that this is major behaviour to change so I'm somewhat hesitant about that.
I'm definitely going to add it as a comment and I might also add a flag to transpose before the dot.
The application of the rotation matrix (here https://github.com/WoLpH/numpy-stl/blob/develop/stl/base.py#L511 and here https://github.com/WoLpH/numpy-stl/blob/develop/stl/base.py#L514 ) is mathematically wrong, it produces clockwise rotation for positive angles. The code linked above computes row vector times matrix. Since
, rotation matrices are antisymmetric, and the multiplication with the transposed/inverse is equivalent to rotating in the opposite direction, the issue occurs. This can be easily fixed by transposing the rotation matrix before the dot() call.
You might be reluctant to change the behavior of the function in such a drastic way, which is understandable. If you decide not to fix this, please at least note it in the documentation. Thanks.