New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Fix projectPoint method #5307
Draft: Fix projectPoint method #5307
Conversation
I can confirm that this code fixes the issue in the forum topic. Thanks for that. Repeating this test: https://forum.freecadweb.org/viewtopic.php?p=557743#p557743 with the new code shows the improved accuracy. The deviation of the local Z from zero goes from ca. 1e-5 to ca. 1e-15! I am not that experienced with Python, but why do you use: Two small remarks:
|
Although effectively in the case of Base.Vector we can use
Using
It should be the responsibility of the programmer not to pass a null vector as the direction of the projection. |
Thanks for your answers.
Yes, the calling code would have to catch the None return. Implementing that would be more involved. But it is perhaps possible to create an independent project_point function in |
There are only two functions (in gui_selectplane.py and gui_snapper.py) that use the direction argument of projectPoint, so we can use |
fcd4386
to
1cd0124
Compare
@Roy-043 can you test again? |
Thanks for the work on this guys! Also very high-level math for me 😅 |
BTW @Roy-043 I have invited you to the "FreeCAD Reviewers" group here on github (you should see an invite somewhere) so you can be asked a review, if you don't mind of course. |
@marioalexis84 Thanks. The code works fine. |
@yorikvanhavre My Python knowledge is still limited. But I do not mind testing code. |
Thanks for testing! Ok to merge @marioalexis84 ? |
I am not sure how important this is, but I notice that the epsilon value is very small (2.2e-16). It is much smaller than the tolerance used elsewhere. F.e. App.Rotation() uses a tolerance of 1e-7. Shorter vectors are ignored. |
The class Base::Vector also use this precision value. No need to use OCCT precision.
It's ok to me. |
It is worth noting that this particular case (orthogonality) occurs only if we project in parallel to WorkingPlane, which is not a useful case. |
In any case indeed it would deserve to have a better discussion over overall Draft precision... Okay, let's merge already! |
see https://forum.freecadweb.org/viewtopic.php?f=23&t=59903&sid=b6fcc8f0fae011760ddf1cd858ba354a
Thank you for creating a pull request to contribute to FreeCAD! To ease integration, we ask you to conform to the following items. Pull requests which don't satisfy all the items below might be rejected. If you are in doubt with any of the items below, don't hesitate to ask for help in the FreeCAD forum!
App
,Base
,Gui
or one of theMod
subfolders. If you need to make changes in several locations, make several pull requests and wait for the first one to be merged before submitting the next onesgit pull --rebase upstream master
./bin/FreeCAD --run-test 0
Fixes typo in Draft Move command text
Draft: Fixed typos
issue #<id>
orfixes #<id>
where<id>
is the FreeCAD bug tracker issue number in case a particular commit solves or is related to an existing issue on the tracker. Ex:Draft: fix typos - fixes #0004805
And please remember to update the Wiki with the features added or changed once this PR is merged.
Note: If you don't have wiki access, then please mention your contribution on the 0.20 Changelog Forum Thread.