# Ellipse from a Point and a Mirrored Tangent

Hello,

I’m trying to find a method of defining an ellipse. This can either be proceedural in grasshopper or mathematical but I can’t figure out either.

I can’t seem to upload an image so I’ll try and describe my problem.

I want an ellipse that has it’s major axis on the X axis with the furthest point being at a known location (x1,0). The ellipse must pass through two other points with known gradients which are mirrored in the X-axis.

Now, I need to find the major and minor axis values (a and b) and also the centre of the ellipse (x0,y0). I have the two points (x2,y2) and (x2,-y2) and their gradient vectors. To me there is a single solution which should be definable using either maths for geometry, but I can’t figure it out.

I wish I could upload an image, but I can’t.

Please help, thanks,

Mark

I think maybe you can’t post images in your very first post on this forum.
Do you see this upload icon when you start writing a reply?

You can scale from a circle in Y direction , and you can use Inscribed ellipse

ellipse_tangent.gh (13.2 KB)

The trouble is, the two contract points, which are mirrored, have a specific location and gradient. I think (with out testing) that your method gives a non- specific contact point.

Or maybe I’m wrong. I’ll have a test of it when I can. Thanks!!

If you already have the points A,B,C (or p0,p1,p2 in your drawing)
You can do some math and solve equations to find the points.

AB = A’N’
2AB = N’C+MC = 2*A’N’
C known which give N point and AN known
AN’ = AN+MN

ellipse from 3points.gh (15.2 KB)

Another way:

2 Likes

Thank you very much for your replies. I’ve looked at them all and I think we’re getting there.

So. It’s my fault and I should have been clearer. The centre of the ellipse (P0) is not set, or at least x0 is an unknown. The knowns are P1, P2 and P3 as well as the tangent at p2 and P3.

From your last two examples it is clear that a range of tangents are available at P2 and P3 if the centre (P0) is free to move. What I desperately need is a way to find the centre etc while keeping to the other contraints. I think it’s possible as you’ve demonstrated it.

Thanks,

Mark

Check this, an ellipse from 3 points

I’ve been trying this one today, and thought of your script.
I don’t think it applies to Mark, since he wants an ellipse from 3 points, and with specific tangents to each. Not easy!

I have ended up brute-forcing the solution (see below), but it’s only approximate, and super ugly.
Still thinking about this one…

fitellipsetest3.gh (15.5 KB)

Do you mean just p1,p2,p3 and tangent lines are known?
If yes ; p1 , “p2 and its line” are enough to find the ellipse

1 Like

Thank you for your replied. I’ll be able to test the latest suggestion soon.

Seghier, Yes, I think you have summed it up.

These two python components, try them

ellipse.zip (30.0 KB)

4 Likes

Works perfectly over here

Could you share how you solved it? I’ve been trying many approaches but never managed to crack it

Tangent of ellipse is scaled from the circle , we need to find the circle than apply the scale.

Geometric solution:

Algebraic solution

5 Likes

Brilliant. I’m going to study that geometric method closely

1 Like

That’s great. I’ll test it here. Could I ask a favour and could you put the python inside of a .gh file? I’m unable to download the python onto my work network.

Thank you both.

You can create a definition with native components just follow the video or use the components attached.

Right on time - can’t say I understand why it works yet, but it does (aside from the times the solution is impossible)

Also made it a bit more general, so it works when P1 isn’t horizontal

fitellipsetest8.gh (21.4 KB)

1 Like

It’s math, i am sure you wil understand it.
I made a definition to prove it and calculations but it is a personal research.

1 Like