Help with fillet approximation math

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
dtay
Posts: 20
Joined: Fri Jan 17, 2020 12:52 pm

Help with fillet approximation math

Post by dtay »

Hi,
I am trying to approximate accurate point positions on a fillet. The fillet is at the edge of a hole placed perpendicularly through a cylinder wall. In this image you can see between the quadrants around the hole there is a mismatch. The pink point does not align to the contact point of the fillet and green sphere.
Spherical_coord_fillet_position.JPG
Spherical_coord_fillet_position.JPG (110.21 KiB) Viewed 905 times
I would like to know if I should look at affine rotations to correct this or if it is possible within spherical coordinates? Or is there a better approach?

Any input would be appreciated!
Attachments
sphere_coord_affine_question.FCStd
(142.54 KiB) Downloaded 20 times
dtay
Posts: 20
Joined: Fri Jan 17, 2020 12:52 pm

Re: Help with fillet approximation math

Post by dtay »

Hi again,

I made some progress on this. I ended up using quaternions and rotors:
phpBB [video]


I'm sure that the Placement API can handle arbitrary axis rotations, but I went a different route and learned some math along the way.
I used the code form this repository: https://github.com/jimijimi/rotor. And the Linkstage branch.

Just a follow up :)
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Help with fillet approximation math

Post by edwilliams16 »

dtay wrote: Sun Jun 05, 2022 5:24 pm I'm sure that the Placement API can handle arbitrary axis rotations, but I went a different route and learned some math along the way.
I used the code form this repository: https://github.com/jimijimi/rotor. And the Linkstage branch.

Just a follow up :)
You are of course correct in saying that FreeCAD has an API for rotations. The function rotate( point, angle, vector ) from the above repository could be written:

Code: Select all

point = App.Vector(1, 2, 3)
axis = App.Vector(1, 1, 1) #axis direction need not be normalized
angle = 45 #degrees
rot = App.Rotation(axis, angle)
rotatedPoint = rot.multVec(point)
Here's some material on the Rotation and Placement APIs: https://wiki.freecadweb.org/Sandbox:Edw ... #Rotations
Quaternions are the preferred implementation for rotations. You might enjoy https://www.youtube.com/watch?v=zjMuIxRvygQ and https://www.youtube.com/watch?v=d4EgbgTm0Bg by Grant Sanderson.
dtay
Posts: 20
Joined: Fri Jan 17, 2020 12:52 pm

Re: Help with fillet approximation math

Post by dtay »

Hi Ed,

Thank you for the code and the links! The 3B1B linear algebra series has been very useful. Your Sandbox is a good resource as well. multVec() in particular was a bit of a blackbox for me, but your examples help a lot. It would be nice to see your API documentation integrated in to the official wiki pages.

This site was useful in understanding 4x4 matrices: http://www.codinglabs.net/article_world ... atrix.aspx
And this one for quaternions:https://www.meccanismocomplesso.org/en/ ... th-python/

I now have some 5 axis G code generated within FreeCAD:
phpBB [video]
Post Reply