datum dialog does not perform Euler or Cardan transformation on rotations

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

datum dialog does not perform Euler or Cardan transformation on rotations

Post by uwestoehr »

I fail on this simple task: I need a datum plane whose normal vector has the direction 1,1,1 (45° from all 3 coordinate axes)

At first I tried to create a datum line to get the normal for the plane. So I set the datum line onto the x-axis and then rotated it around the y and the z-axis. The result however is not the desired datum line in direction 1,1,1:
Datum-plane-issue.FCStd
test case
(12.93 KiB) Downloaded 178 times

Obviously I made a mistake since after I created the datum line, I see in the Data -> Attachment a strange rotation angle and axis.

The same if for a datum plan - rotating it twice by 45° does not lead to the desired result.

How is this task done?

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19145 (Git)
Build type: Release
Branch: master
Hash: c43315728cc643c6a382af0bba5b596407bbaf26
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Last edited by uwestoehr on Mon Jan 06, 2020 11:29 pm, edited 1 time in total.
chrisb
Veteran
Posts: 54313
Joined: Tue Mar 17, 2015 9:14 am

Re: how to create datum plane and line with defined angle

Post by chrisb »

Why not construct it the way you describe it:
- create DatumPoints in (0,0,0) and (1,1,1)
- create a DatumLine through these points
- create a plane normal to this line.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
hammax
Veteran
Posts: 1995
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: how to create datum plane and line with defined angle

Post by hammax »

… if CAD doesn't deliver enough insight, I always try it with "ancient" geometry.
Cube => three corner points => Sketcher plane on them.

DatumPlane.PNG
DatumPlane.PNG (25.47 KiB) Viewed 1381 times
Attachments
Datum-plane-issue_2.FCStd
(18.54 KiB) Downloaded 195 times
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: how to create datum plane and line with defined angle

Post by uwestoehr »

chrisb wrote: Sun Jan 05, 2020 8:26 am Why not construct it the way you describe it:
- create DatumPoints in (0,0,0) and (1,1,1)...
I know I can do this but what is wrong by achieving the same with 2 rotations around two axes? See attached the difference:
Datum-plane-issue.FCStd
(17.98 KiB) Downloaded 179 times
The yellow datums are correct and were created using datum points, the red ones were created using rotations.
screenshot
screenshot
FreeCAD_tIswR0sb4J.png (103.69 KiB) Viewed 1348 times
So either I have a severe thinko or the datum plane rotation has an issue. I want to assure that the latter is not the case and of course to understand why the rotation method fails so that I can describe it in the Wiki.
User avatar
hammax
Veteran
Posts: 1995
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: how to create datum plane and line with defined angle

Post by hammax »

My first test to position your plane with Placement and Euler angles went also wrong.
https://en.wikipedia.org/wiki/Euler_angles
Roll 45 is not at all the correct angle. They must be known. Yaw 45° and Roll 54,736° (measured).
Calculate: angle = arc_tan(1/√2) - 90°

Something similar is the definition of the YZ-Sketcher plane => 120° if you look into placement under DataTab.
I didn't understand this weird trick since using FreeCAD.
Why not turn the XY plane simply 90° around Y-axis like XZ?
And why not defining it (0, 1, 1)? (1, 1 ,0); (1, 0, 1)
Some Vector mathematics.
https://forum.freecadweb.org/viewtopic.php?f=8&t=42169


DatumPlane_2.PNG
DatumPlane_2.PNG (23.02 KiB) Viewed 1339 times
Last edited by hammax on Mon Jan 06, 2020 2:04 pm, edited 2 times in total.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: how to create datum plane and line with defined angle

Post by uwestoehr »

hammax wrote: Sun Jan 05, 2020 3:36 pm My first test to position your plane with Placement and Euler angels went also wrong.
Pitch 45 and Yaw 45 are not at all the correct angles. They must be known.
But that's the point. The ya, pitch and roll angles in FC's datum dialog are no Euler angles but obviously Cardan angles. I tried to use the Cardan transformation matrix to convert a vector (1,0,0) in fixed space to (1,1,1) in fixed space ,but failed. So how is this done? I mean there is a solution: Yaw 0°, Pitch 45° and Roll approx. 35 °
mario52
Veteran
Posts: 4701
Joined: Wed May 16, 2012 2:13 pm

Re: how to create datum plane and line with defined angle

Post by mario52 »

hi

and if you tray with rotation camera

Macro_View_Rotation

Macro_FCCamera

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: how to create datum plane and line with defined angle

Post by uwestoehr »

mario52 wrote: Sun Jan 05, 2020 10:18 pm and if you tray with rotation camera...
That doesn't help me. I need to understand how FC works and if it works correctly. So I need to know the transformation matrix FC uses for the Cardan angles. Then I can calculate the necessary angles, Moreover I can add this important info to the Wiki that other users don't have the same problem.
mario52
Veteran
Posts: 4701
Joined: Wed May 16, 2012 2:13 pm

Re: how to create datum plane and line with defined angle

Post by mario52 »

hi

ok (it was for your work..),

but for the wiki explain well why (also in the Placement page):

1: Euler angle (XY'Z''):

for the rotation on the axis Z = Yaw Euler angle, in FreeCAD the axis X is modified and the rotation is done on Z axis
(personally i never understood)

how to create datum plane and line with defined angle00.png
how to create datum plane and line with defined angle00.png (11.77 KiB) Viewed 1272 times
2: Rotation axis with angle:

rotation on axis Z, the axis Z is modified

how to create datum plane and line with defined angle01.png
how to create datum plane and line with defined angle01.png (11.41 KiB) Viewed 1272 times

thanks

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: how to create datum plane and line with defined angle

Post by uwestoehr »

mario52 wrote: Mon Jan 06, 2020 10:15 am but for the wiki explain well why (also in the Placement page):
Hi Mario, thank you. nevertheless, you misunderstood me. The datum dialog offers rotations and there is no choose between Euler and only around one axis. Since one needs in practice datums a lot, we need to explain the users how the datum dialog works.
As I found out the rotation angles are no Euler angles but Cardan angles. This is an important difference (the third Euler angle rotated around the first rotation axis too). However, to get e.g. a datum line in the direction 1,1,1 the user is lost since one cannot use the Cardan rotation matrix to calculate the necessary angles.

So what I nee to find out is what the datum dialog actually does and if there is not maybe a bug (it seems so). So in the Wiki page for the datum feature I need to inform the users about the rotation matrix used by the dialog and make this clear with an example.
I had a look in the code but could not yet find out code that makes it clear to me what is happening on rotation. Any pointer and info is highly appreciated.

-------------------------------

Update: I am pretty sure now that there is a bug in the datum dialog because when I use 2 bodies and rotate one of it by each 45° Roll and Pitch using the placement dialog, the normal of the xy-plane of the rotated parts has the direction 1,1,1 in the unrotated coordinate system.
Here is the example file to demonstrate this:
Datum-plane-issue.FCStd
demonstration of correct rotation using placement dialog
(23.37 KiB) Downloaded 142 times

Or do I have a severe thinko?
Post Reply