Sketcher Hyperbola Support

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Hyperbola Support

Post by abdullah »

Ok. I have just finished rebasing the old work to current master:

https://github.com/abdullahtahiriyo/Fre ... ola_2016_2

I have been trying to remember where we were...

CURRENT STATUS:

I. Creation, moving of endpoints

It sometimes crosses the endpoints, so that one endpoint is drawn on the other side of the origin, e.g.:
hyperbola_endpoints_switched_on_creation.png
hyperbola_endpoints_switched_on_creation.png (3.58 KiB) Viewed 2248 times
when on the drawing, this can be fixed by dragging one endpoint by the origin to "overtake" the other endpoint.

Sometimes during the moving a created hyperbola the edge jumps to generate the previous situation.

You get more or less jumping and this kind of issues depending on the solver you have selected (Dense,Sparse,LM,DL,...)

II. Tangent/perpendicular constraints are not yet implemented

III. Deletion of all internal geometry when deleting an hyperbola

IV. An icon for Arc of hyperbola creation by center (O), major radius (a), first endpoint, second endpoint

Then also the icons for the Elements widget...

I think there were some icons for hyperbola made by jmaust a time ago... I will take a look...

More or less, this can be done as for today:
hyperbola_show.png
hyperbola_show.png (20.92 KiB) Viewed 2248 times
The most worrying part is I, because it is what makes it look edgy. I still have to take some more time to work with it, debug it, and surely more issues will arise...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Sketcher Hyperbola Support

Post by triplus »

Hello @abdullah and welcome back. :)

P.S. As for the work you already started doing looking good.
hinckel
Posts: 113
Joined: Fri Nov 21, 2014 11:45 am
Location: SJCAMPOS, SP - BR

Re: Sketcher Hyperbola Support

Post by hinckel »

And here is my wish for the parabola segment.
I want to draw a parabola defined by two points; p1 and p2 and the tangent lines to the parabola at these same points.
Should it help, the math for working this out is presented in pdf attached.(It is in portuguese and I hope the derivation is
understandable. If a translations is needed please let me know.)
Oops. Looks like pdf files may no be attached. will email it.)
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Sketcher Hyperbola Support

Post by sgrogan »

abdullah wrote:Hi guys,

I am slowly getting into pace again.
I had missed this. Welcome back abdullah! I hope your doing well :)
"fight the good fight"
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Hyperbola Support

Post by abdullah »

triplus wrote:Hello @abdullah and welcome back.
sgrogan wrote:I had missed this. Welcome back abdullah! I hope your doing well
Thanks guys!
hinckel wrote:And here is my wish for the parabola segment.
I intend to implement parabola after hyperbola is finished. BTW, you can make a zip of any file extension and upload the zip (as far as size it is ok).

I has done some work today.

1. First I missed the icons, so I took Jim's icons from page 2 of this thread, modified them to define the center instead of the focus, and integrated them:
Hyperbola_create.png
Hyperbola_create.png (3.8 KiB) Viewed 2156 times
Hyperbola_create1_constr.png
Hyperbola_create1_constr.png (3.8 KiB) Viewed 2156 times
I also added the code to make the widget element work:
Hyperbola_widget_element.png
Hyperbola_widget_element.png (27 KiB) Viewed 2156 times
Then I implemented curve to hyperbola tangency (not line to hyperbola yet), using the via point method:
Curves_tangent_to_hyperbola.png
Curves_tangent_to_hyperbola.png (11.75 KiB) Viewed 2156 times
I also updated the branch in GitHub:
https://github.com/abdullahtahiriyo/Fre ... ola_2016_2
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Hyperbola Support

Post by abdullah »

Just pushed to the branch the perpendicular constraint...

I forgot to put a point-to-point tangency in the previous image, so I added it to this one...
Hyperbola_perpendicularity.png
Hyperbola_perpendicularity.png (10.78 KiB) Viewed 2148 times
From the constraints, I think that the only one missing ATM is line tangent to arc of hyperbola (other than in an endpoint).
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Hyperbola Support

Post by abdullah »

DeepSOIC wrote: Line-tangent-hyperbola:
(work in progress)
First of all, I was wrong (looks like so) when I posted that my famous mirroring technique is not valid for hyperbola... Looks like it just is:
Err = |F2_m - F1| - 2*a
However, there is a problem. It will be valid for both branches, which is bad. I have not come up with a nice way to lock this technique to a branch, so the question is open.
I can not think of a way of locking it to a branch... unless we use a point, so forcing the tangency to be a tangency via point. This is working at the moment with the 3 elements selection tangency (select hyperbola, line and a point a click tangency)...
Hyperbola_line_tangency_on_curve.png
Hyperbola_line_tangency_on_curve.png (9.96 KiB) Viewed 2146 times
Any ideas?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher Hyperbola Support

Post by DeepSOIC »

hinckel wrote:Oops. Looks like pdf files may no be attached
I moved hinckel's post with pdf attachment about parabola math to parabola thread.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Hyperbola Support

Post by abdullah »

Hi all!

Finally I have got a couple of hours to look into the problems we had with the Hyperbola. Sorry for the looong delay. I have been very busy.

1. I (think I) have managed to fix the reversing of the endpoints with respect to the edge (on construction and afterwards when dragging the curve).
2. I have implemented the autoconstraints on the endpoints.

Branch:
https://github.com/abdullahtahiriyo/Fre ... ola_2016_2

Status:
- I think the hyperbola support is usable.
- I am aware that the creation process often does not create the hyperbola that a user would expect.
- Other than that, I think no major issues exist.

Request for testing:
- I do not have much time available lately and it does not seem it will improve in the short term. If somebody could give it a try and let me know his impressions it would be great.
- I am specially interested in bugs and lack of functionality (I might have missed some functionality), but please report any problem you become aware of.

Roadmap
Unless major flaws I am not aware of are unveiled, I would like to commit this before the end of the year even if not perfect. The reason is that I no longer have much free time, I do not know when this situation will change and I would not like that this work gets lost. I still think it is better to have a non-perfect but reasonably good hyperbola support in the Sketcher than none.

Those who give it a try, let me know your honest opinion.

I think we started this in 2014, hopefully we will finish it before 2017 :-)

Regards,
Abdullah
hyperb_tests.png
hyperb_tests.png (16.65 KiB) Viewed 1976 times
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Sketcher Hyperbola Support

Post by triplus »

Hi Abdullah.

I will compile your branch in the following week and try it out.
Post Reply