import runge_kutta as rk
from numpy import sin, cos, tan
import winkelumrechnungen as wu
from ellipsoide import EllipsoidBiaxial
import numpy as np
from numpy.typing import NDArray

def gha1(re: EllipsoidBiaxial, phi0: float, lamb0: float, alpha0: float, s: float, num: int) -> Tuple[float, float, float]:
    def buildODE():
        def ODE(s, v):
            phi, lam, A = v
            V = re.V(phi)
            dphi = cos(A) * V ** 3 / re.c
            dlam = sin(A) * V / (cos(phi) * re.c)
            dA = tan(phi) * sin(A) * V / re.c
            return np.array([dphi, dlam, dA])
        return ODE

    _, funktionswerte = rk.rk4(buildODE(), 0, np.array([phi0, lamb0, alpha0]), s, num)
    return funktionswerte[-1][0], funktionswerte[-1][1], funktionswerte[-1][2]
