Of course! I goofed it!ulrich1a wrote:I think it should be either
nx=-dy
ny=dx
or
nx=dy
ny=-dx
Sketcher: Ellipse support
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Sketcher: Ellipse support
Re: Sketcher: Ellipse support
This was wrong in my calculations:
Should have been this:F1_m = F1 - 2*d_lF1*N
Anyway it has problems converging (sketch fails to solve many times). I am going to try the squared version of the distance as error function instead of the distance...F1_m = F1 + 2*d_lF1*N
Re: Sketcher: Ellipse support
Ok. Just implemented the square distance error function. It works more or less well. Meaning my implementation of tangent was as bad as the DeepSOIC's normal distance one. With the squared distance this is much better than my previous implementation. Still, if you for the tangent line to be vertical and then you change your mind and apply a horizontal constraint to it, the solver crashes (if you help it a little bit by moving it out of the full vertical, it converges to horizontal). Needs more testing. Probably still needs improvements.
Teaser: Where can you find this?
https://github.com/abdullahtahiriyo/Fre ... master.git
79ec397..a5ee25b sketcher_ellipse2 -> sketcher_ellipse2
What how do we know you did it right?
Well you can check my math. By using sage I produce the C code of the calculations directly from the formulas, so if you check the math and it is ok, then the c code corresponding to them should be ok.
How can I check your math?
By installing sage from their web page or Ubuntu PPA, or using an online server. You can find this information previously on this thread.
The files of tangent and point on ellipse are attached to this post. Probably Ulrich's PointOnObject can be improved by using the squared distance, as in this case.
If you can suggest any improvement, please do it.
Forum moderators, is there any chance that the extension sws is allowed? This extension is for the sage work sheets. If we continue exchanging math it might be useful...
Just if you are just curious, a sage notebook looks like this:
Teaser: Where can you find this?
https://github.com/abdullahtahiriyo/Fre ... master.git
79ec397..a5ee25b sketcher_ellipse2 -> sketcher_ellipse2
What how do we know you did it right?
Well you can check my math. By using sage I produce the C code of the calculations directly from the formulas, so if you check the math and it is ok, then the c code corresponding to them should be ok.
How can I check your math?
By installing sage from their web page or Ubuntu PPA, or using an online server. You can find this information previously on this thread.
The files of tangent and point on ellipse are attached to this post. Probably Ulrich's PointOnObject can be improved by using the squared distance, as in this case.
If you can suggest any improvement, please do it.
Forum moderators, is there any chance that the extension sws is allowed? This extension is for the sage work sheets. If we continue exchanging math it might be useful...
Just if you are just curious, a sage notebook looks like this:
Re: Sketcher: Ellipse support
Ok. The temporal line tangent to ellipse award goes to DeepSOIC... (note the organisation reserves the right to reallocate the award... )
The new quest is for ellipse tangent to a circunference (note. it can be external or internal tangent)...
Edit: I forgot to say, here the parameters are the 5 of the ellipse (or anything derivable from them) + 2 (x0,y0 of center of circle) + 1 (r, radius of circle).
The new quest is for ellipse tangent to a circunference (note. it can be external or internal tangent)...
Edit: I forgot to say, here the parameters are the 5 of the ellipse (or anything derivable from them) + 2 (x0,y0 of center of circle) + 1 (r, radius of circle).
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Sketcher: Ellipse support
cool!
Maybe it is not worth doing now, and hope for a line-in-between way of doing this (i.e. a line that is tangent to ellipse and circle and has a point that is on those three).
Did you mean tangent circle? Ugh!! I wonder how will the solver explode when a circle touches an ellipse in two points . Whatever. That's not the end, one would want ellipse-to-ellipse tangency . Crazy!abdullah wrote: ellipse tangent to a circunference
Maybe it is not worth doing now, and hope for a line-in-between way of doing this (i.e. a line that is tangent to ellipse and circle and has a point that is on those three).
Re: Sketcher: Ellipse support
Well, we could certainly build it using a construction line in-between.
However, for example in the case of two circles, we do not use a construction line. Then this is the basis for the arc of circle and arc of ellipse tangent to ellipse and circle...
I was thinking on doing circle to ellipse and ellipse to ellipse, but maybe DeepSOIC is right... is it worth it?
I am open to any comments... do you think that we should focus on the already available constraints and how to make the ellipse support implementation "masterizable" without further working on those constraints?? What do you think should bear priority?? You are the users, you have the experience, let me hear your voices!!!
However, for example in the case of two circles, we do not use a construction line. Then this is the basis for the arc of circle and arc of ellipse tangent to ellipse and circle...
I was thinking on doing circle to ellipse and ellipse to ellipse, but maybe DeepSOIC is right... is it worth it?
I am open to any comments... do you think that we should focus on the already available constraints and how to make the ellipse support implementation "masterizable" without further working on those constraints?? What do you think should bear priority?? You are the users, you have the experience, let me hear your voices!!!
Re: Sketcher: Ellipse support
Hey Jim!!
Still to constrain the ellipse, I have to cheat putting a radius constraint...
See file
Still to constrain the ellipse, I have to cheat putting a radius constraint...
See file
Re: Sketcher: Ellipse support
the trick I worked out was to put a construction line at the end of the major axis (or minor would work), make this line perpendicular to the major axis construction line and tangent to the edge of the ellipse.abdullah wrote:Hey Jim!!
Still to constrain the ellipse, I have to cheat putting a radius constraint...
The line on the major axis has two point on lines and a third point on line with the centre of the ellipse.
Jim
Re: Sketcher: Ellipse support
Like this
Re: Sketcher: Ellipse support
The tangent of ellipse to circle do more or less already exist. Is it not the point on ellipse constraint withabdullah wrote:The new quest is for ellipse tangent to a circunference (note. it can be external or internal tangent)...
major radius = major radius of ellipse + / - radius of circle
and
minor radius = minor radius of ellipse + / - radius of circle?
All circles with the center point on the new ellipse should be tangent to the original ellipse.
Ulrich