[Sketcher] General Tangency with B-splines (re-do)#11853
[Sketcher] General Tangency with B-splines (re-do)#11853chennes merged 10 commits intoFreeCAD:mainfrom
Conversation
a273f36 to
3ce56b9
Compare
chennes
left a comment
There was a problem hiding this comment.
This is starting to come into shape, nice work. As we discussed in our chat, there are still a few issues to be worked out:
- Selection order should not matter (right now it does, you get strange results if you select the spline last instead of first).
- I will probably always want to place my point on the spline first, then add the tangency constraint -- consuming that extra constraint doesn't work right now.
- There is a phantom extra constraint in my over-constrained error messages now.
- Attempting tangency constraint without selecting a point needs to pop up a warning message explaining how to resolve the issue.
|
Is it possible to create the point if it doesn't exist? Just generate one as part of the process? ETA: We discussed this in Discord and are concerned about the possibility of it blowing up your design due to weird placement of the generated point, so maybe it's not a good idea... |
Unlike other curves, a Bspline can have tangents and perps with the same curve an arbitrary number of times. Additionally, insertion of a point seems like a new construct. If someone wants to take a jab at it with a B-spline, that would be great. I was actually hoping to copy the complaint over direct (2 selection) tangent from that for hyperbolas and all, but seems that has been "worked around" by adding the point. |
|
Sidenote: the order of selection shouldn't matter now. |
851b7d1 to
24739d2
Compare
|
Meanwhile, could we have an icon for 3-selection tangent, in the future, it may be a good idea to also "consume" any point-on-object constraint on, say, a line as well when we select it, another curve, and a point? This constraint without the point-on-object doesn't make sense. @obelisk79 @chennes something for the DWG, maybe. |
This should be fixed now. |
I'm not sure what a 3 selection tangent icon would look like. Instinctively I'm inclined to suggest not having a separate tangency symbol for this case, even though it is unique 'under the hood', I would need to better understand the need/benefit for exposing this difference to the user. Additionally, your statement about point-on-object constraints seems to contradict itself. |
Try the following:
You will see there are 2 or 3 icons now: one for tangent and two for point-on-object. I am saying that these should be combined into one constraint, so that we can't have a tangent constraint where the curves don't even touch. The icon for that (combined) constraint should be distinct from a normal tangent to show there's a point on it. Do you think that might be confusing?
Could you explain the contradiction? I'm saying a 3-selection tangent (i.e. with curves and a point) do not make sense if the point is not on both curves. |
18e8854 to
f1ef316
Compare
|
Now, tangent-at-point will "consume" any existing point-on-object constraint between the involved point and B-spline(s). With this, all issues described in #11853 (review) should be fixed. |
bd3f51c to
36af05b
Compare
chennes
left a comment
There was a problem hiding this comment.
Although this part of the code is not my area of expertise, I have some general comments on your modifications. I don't view these as merge-preventers, just suggestions for improvement that you can implement or not as you see fit.
Also, I don't much like abbreviations in variable and function names. Even for English speakers I think it makes the code more opaque, and for those for whom English is not their primary language I think it makes it much harder to understand. I know this is endemic in Sketcher (and FreeCAD as a whole), but I hate to see new code doing it.
Finally, I'd love to see some automated tests implemented in the gtest framework for this new feature.
| std::swap(geoId1, geoId2); | ||
| std::swap(crv1, crv2); | ||
| std::swap(pos1, pos2); | ||
| // FIXME: Confirm whether or not this is needed |
There was a problem hiding this comment.
Leaving this here would make me nervous: can you confirm?
There was a problem hiding this comment.
This one was about the angle: is there benefit in making the angles direction specific? That is, should this be the (counterclockwise) angle between the first and second selected curves? In that case, the same angle with selection reversed should look as if the older selection was provided with a negative angle. But it currently seems like this angle is already adjusted elsewhere: I tried different selections and same angle, and the shape remains same.
This may have use specifically when negative angles have some parametric use, though I can't think of any right now.
There was a problem hiding this comment.
I think removing this would require us to first properly document what the angle constraint means for us, not just for B-splines, but for other curves as well.
36af05b to
aedd7e2
Compare
Going through them as I can.
I'd be OK with changing some of the less obvious abbreviations in the Sketcher side. However, many on the GCS side may be mathematical terms. |
|
Found some issue with the angle rendition. Could use help from someone acquainted with the drawing aspects. @PaddleStroke maybe? |
aedd7e2 to
6527d68
Compare
|
@AjinkyaDahale if the angle switch like this, I think the start and end pos (of the line or of the spline) are maybe switching |
@PaddleStroke Would you be able to take a look? It may take me a good amount of time getting acquainted with that side of the code by myself. |
|
I don't know what I am looking at. Did you implement angle constraint between angle and bspline ? Here you want to handle the special case of line + bspline by setting the startAngle and range of the constraint. |
|
@chennes I would suggest keeping the Of course apart from that it's ideal if the whole thing compiles at each commit. EDIT: OK I see things fall apart a little in some commits, like in [Sketcher][planegcs] Fix direction issue with B-spline tangents. |
28e80a3 to
8c37fd1
Compare
These commits were apparently lost when I force pushed. Do you have them on your machine? |
It might be a good idea to keep this commit by itself so in the future if someone intends to make these numerical tests in gtest, this could be useful. |
8c37fd1 to
6094657
Compare
Not worth trying to find them, all I did was add the appropriate export to all the classes in that file. |
These are intended to use when calculating normal simply with points could be numerically expensive or otherwise nonviable.
As opposed to "punctual" that already exists for curves.
For use in angle-via-point with complex curves.
The following commits were squashed into this [Sketcher] Handle some corner cases in AngleViaPoint [Sketcher] Avoid redundant constraints with B-splines... When involving tangent, perpendicular and angle constraints. [Sketcher] Add pre-commit changes [Sketcher] Do not allow 2-selection tangent with B-spline Also... [Sketcher] Report error when using direct tangency with B-splines [Sketcher] Fix malformed constraint when B-spline is selected second To clarify, this means the second curve selected. The position of the point in selection order does not matter in angle-via-point. [Sketcher] Fix wrong number for B-Spline tangent on redundancy [Sketcher] Remove existing point-on-object in some redundant cases Particularly when point constrained on a B-spline is being used for tangent, perpendicular or angle via point with the same B-spline. [Sketcher] Fix direction issue with B-spline tangents. Without these changes the solver might try to "twist" the B-spline to make the angle between curves be 0 instead of PI (which may be closer to the initial shape).
If needed this can be moved to a gtest,
Needed for gtests currently.
6094657 to
0ed9a9b
Compare
I think I saw two of them. Anyway, let's see if this succeeds. EDIT: Still figuring it out. Hopefully 2-3 more force pushes to go. |
...for use in tests.
f8edc03 to
c1e8adc
Compare
|
@chennes if this works should I put the |
c1e8adc to
a641f8a
Compare
|
Yeah, something like |
a641f8a to
5c80bd0
Compare
d89f459 to
3f1f638
Compare
|
@AjinkyaDahale sorry to raise this after merging but all those new error messages in |
…es_1.0.gif|384px]]</br>Щёлкните по изображению, если анимация не запускается. | Добавлена касательная к рёбрам B-сплайна, что устраняет необходимость использования конечных точек и различных обходных путей. [FreeCAD/FreeCAD#11853 Запрос на..."
…es_1.0.gif|384px]]</br>Щёлкните по изображению, если анимация не запускается. | Добавлена касательная к рёбрам B-сплайна, что устраняет необходимость использования конечных точек и различных обходных путей. [FreeCAD/FreeCAD#11853 Запрос на..."
Replaces #9125 with the branch in my personal fork (as opposed to the Ondsel one).
Part of this work was done while I was part of Ondsel Inc., and the rest of the work is being supported through an FPA grant.