# Ellipse through points...no command

Hi,
V5
if a number of points are expected to fit a circle (or vice versa !) there is the circle through points option.

Obviously if the points are random we dont even contemplate it.

Likewise its possible for an elipse to fit points.

I see no option for this though and need to plot an elipse through my points which are eliptical.

Steve

Hi,
asking again ( I see this âaskâ is 287 days old) as no replies and I have need yet again to create elipses through points that are eliptical.

I have photos of circular items taken at angles and need to plot them with elipses.

There is no command to best fit an elipse through an eliptical array of points, once I place points along the eliptical shape.

Steve

For the fun of it I tried solving that one with Grasshopper but Iâll have to leave it to the bigger brains (@DavidRutten?)

My thought was that I place two points somewhere inside the points. Have sliders to place the points to be able to plug these into Galapagos. To find the focal points of the ellipse, the sum of the distances from each of the points on the ellipse to the two foci has to be constant. The logic starts to fail when I calculate all double distances, add all together, divide by the number of points that we have and minimize that in Galapagos. Apparently this puts the foci way too close togetherâŚ

Using Galapagos wonât be fast, it takes a minute or so to really find the ideal values. It does help if you place the ellipse roughly correct already, and then use the âStart From Slider Setupâ option. The attached file only works for ellipses on the world XY plane, it is possible to extend it to include 3D orientation as well, but more work, and itâll be even slower.

ellipsefit.gh (10.0 KB)

Thanks for that, David. Iâll take a close look when I get back behind a PC.

Here is one I made using a similar method to David but using an ellipse from 3 pts function.

Galapagos is playing with 9 values here so it is not particularly quick. To speed things up you can constrain the sliders to operate within a reasonable range.

Ellipse finder.gh (16.7 KB)

Hi,
Hope the âbigger brainsâ can assist with something that is dead easy to use in rhino3d v5.

I dont have Galapagos or grasshopper and have never used them or got the time to train into them, not something I will be doing given what minimal time I have, still trying to find time to do rhino levels 1 and 2 and looking at those screen dumps when wanting to draw an elipse, is like looking at the wiring diagram of a car when wanting to simply turn the key. With 2mm accuracy required for my client, I will be considered mental if I cant draw an elipse without needing to get at Galapagos.

There must surely be a command in rhino or some code someone clever at McNeel can create to drag drop into Rhino so as to best fit an elipse to an elliptical array of points.

Steve

Hi Steve,

It really isnât as hard as it looks.

Get Grasshopper from here

Install it (you may have to restart rhino) then type in âGrasshopperâ into the rhino command line.

You will also need ghPython for my script here

http://www.food4rhino.com/project/ghpython?ufh

Download one of the codes posted here then open it up in grasshopper.

Double click on the Galapagos component (up the top in both cases above), go to the âsolversâ tab and click âStart solverâ

You will need to stop it once you are happy with the results. All the parameters used to create the ellipse will be visible in the GH window. Alternatively you can rt click on the python component and select âBake.â this will add the ellipse to the document.

Many people on this forum have taken their time to help you with your myriad problems, creating custom code when there is no âeasyâ pre built solution. We are more than happy to help, but as they say, we will help you if you help yourself!

Take a little time to try and understand how these methods work and it will help you immensely in the future.

Hi,
I will in due course go take a look, it looks complicated , I just dont associate such â thingsâ as i see there, not sure what to call them !â with basic drawing of elipses.

My current predicament is I simply dont have time to go explore as such. 15 hrs a day 7 days a week working flat out, till 4am , so dare not deviate, though itching to end this nightmare and get to explore. Having had to turn PC back 4 months to a backup as some thing I installed killed off my expensive sound card, and that is part responsible for the almost impossible quart into a pint pot I now find myself in, I also am having to do backups and mess about before installing progs to avoid such again, so no time to go doing that either. If Galapagos is the software to use to draw an elipse through points then so be it, for the mo I will have to do it the hard way. Looking fwd to trying it out when life gets back to normal.

Steve

Just draw a rectangle that touches the edges of the ellipse, and then use Ellipse->Diameter with the mid snap on.

Hi,
Oh I wish the pics were as clear cut as that
I will remember that though, as whatever angle a circle is photoed at, the elipse can be horiz as such.
Its wreckage of something with a bend that was circular, I can but place points at what I think are the locations around the circular bend then get a best fit elipse.

Steve

You should post specific examples then, because when you say:

it makes people think that you have photos of circular items taken at an angle and you want to draw an ellipse through them.

I thought this had described that I had drawn points along what was an eliptical shape, sorry if it wasnt clear enough.

through points that are eliptical. an eliptical array of points seems descriptive enough to me ?

Steve

In the simplest case, if you have photos of circular objects at an angle, then putting points along the curve is a total waste of time. The only thing that matters when drawing a true ellipse is the size and location of the major and minor axis. If your example is more complicated than what I posted, you should post a picture.

Hi skyg
an example as requested.
I am now working on a photo to do some 2D drafting sussing location of some nuts and again need an elipse through what I can see.

Here is a trace of the elipses in the picture ( I am unable for reasons I cannot go into, to post the actual picture)
I might at times also have points rather than the trace if I see areas of the elipse not enough to draw with Interp curve tool.

The item is an aircraft spinner and thus circular, the circles thus have a common axis. I need to find that axis.
The rearmost edge seems to have a slight knock so might throw results. the other two should be enough.

Only part of the spinner is visible, a circle photographed at an angle is an elipse we would think, though one could get into a deep debate over effect of perspective, focal lengths etc, maybe elipses only exist in geometry slight inacuracies dont matter in this task.

I need to put elipses to these partial elipses, the gap is where the blade is in the way. a line through their centres is my spinner axis.
Partial elipse visible find centre.3dm (31.8 KB)

Steve

Iâd make an ellipse or circle, some place. Then with Gumball set to align ;To objectâ maneuver the ellipse rotating & scaling on one axis at a time with gumball until it fits the clearest and best ellipse segment in the image. The rest will be scaled copies moved along the short axis, to which Gumball will conveniently line up.

-Pascal

Hi Pascal,
GumballAlignment command click object, got that far !
Cant get the hang of this though, I am unfamiliar with Gumball and in need of practice. This is a visual alignment as opposed to getting any snaps I assume ?
I can make my circle go eliptical one axis at a time, adjust its height, move it so elipse top matches the target curve VISUALLY, drag green square to alter height and the top of the elipse moves from where I placed it when I was wanting to extend it downwards wishing to keep top where it was, no snaps here so top is a visual placement , I am used to snaps, surprised rhino in its original toolset has no click click click along an elipse type shape and a best fit elipse occurs to that. a tail chase is developing, it keeps moving, just me being unfamiliar I guess.

Steve

Gumball scaling is always about the Gumballâs pivot point, which is by default at the bounding box center of the object. You can move the pivot point by holding down the control key, dragging the pivot point and letting up on the control key before you release the mouse button so it can snap somewhere else.

âMitch

You donât HAVE to use the gumball, there is also Scale1D and the Knot osnap and a million other tools in Rhino. Youâre matching to a photo for peteâs sake, youâll have to use your judgement at some point.

-Pascal

My hunch is that mathematically speaking, what youâre expecting here is impossible. I think in order for this to work with any sort of accuracy, you need to be able to see significantly more than 1/2 of the ellipse (2/3 or so), because you need to be able to sort out the major and minor axis of the ellipse. If you only have 1/2 of the ellipse, there is no guarantee that the line across the the center equates with the major axis. Itâs sort of like saying âI have two points on the perimeter of a circle, can I fully define the circle? No.â

All that being said, Pascalâs suggestion to use the gumball and scale/rotate/move a circle so that it lines up with your photographic data is the only approach that makes any sense at all. As I said before, if you want to create an ellipse, there is no purpose to hand picking points along a photograph and then doing a fit curve to those points. The only thing that approach leads to is madness. At least with Pascalâs method, you end up with an actual ellipse.