Sketcher: Ellipse 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!
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher: Ellipse support

Post by ulrich1a »

Hi Abdullah,
It is great, that you could make a working ellipse from the posted equation. I have to admit, I got the tip for this approach from a family member. The underlying construction principle is named in the german wikipedia: gardeners construction. So the partials should be named gardeners partials. ;)
Unfortunately I do not have a copy of your git repository. I hope someone else has one.

The german wikipedia article about the ellipse does contain a tangent equation for the ellipse.
http://de.wikipedia.org/wiki/Ellipse#Ta ... dinaten.29
As a first exercise I made a ellipse-tangent-simulation in the sketcher of the master branch. I had to learn, how to multiply in the sketcher, in order to get this done. But I did not manage to multiply with negative values. So the ellipse tangent simulation works only in the +x+y quadrant.

The next exercise will be to make an error function.

Ulrich
Attachments
ellipse_tangent_simulation.fcstd
(5.04 KiB) Downloaded 53 times
Günther
Posts: 1
Joined: Wed Sep 17, 2014 10:39 pm

Re: Sketcher: Ellipse support

Post by Günther »

abdullah wrote:If someone still has a working copy of the previous elipse brach please save it. I think I have done a newbie mistake with git+I failed to listen to the signs that I was doing it and I might have lost some work. Tomorrow I will evaluate the damage...sorry guys!!!
Does not even "git reflog" still have references to the commits? git doesn't usually remove anything immediately. I usually view the commits with "gitk <commitid>" and create a branch if I still want to keep them after some mistake.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

abdullah wrote:If someone still has a working copy of the previous elipse brach please save it. I think I have done a newbie mistake with git+I failed to listen to the signs that I was doing it and I might have lost some work. Tomorrow I will evaluate the damage...sorry guys!!!

Edit: If someone has it and can put it in his own github and give me the link it might help me tomorrow...
if someone has the code but does not have (or does not know how to push it to) an external repository, you can create a tarball or zip archive. If you are on Linux this is as simple as installing "git cola", type git cola on the command line in the director containing your code, when git cola starts up, just go to the file menu and select extract as tarball/zip.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

Ok!
Here it is where I tell you guys what happened, not only to fustigate myself and feel ashamed :oops: , but also to write a few lines of a manual "how not to use git and why I did not do as Sebastian taught me to do"+"the butterfly effect"...

All started when in another thread I saw that I was based on a very old "master" compared to other contributors, and with the desire of trying to speed up compilation times when switching between branches... so what do you do? You rebase your code, very well!! so:

1. You create a new local branch "sketcher_ellipse2", and you "git rebase -i --onto master numberofcommitinmasteryouarerebasingonto"

I have done this multiple times so I do it with confidence... but I forgot to checkout sketcher_ellipse2 before rebasing (yes I am old style and do git branch newname+git checkout newname instead of git -u branch newname, this might change now).

2. I got merge conflicts. I usually solve them with git mergetool and meld that I have installed.

Meld is a beautiful 3 areas screen. One for "Remote", another one for "Base" and a third one for "local". I think I have to move the code I want to the center column and then press save and exit... This has brought (several times) an undesired effect. Either my code remains with the <HEAD> <------> <---> markings, or I am not asked for all the conflicted files, or the not wanted file gets saved (and the conflict resolved). I honestly do not know what I do wrong. Here I would like to ask you what you use and what do you recommend to graphically solve those conflicts.

So I though I have solved my conflicts correctly (which I did not). If I would had realized, it would not have been a problem, because I had a copy in github. And know comes the why? why? did you do that.

I needed to make not one, not even two, but three mistakes in a row, plus not listen to a complain from git to reach to the current situation...

3. I was in a hurry. I tested that the code would pass the "Jim-redundancy test". It did. Ergo the code is ok. Ergo let's send this to github to let the guys test... oh git complains that it can not fast-forward merge... c'mmon git, don't you have any better think to complain about... I know that my code is ok because I tested... I am in a hurry, I know I might have a problem because I rebased the branch... so I deleted the remote branch and pushed it again...

...and that is how I ended up in my current situation...

I do not tell you this so that you will be sorry. Just so that maybe, some will read it, laugh at it, and hopefully be more aware when using git...

Now I am going to see how much of a disaster it I have done...
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

Thanks Günther for the advise. I am looking into it now...
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

Ok. At the end it was not that bad and thanks to Sebastian and Günther I managed to diff the current situation against old code... it was more related to changes that happened in master in the meantime. Anyway, I learnt my lesson.

Jim (and however that wants), you should be able to test ellipse point on ellipse at:

https://github.com/abdullahtahiriyo/Fre ... master.git
sketcher_ellipse2
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

The german wikipedia article about the ellipse does contain a tangent equation for the ellipse.
http://de.wikipedia.org/wiki/Ellipse#Ta ... dinaten.29
I like it. It is full of equations!!! It looks better than the english version...

Let's see if we find an equation that rocks!!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

BTW, Ulrich, your simulation sketches get more and more interesting to see. It is like an art, you even put a part WB ellipse in the background to make it look good...
ellipse_sim_ulrich.png
ellipse_sim_ulrich.png (57.32 KiB) Viewed 2102 times
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

abdullah wrote:Ok. At the end it was not that bad and thanks to Sebastian and Günther I managed to diff the current situation against old code... it was more related to changes that happened in master in the meantime. Anyway, I learnt my lesson.

Jim (and however that wants), you should be able to test ellipse point on ellipse at:

https://github.com/abdullahtahiriyo/Fre ... master.git
sketcher_ellipse2
compiling now..... :)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher: Ellipse support

Post by DeepSOIC »

Here is my version of simulating ellipse tangent constraint using regular constraints. Not sure if it makes any help. It uses the fact that a ray of light that emerges from one focus reflects from the surface to go through another focus. Thus the normal can be derived by halving the angle between the rays.
Attachments
ellipse tangent.FCStd
simulation of ellipse tangent constraint
(3.66 KiB) Downloaded 53 times
Post Reply