-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[Sketcher] Command for B-spline by knot #8530
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
[Sketcher] Command for B-spline by knot #8530
Conversation
c95887e
to
63a4dcc
Compare
63a4dcc
to
d921776
Compare
d921776
to
a664343
Compare
a664343
to
8c829c2
Compare
@abdullahtahiriyo Do you have time to make a review? I have a minimal product ready, which so far only utilizes existing OCCT functionality. spline-by-interpolation-demo-.2.mp4Promising, but a lot of limitations. The rational B-spline issues are still there. Since the weights are not constrained, dragging can result in erratic behaviour. |
8c829c2
to
2aa4c1c
Compare
I hope to be able by the end of the week, I have to PRs I must deal with before that. |
23739d9
to
cfef445
Compare
Ok. You were fast fixing the mid to start and the typos. I did not do a detailed review. Just had a quick look and tested it. The command delivers on its description. If interpolating per knot is what is intended, it is okeish. As it is now, weights are not constrained to non-rational, which leads to lots of DoFs. Even after constraining weights to non-rational, it leads to more DoFs than necessary for interpolation. Aside from the issues of weights becoming near zero and lack of convergence associated to unconstrained poles and the excess of DoFs, it does what it promises by the title. I ran the same example of interpolating through 5 fixed points, with this tool (result is 7 poles) and generating a normal 5 pole BSpline and constraining it point on object. The number of DoFs is lower with the second method. It is easier to work with, if interpolation is all that is needed. I will give it another go later on or during the weekend. Do you have a roadmap of how many different new construction methods you want to implement? |
Thanks. It was more of something I missed rather than a bug to hunt so it was straightforward.
Indeed. OK-ish is an apt description. It delivers on the expectation, but the results might not be exactly what the user intended.
I believe there I once modified a command (in Sketcher App) that automatically applies the weight equality constraints. I'll dig into that and see if it can be used. Indeed there are more DoFs than necessary, and I don't know what is the typical method people employ for that in software with more mature spline support. It would be restrictive to not allow all possible curves satisfying the constraints. I think the best idea here would be to take users' input once this is ready.
The problem here is that it is intended that the user only provide the interpolation points and the software take care from there. In that case, how do you suggest we differentiate between which of the provided points becomes knots and which become just point-on-object?
For this particular project I just intend to add this and a periodic version. The word of the project is technically satisfied, but the results are not fully satisfactory. Apart from the possibility of non-uniformity (i.e. unequal gaps between knot parameters), I also want to add the ability to specify the degree of continuity at every knot. In the future, this construction method may also be able to allow specifying tangents, but that's outside the scope of the present PR. |
Ok. Yes, I think we could benefit quite a lot from additional input from users.
|
cfef445
to
dfa47c8
Compare
Here's a list of tasks remaining. I've divided them into things that can be done with present OCCT functionality, and things that may need a new algorithm. With OCCT functionality:
New functionality needed:
|
dfa47c8
to
3eceedd
Compare
fc225e3
to
5d760a4
Compare
Looked into it and the solution indeed was straightforward. With the latest commit periodic B-splines should automatically close.
We are using slightly different definitions of "same" here. The behaviour is same to the extent that the closure does not happen. As you can see in the latest commit, the solutions also are the same. The only difference is in the response from OCCT after the command eventually reaches it, which you could rightly argue reflects differently to the user. Do note that in case of the regular tool, the resultant B-spline has repeat control points (which are coincident) instead of the last point being deleted.
I'll make a issue then.
|
You guys are all over it and doing an awesome job! Thank you. I will keep pushing for faster iteration in the future. It's unfortunate that we've caused people to rely on the development branch being stable. It's making us be too tentative about merging things. Faster iteration solves a lot of our problems and creates very few new ones. |
@abdullahtahiriyo disappearing vertices issue reported: #8978. |
Brad, here we have diverging views. I think it is very fortunate that people rely on master being reasonably stable. Because this ensures we get timely feedback. If master became unstable, (a lot of) people would stop using it and a lot of feedback would only come from (yearly) releases. Intensive testing of master aside, within release cycle corrections are vital for FreeCAD success. New features are shaped by the fast feedback only because there is feedback. There is feedback because a substantial amount of users understand they can rely on FreeCAD master being reasonably stable. Of course there is a balance between quality and merge rate. As often in life, virtue lies on the right balance. Specific of this PR, Ajinkya generally produces good quality code. Some corner cases with unacceptable behaviour were detected. Other unrelated issues were detected. We (mostly Ajinkya) separated ones from the others. Fixed the ones relating to this feature (I presume). And as soon as I have time (will definitely happen before the weekend), I will test and merge. Some guidelines remain (this has nothing to do with this PR, it is just general information):
My approach may be perceived as egoistic as it leans toward maintainer time. Reality is that what I want is to merge right away. Review code once, test once and hit the button. This leaves more time available for me to review other PRs and to code my own ideas. This does not mean I do no want to be consulted early if the developer sees impeding difficulties or have doubts about the soundness of the architecture being used. I should be consulted early to avoid loss to effort and frustration. It means that, when the situation is balanced, I can make an optimum allocation of resources, and often, life allowing, I can be reasonably responsive to all. For times were I cannot be responsive, and other maintainers are not available or prefer to defer to me due to the nature of the PR, I would propose that contributors run development of different features in parallel, so that they are not stopped waiting. If the features are of different WBs, it may be better for diversification, but also several features of a single WB could work. |
Only creates 1-degree splines by describing knots. This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
Specifically, when drawing by interpolation, only cubic splines are currently supported. Some related "TODO" comments are also removed or modified. This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
Some parts of `DrawSketchHandlerBSplineByInterpolation` were taken from `DrawSketchHandlerBSpline` but not modified to reflect the differences. This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
As a side-effect also prevents a segfault possible by providing just 3 points. [Sketcher] Clarify that mults might not be followed Some examples when this may be ignored include: 1. A number higher than 3 is given (because cubic B-splines are created) 2. If the knots just before and just after have multiplicities >=3, the piece between these two is fully continuous, and this (middles) point will only be constrained with point-on-object. This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench" [Sketcher] Add better icons for `CreateBSplineByInterpolation` Courtesy @PaddleStroke.
Commented out the periodic version for now since they don't work completely well. This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
The default factors set in `addConstraintInternalAlignmentKnotPoint` does not work if the knots around a C1 knot are not equally far.
This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench".
See FreeCAD#8530 (comment). When there are already existing points and coincidence auto-constraints are added in the process of making a B-spline (either by control points or interpolation), unintended behaviour can happen. Additionally, when creating B-spline by interpolation, if consecutive points are coincident (or very close to each other), the OCCT algorithm fails. This is also prevented in this commit.
5d760a4
to
d8fa4d2
Compare
Yes!! Thank you very much. |
See FreeCAD#8530 (comment). When there are already existing points and coincidence auto-constraints are added in the process of making a B-spline (either by control points or interpolation), unintended behaviour can happen. Additionally, when creating B-spline by interpolation, if consecutive points are coincident (or very close to each other), the OCCT algorithm fails. This is also prevented in this commit.
Adds a new
DrawSketchHandler
for creating B-splines by interpolation. Each provided point is treated as a knot.Fixes #8529.
This project is being funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"