Could you please explain this change?
Please follow coding style.
s / 2
I'd say that's abuse of auto even though the name contains "Matrix".
Please don't indent cases.
Why ry and rx?
We are using the result to check if there's orientation. It's not really a good idea to compare doubles to 0 so I changed to int.
Please add a whitespace between "&&" and the method name.