# Thread: Polygon inscribed within an ellipse

1. ## Polygon inscribed within an ellipse

To inscribe an equalateral polygon within a circle is easy and it is possible to know (given the size of the circle and the number of sides of the polygon) the exact length of one of the sides of the polygon but what about inscribing an equalateral polygon within an ellipse? To get the length of one of the sides in a circle the formula

R * sqrt (1-cos (360/n) *2) can be used ( among others )

where n= number of sides of polygon

But this does not work for an ellipse

Now remember the polygon must have equal length of sides which must mean that the interior angles at the vertices must be different. I have already worked out the length of side for a twelve sided polygon inscribed within an ellipse of 360 major axis and 240 minor axis as 78.24868802 but have no method other than long winded trial and error to arrive at the result. Can anyone come up with a solution.

2. One thing I can think of is that you must have all the angles add up to 2 [LaTeX ERROR: Convert failed] . Then for each angle that is going to be squished, you need one to be increased.

3. This might help to conceptualize the problem:

Elliptic Chords - Wolfram Demonstrations Project

4. I was thinking about the problem a bit and here is what I came up with. We simplify the problem a bit by considering the relative sizes of the major and minor axes. Let the long one be 1 and the smaller one be $b<1$.

You can start from the point $(1,0)$ and then go anti-clockwise given the length of the line and the coordinates where it intersects the ellipse. The algorithm is recursive.

You are given the first intersection point $(x_0, y_0)$ and the length of that, which is $L^2 = (1-x_0)^2+y_0^2$.

Then the next intersection's coordinates is $(x_1, y_1)$ and it must satisfy the following two equations.

The first is the distance from $(x_0,y_0)$

$\displaystyle(x_1-x_0)^2+(y_1-y_0)^2 = L^2 = (1-x_0)^2+y_0^2$

The second one is that the point must be on the ellipse

$\displaystyle x_1^2+\left(\frac{y_1}{b}\right)^2 = 1
$

In general these two equations become

$\displaystyle(x_{n+1}-x_n)^2+(y_{n+1}-y_n)^2 = L^2 = (1-x_n)^2+y_n^2$
$\displaystyle x_{n+1}^2+\left(\frac{y_{n+1}}{b}\right)^2 = 1$

Unfortunately, when I tried solving these equations, the solutions were very ugly, so I think this method will be best suitable for numerical calculation.

5. Originally Posted by Vlasev
I was thinking about the problem a bit and here is what I came up with. We simplify the problem a bit by considering the relative sizes of the major and minor axes. Let the long one be 1 and the smaller one be $b<1$.

You can start from the point $(1,0)$ and then go anti-clockwise given the length of the line and the coordinates where it intersects the ellipse. The algorithm is recursive.

You are given the first intersection point $(x_0, y_0)$ and the length of that, which is $L^2 = (1-x_0)^2+y_0^2$.

Then the next intersection's coordinates is $(x_1, y_1)$ and it must satisfy the following two equations.

The first is the distance from $(x_0,y_0)$

$\displaystyle(x_1-x_0)^2+(y_1-y_0)^2 = L^2 = (1-x_0)^2+y_0^2$

The second one is that the point must be on the ellipse

$\displaystyle x_1^2+\left(\frac{y_1}{b}\right)^2 = 1
$

In general these two equations become

$\displaystyle(x_{n+1}-x_n)^2+(y_{n+1}-y_n)^2 = L^2 = (1-x_n)^2+y_n^2$
$\displaystyle x_{n+1}^2+\left(\frac{y_{n+1}}{b}\right)^2 = 1$

Unfortunately, when I tried solving these equations, the solutions were very ugly, so I think this method will be best suitable for numerical calculation.
Thank you Vlasev for your reply. I couldnt trouble you further and ask you to show numerically the working out of my question that is of an ellipse 360 major axis by 240 minor and inscribed within a twelve sided equalateral polygon. I am having a little trouble following the formula you set out. My fault not yours LOL. Thank you

6. Oh, no worries. The formula I have written is worked out like this: I assumed that the first point on the n-gon is the point $(1, 0)$. Then I've assumed the length of each side of the n-gon is L and that it intersects the ellipse at points $(1,0)$ and $(x_0,y_0)$. With the first equation $L^2 = (1-x_0)^2+y_0^2$ , I have used Pythagoras' theorem to show this relationship. With the next equation, I have used Pythagoras theorem to find where the next side should intersect the ellipse. However, since I have only 1 equation with 2 variables. To solve this problem, I need one more equation. This is not hard since we have the equation of the ellipse and the point $(x_1, y_1)$ must satisfy this equation also. This becomes a system of two equations which you can solve either by hand or using software.

Now for the general case, lets assume we have calculated the position of all points up to point n with coordinates $(x_n,y_n)$. From now on, we need to use the Pythagorean theorem to find where the next vertex of the polygon is. That's what the first equation shows, where I have replaced $L^2$ with the very first equation. Then the second equation makes sure that the point is on the ellipse.

7. Originally Posted by Vlasev
Oh, no worries. The formula I have written is worked out like this: I assumed that the first point on the n-gon is the point $(1, 0)$. Then I've assumed the length of each side of the n-gon is L and that it intersects the ellipse at points $(1,0)$ and $(x_0,y_0)$. With the first equation $L^2 = (1-x_0)^2+y_0^2$ , I have used Pythagoras' theorem to show this relationship. With the next equation, I have used Pythagoras theorem to find where the next side should intersect the ellipse. However, since I have only 1 equation with 2 variables. To solve this problem, I need one more equation. This is not hard since we have the equation of the ellipse and the point $(x_1, y_1)$ must satisfy this equation also. This becomes a system of two equations which you can solve either by hand or using software.

Now for the general case, lets assume we have calculated the position of all points up to point n with coordinates $(x_n,y_n)$. From now on, we need to use the Pythagorean theorem to find where the next vertex of the polygon is. That's what the first equation shows, where I have replaced $L^2$ with the very first equation. Then the second equation makes sure that the point is on the ellipse.
Wow that was a quick reply thank you so much. Using your equation am I right in my initial working out that a twelve sided eq polygon inscribed within an ellipse of the size I originally stated will have sides of 78.248 in length. Sorry to be such a pest

8. Oh, I don't know. I haven't actually performed calculations with these equations. I can try it out. Here is a drawing to complement the above discussion:

Now, I don't know where you 12-gon "starts" but I will start it at (1,0). Since it is 12 sided, there must be 3 sides in each quadrant. Since there is symmetry there must be 2 vertices in each quadrant (for a total of 8) and then 1 vertex on each axis. So two of the points should be (1,0) and (0,b). We need to find the other two points. However, you have lengths that are different from mine. First we need to normalize them.

a = 360 --> 1
b = 240 --> 240/360 = 2/3
c = 78.248 --> 78.248/360 = 0.21376

I will plug them in to check what will happen.

9. Hello, steven, I plugged the parameters in the equations I got and unfortunately, your number 78.248 does not work. How did you get that number. Did you draw a 360x240 pixel ellipse and then try to get it by hand? Or did you make a 24-gon? Either way, I have done a calculation with a different parameter (L is around 156.497) and got the following picture

Wow, I just noticed something spooky: 156.497 = 78.248 * 2. So you either gave me 1/2 of the side that you calculated, or a 24-gon has 1/2 the side of a 12-gon.

10. Originally Posted by Vlasev
Hello, steven, I plugged the parameters in the equations I got and unfortunately, your number 78.248 does not work. How did you get that number. Did you draw a 360x240 pixel ellipse and then try to get it by hand? Or did you make a 24-gon? Either way, I have done a calculation with a different parameter (L is around 156.497) and got the following picture

Wow, I just noticed something spooky: 156.497 = 78.248 * 2. So you either gave me 1/2 of the side that you calculated, or a 24-gon has 1/2 the side of a 12-gon.
I think I understand how. I said the major axis was 360 and minor axis was 240 by that I meant measuring the ellipse from one end to the other I should have emphasised that at the start. If I were to draw the ellipse as you have in your drawing I would have drawn it with the x axis 180 and the y axis as 120.

11. Vlasev you have been extremely helpful in all your replies and time I wish to thank you and really appreciate all your efforts

12. Oh, I see, alright then. Then yes, your L works just fine!

13. I'm not sure how the OP solved his problem, if he really has done so.

So far we still have three unknown variables and just two equations. The system is still underdetermined.

The unknown variables are L, x, and y.

The equations that Vlasev pointed to are pythagoras' theorem and the cartesian ellipse equation.

If I'm not mistaken we still need one more in order to come up with a general formula for finding L.

14. rainer, i have set L in the start, so in essence I'm searching for a good value of L that will give a polygon.

15. Originally Posted by Vlasev
rainer, i have set L in the start, so in essence I'm searching for a good value of L that will give a polygon.
Oh okay. So you did it iteratively. That's cool.

Page 1 of 2 12 Last