View Issue Details

IDProjectCategoryView StatusLast Update
0002314DraftBugpublic2017-01-15 02:18
Reporterkobejohn Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformWindowsOSWindowsOS Version10
Product Version0.15 
Fixed in Version0.15 
Summary0002314: Windows Rotation.toEuler() faulty
DescriptionIn Linux, I get what looks like reasonable results from Rotation.toEuler(). However in Windows, when angles are 90 or -90, the results of toEuler() are strange.

I will put working code in the steps to reproduce. This can be done headless or in the FreeCAD console.
Steps To Reproduceimport FreeCAD

# (-90 < angle < 90) (not inclusive of the 90s) clearly works in both windows and linux
rotation = FreeCAD.Rotation(-10, 20, -30)
rotation.toEuler() # --> (-10, 20, -30)

# angle = -90 or 90 seems to work in reality (the actual object / GUI) in both windows and linux,
# but toEuler() is strange in Windows
rotation = FreeCAD.Rotation(20, 90, 0)

rotation.toEuler()
# --> in linux (20.6, 90, 7.1) which looks like some angle wrapping?
# it works in the GUI. Is it possible these numbers are a bug also?

rotation.toEuler()
# --> in windows (0, 90, 0) which is definitely not right
# it works in the GUI.

# beyond 90 degrees, I get different results from linux and windows although not blatantly wrong like (0, 90, 0) so I'm not sure how to evaluate whether either of them is correct.
Tagsrotate, toEuler
FreeCAD Information

Activities

wmayer

2015-10-29 10:31

administrator   ~0006509

When testing this on Windows for the 2nd test I got the same values as you on Linux. So, there is no difference in behaviour.

But that's actually irrelevant because you ran into the so called "gimbal lock" which is a singularity.
FYI, for Euler angles there exists many different notations and we use the XY'Z'' notation (which to be correct is not called Euler angles but Tait–Bryan angles).

Here you will find some information about the gimbal lock:
https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles#Singularities

Issue History

Date Modified Username Field Change
2015-10-28 17:53 kobejohn New Issue
2015-10-28 17:56 kobejohn Tag Attached: Rotation
2015-10-28 17:56 kobejohn Tag Attached: toEuler
2015-10-29 10:31 wmayer Note Added: 0006509
2015-10-29 10:35 wmayer Status new => feedback
2016-05-05 19:56 wmayer Status feedback => closed
2016-05-05 19:56 wmayer Resolution open => no change required
2016-05-05 19:56 wmayer Fixed in Version => 0.15
2017-01-15 02:18 Kunda1 Tag Attached: rotate
2017-01-15 02:18 Kunda1 Tag Detached: Rotation