## Sketcher: Ellipse support

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
abdullah
Posts: 3898
Joined: Sun May 04, 2014 3:16 pm

### Sketcher: Ellipse support

Hi guys!

This is just to inform that I am getting busy with adding Ellipse support in the Sketcher. I am still in a very very very preliminary stage (... and I do not even know if I will be able to do it)...

I have assigned to myself Mantis tickets: 0001328 and 0001297.

Just a teaser:
Ellipse0.png (20.02 KiB) Viewed 3569 times
There is still a looong way ahead...
jmaustpc
Posts: 10566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

### Re: Sketcher: Ellipse support

great Abdullah!

I was wondering how it works, are you thinking it would be click on first Centre then Major then minor diameter? Although I suppose it will be just diameter 1 and diameter 2 as their size as determined by the point location which will in tern define which is minor and which is major?

Jim
abdullah
Posts: 3898
Joined: Sun May 04, 2014 3:16 pm

### Re: Sketcher: Ellipse support

I have an insertion method (with a button), with center point, vector of major axis (with modulus providing for major radius) and vector of minor axis (with modulus providing for minor radius). However, it still does not work properly (and I swiched to constraints, while I think about it), because I have to force somehow to two perpendicular axis, or the creation method (with reason) complains that they are not valid...

In the meanwhile I insert them with python as, for example:

Creation method has to provide somehow the angle between the X axis of the sketch and the X axis of the ellipse (via vector or other), otherwise we would not be able to have a "rotated" elipse...

... this also generates additional caveats regarding constraints:
1. New constraints? (now we have two radii)
2. New constraint for angle between elipse major axis and X axis?
...

I am still thinking about many things... when it is a little less alpha I will publish it to have some feedback.
Ellipse1.png (53.46 KiB) Viewed 3548 times
abdullah
Posts: 3898
Joined: Sun May 04, 2014 3:16 pm

### Re: Sketcher: Ellipse support

BTW, the padding works out of the box once when you have the elipses in...
Ellipse2.png (20.42 KiB) Viewed 3544 times
mrlukeparry
Posts: 655
Joined: Fri Jul 22, 2011 8:37 pm
Contact:

### Re: Sketcher: Ellipse support

Hi abdullah,

Great work so far. Do you have this in your git repo just to have a look at?

Aren't ellipses usually defined by three points and then use distance constraints to determine major and minor axes and rotation? I guess there will be also an ellipse arc too for adding an angle constraint.

I'd be interested to see how you get the point on line constraint to work. Maybe it's simpler than I think it is and only requires tweaking the arc/circle code.

Luke
abdullah
Posts: 3898
Joined: Sun May 04, 2014 3:16 pm

### Re: Sketcher: Ellipse support

Thanks guys!!
Do you have this in your git repo just to have a look at?
Not yet. At this stage it is still way too early. I am planning to release it when the implementation starts making sense. This would allow to debug and also get feedback from you guys.
Aren't ellipses usually defined by three points and then use distance constraints to determine major and minor axes and rotation?
Well, to be honest with you my trigonometry knowledge is very rusted, but I think that an Ellipse should have 5 degrees of freedom (I see this as x,y of both focuses+constraint on distance to both focuses from any point = major diameter, 2*2+1=5). Those 3 points can not be any 3 points, or you would have infinite solutions. You might start adding "constraints" to those points, (that one is on the major axis, for example)...

... There are many possible methods (and I welcome suggestions). My best option at this moment is, center point, point defining the major axis (with respect to the center point), so this is also the major radius, and then as third point, a point the ellipse must go through...
I guess there will be also an ellipse arc too for adding an angle constraint.
I plan to do it, but that is a next step.
I guess there will be also an ellipse arc too for adding an angle constraint.
That is part of the "maybe I do not manage to do it"

At this moment the constraints dealing with the center of the ellipse seem to work (This is the same as in a Circle, so the code was there). The challenge is the constraints applying to the edge. Oh, well, first I need to make the basics work and then I will focus on the rest...
saso
Posts: 1600
Joined: Fri May 16, 2014 1:14 pm
Contact:

### Re: Sketcher: Ellipse support

abdullah wrote:This is just to inform that I am getting busy with adding Ellipse support in the Sketcher. I am still in a very very very preliminary stage (... and I do not even know if I will be able to do it)...
I have lost count on all the things you do Really appreciate your efforts and everyone's else that are pushing this project forward at such a fast pace.
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

### Re: Sketcher: Ellipse support

I would use the center point, end point of axis1 and a point the ellipse must go through, which defines the length of axis2.
In this way the center point of the ellipse and the rotation of the ellipse are defined. The rotation of the ellipse should not change, if axis2 becomes longer than axis1.
An arc of the ellipse will have two more constraints: start angle and end angle.

Ulrich
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm

### Re: Sketcher: Ellipse support

This is great.

Next you will have to allow trimming of an ellipse.

Okay, I will shut up for now.

Thanks for your work! It is really cool to see new contributors to FreeCAD code base.
quick61
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

### Re: Sketcher: Ellipse support

Next you will have to allow trimming of an ellipse.
And then it's on to Bsplines and Bezier curves?

Yes, great work and looking good. Awaiting an upload to start testing with bated breath....
This post made with 0.0% Micro\$oft products - GOT LINUX?