- #1
Nicolaus
- 73
- 0
Say the focus point - the Sun - is at P(0,0), would I then determine the apoapsis (periapsis) by implementing the Pythagorean Theorem on each point to determine which point's distance is largest (smallest for periapsis) from the origin, then output the coordinates for each? Each coordinate to be checked is extracted from an array.
Exampled program for computing apoapsis:
apo = 0
do i = 1, lengthAR
d = sqrt((xAR(i)**2) + (yAR(i)**2))
if (d .gt. apo) then
apo = d
x = xAR(i)
y = yAR(i)
end if
end do
print*, "Apoapsis = ", x, y
end
Exampled program for computing apoapsis:
apo = 0
do i = 1, lengthAR
d = sqrt((xAR(i)**2) + (yAR(i)**2))
if (d .gt. apo) then
apo = d
x = xAR(i)
y = yAR(i)
end if
end do
print*, "Apoapsis = ", x, y
end