Finding position of endpoint on an ellipse's perimeter given axes

78 Views Asked by At

Given the semiaxes and $d$ (where $d$ starts at the semimajor axis and ends at point $A$), is there a formula to calculate the position of the endpoint on the ellipse perimeter?

In my case, the semimajor axis $(a) = 5$, the semiminor axis $(b) = 4$, and $d = 4.12$.

enter image description here

1

There are 1 best solutions below

0
On

Thank you all for your responses.

What I ended up doing was a more basic approach. I created a function to solve for y using the ellipse formula (((x^2)/a^2))+((y^2)/(b^2))=1, rewritten as:

y2 = Perihelion * Sqr(1 - ((x2 ^ 2) / (Aphelion ^ 2))), and with the y value I added the distance between the points to the 'sumarclength' until it equaled the actual arc length, with considerations for arc lengths over 180deg.

for the below =>

Aphelion = vAphelion.Value
Perihelion = vPerihelion.Value
EllipsePerimeter = 2 * Application.WorksheetFunction.Pi() * Sqr(((Aphelion ^ 2) + (Perihelion ^ 2)) / 2)
TotalTravel = ((vTimePIElapsed * vOrbitalSpeed.Value) + vOrbitalRotationInitialOffset.Value) / 1000000
FullRotations = Application.WorksheetFunction.RoundDown(TotalTravel / EllipsePerimeter, 0)
ExpArcLength = TotalTravel - (EllipsePerimeter * FullRotations)
OrbitDriection = f

If ExpArcLength > 0.5 * EllipsePerimeter Then
  ExpArcLength = ExpArcLength - (EllipsePerimeter * 0.5)
  SumArcLength = 0
  x1 = -Aphelion
  y1 = 0
  For xc = -Aphelion To Aphelion Step 0.0001
    x2 = xc
    y2 = Perihelion * Sqr(1 - ((x2 ^ 2) / (Aphelion ^ 2)))
    AddArcLength = Sqr(((x2 - x1) ^ 2) + ((y2 - y1) ^ 2))
    SumArcLength = SumArcLength + AddArcLength
    x1 = x2
    y1 = y2
    If SumArcLength > ExpArcLength Then Exit For
  Next xc
  modY = 1
Else
  SumArcLength = 0
  x1 = Aphelion
  y1 = 0
  For xc = Aphelion To -Aphelion Step -0.0001
    x2 = xc
    y2 = Perihelion * Sqr(1 - ((x2 ^ 2) / (Aphelion ^ 2)))
    AddArcLength = Sqr(((x2 - x1) ^ 2) + ((y2 - y1) ^ 2))
    SumArcLength = SumArcLength + AddArcLength
    x1 = x2
    y1 = y2
    If SumArcLength > ExpArcLength Then Exit For
  Next xc
  modY = -1
End If
OrbitalDistance = Sqr((x2 ^ 2) + (y2 ^ 2))
OffsetX = x2
OffsetY = y2 * modY

Its not the "math" way I was trying to do it but it is pretty accurate