[Sketcher] Deleting arc of parabola doesn't delete internal geometry

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

[Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by jnxd »

When deleting the geometry, internal geometries of (arcs of) ellipses, circles, and hyperbolas are also deleted. The case is different for Parabolas.
ellipse-vs-parabola-arc-delete.gif
ellipse-vs-parabola-arc-delete.gif (53.72 KiB) Viewed 2621 times
Found on (three additional commits not expected to change this behavior):

Code: Select all

OS: Manjaro Linux (GNOME/gnome)
Word size of FreeCAD: 64-bit
Version: 0.20.29035 +3 (Git)
Build type: Debug
Branch: sketcher-split-join-bsplines
Hash: 76d2847f5ce962f6a212c134fba0694d08a58e8d
Python 3.10.4, Qt 5.15.4, Coin 4.0.1, OCC 7.5.3
Locale: English/United States (en_US)
Installed mods: 
  * Curves 0.4.4
  * ProDarkThemePreferencePack 1.0.0
My latest (or last) project: B-spline Construction Project.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by chrisb »

Confirmed.

Code: Select all

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.28774 (Git)
Build type: Release
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9031
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by openBrain »

Confirmed.

As a side topic, is it me or arc of hyperbola creation is very weird ? I have strange behavior with some snapping to root on the 3rd click, then virtual segments (dark yellow ones) seem to be on the wrong side of the hyperbola ?
arcs.png
arcs.png (17.03 KiB) Viewed 2420 times

Code: Select all

OS: Ubuntu 21.04 (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.20.28838 (Git)
Build type: Debug
Branch: master
Hash: 8c984359ddef000f52b51ad70cd395f1a36629ee
Python 3.9.5, Qt 5.15.2, Coin 4.0.0, Vtk 7.1.1, OCC 7.5.2
Locale: French/France (fr_FR)
openBrain
Veteran
Posts: 9031
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by openBrain »

@abdullah may you have some insights on this ?
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by abdullah »

jnxd wrote: Sun Jun 05, 2022 6:37 am The case is different for Parabolas.
There was a reason for this... out of the top of my head, I think it was related to the fact that (unlike the others), the line itself does not define the parabola beyond the points. In the others the endpoints of the line (major axis) cannot otherwise be constrained. In the parabola, you can delete the line and constraint the points. The line is not necessary (only a convenience).

However, it may well be not a good reason. I remember I doubted when deciding and decided not to. But I do not have a clear mind of ultimately why at this moment. Feel free to make an issue so that I can revisit it later (or if you want to take a look yourself, you are a very capable coder).
openBrain wrote: Wed Jun 08, 2022 10:46 am As a side topic, is it me or arc of hyperbola creation is very weird ? I have strange behavior with some snapping to root on the 3rd click, then virtual segments (dark yellow ones) seem to be on the wrong side of the hyperbola ?
I am not sure what you mean. The lines are the major axis (twice the major radius), from one branch of the hyperbola to where the other branch would be. The point is the center of the hyperbola. It looks like (a,b) here:

Image
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by jnxd »

abdullah wrote: Fri Jun 10, 2022 12:03 pm However, it may well be not a good reason. I remember I doubted when deciding and decided not to. But I do not have a clear mind of ultimately why at this moment. Feel free to make an issue so that I can revisit it later (or if you want to take a look yourself, you are a very capable coder).
The issue is raised here: https://github.com/FreeCAD/FreeCAD/issues/6969.

Thing is: because the line is not technically part of "internal geometry" of the parabola, it doesn't get deleted if I delete the parabola. This is causing some malformed constraints when I try to split the parabolas like for any other curve. See https://github.com/FreeCAD/FreeCAD/pull/6971. If we do not want to remove this "axis", other alternatives are possible: we can add that axis to an internal geometry, or to search the edges for this geometry and manually delete this axis.
My latest (or last) project: B-spline Construction Project.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by abdullah »

jnxd wrote: Fri Jun 10, 2022 12:44 pm If we do not want to remove this "axis", other alternatives are possible: we can add that axis to an internal geometry, or to search the edges for this geometry and manually delete this axis.
Precisely that is the decision that needs to be made:
a) Delete the construction line (so that new parabolas are not created with this construction line); or
b) Add it to internal geometry, even when it is not (fully it).

Drawbacks
=========

The former has as a drawback that if the parabola axis needs to be constrained to an angle (for example), the user will have to create it. It is not convenient (I think).

The latter has as a drawback that then it will need to be checked everywhere where internal geometry is. We would need to ensure backward compatibility. Forward compatibility may be an issue (but I think that the next development cycle will have many of these forward compatibility issues).

Definitions
=========

While we can change definitions, it is important that we have actual definitions to call things consistently (and be able to understand each other, and manage the expectations of what we expect from FreeCAD). I think it is good to discuss about it.

Originally, "internal geometry" referred to implicitly constraining one complex geometry within another (so as to enable to constrain the complex one). There are no explicit constrains in internal geometry (well, there are those internal alignment constrains that are invisible to the user that does not change the corresponding checkbox in the constraint widget). This implicit hidden constraining, can generally not be (simply) achieved by conventional constraints.

A second consideration is the lifetime. Originally "internal geometry" was "construction geometry". It could be created and added and removed (very originally). This was unhandable and the "Expose/Hide internal geometry" toolbar button appeared. Then internal geometry was created directly with the shape.

One change I have in the pipeline is preventing deletion of internal geometry. This will also lead to the removal from the toolbar of the button to "Expose the internal geometry". After that, the internal geometry will match, from a user perspective, the definition "geometry that is created together with other geometry, and it is also only deleted when the other geometry is deleted".

So... soon internal geometry will meet two conditions:
1. Implicitly constrained into one (complex) geometry.
2. Matching the lifetime of the complex geometry.

Then in FreeCAD we have other compound geometries, which are formed by constraining together simple geometries, such as polygons. In that case:
1. We do not have a complex geometry.
2. Constraints are simple.
3. We use construction geometry that does not match the lifetime of the non-construction geometry (but without it the whole shape falls apart, if the shape is deleted the construction geometry makes no sense).

Here, making the construction geometry follow the compound (multiple elements) geometry would be overly complicated. I think this is the main reason to let it be as they are today.

The Parabola axis is somewhere in the middle. It is not implicitly constrained into one (complex geometry), because it is explicitly constrained to it. Yet, it refers to a complex geometry indirectly, and it does not create a major problem when treated as internal geometry... it is even helpful to constrain the Parabola...

... yet if we make an exception, are we discriminating the other geometries ? :lol: :lol: :lol: :lol:


Ok. It did not think it through, but there might be a third option. What if we stop enforcing the axis using normal sketcher constraints, we create a new implicit internal alignment constraint at sketcher level, then at solver level we internally use the solver constraints that would be used today. We could even call it FocalDistance...

... I need to think this through, but at least now you know what is in my mind.
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by jnxd »

abdullah wrote: Fri Jun 10, 2022 2:58 pm Ok. It did not think it through, but there might be a third option. What if we stop enforcing the axis using normal sketcher constraints, we create a new implicit internal alignment constraint at sketcher level, then at solver level we internally use the solver constraints that would be used today. We could even call it FocalDistance...

... I need to think this through, but at least now you know what is in my mind.
Quite well elaborated, thanks. I'm going to steer along "remove the axis segment from constructrions" choice(s). The focus and the "midpoint" of the arc of parabola is always defined, so if we need any enforcement on axes we can simply create a line segment between those and go forward. This sounds like the least compatibility-breaking option I can think of.
My latest (or last) project: B-spline Construction Project.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by abdullah »

jnxd wrote: Fri Jun 10, 2022 3:39 pm
abdullah wrote: Fri Jun 10, 2022 2:58 pm Ok. It did not think it through, but there might be a third option. What if we stop enforcing the axis using normal sketcher constraints, we create a new implicit internal alignment constraint at sketcher level, then at solver level we internally use the solver constraints that would be used today. We could even call it FocalDistance...

... I need to think this through, but at least now you know what is in my mind.
Quite well elaborated, thanks. I'm going to steer along "remove the axis segment from constructrions" choice(s). The focus and the "midpoint" of the arc of parabola is always defined, so if we need any enforcement on axes we can simply create a line segment between those and go forward. This sounds like the least compatibility-breaking option I can think of.
That is ok as a first approximation that does not break anything. It also allows you to treat parabola uniformly with the other conics. If we end up implementing the "third option", then we adapt the code. Thanks!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [Sketcher] Deleting arc of parabola doesn't delete internal geometry

Post by abdullah »

I did a short effort towards the "third option":
https://github.com/abdullahtahiriyo/Fre ... abola_axis

Caveats:
- There is no support to transform existing parabola construction axis to internal geometry. This can be done, but I am not sure it is better for forward compatibility or worse. Of course, it is backwards compatible.
- New parabolas are created with internal geometry axis (and constraints). There is no possible forward compatibility for this.

I think this gives consistency to the overall concept. Let me know your impressions.
Post Reply