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.
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!
Help with fillet approximation math
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Help with fillet approximation math
- Attachments
-
- sphere_coord_affine_question.FCStd
- (142.54 KiB) Downloaded 22 times
Re: Help with fillet approximation math
Hi again,
I made some progress on this. I ended up using quaternions and rotors:
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
I made some progress on this. I ended up using quaternions and rotors:
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
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Help with fillet approximation math
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: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
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)
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.
Re: Help with fillet approximation math
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:
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: