from numpy import *
import numpy as np


def deg2gms(deg: float) -> list:
    """
    Umrechnung von Grad in Grad-Minuten-Sekunden
    :param deg: Winkel in Grad
    :type deg: float
    :return: Winkel in Grad-Minuten-Sekunden
    :rtype: list
    """
    gra = int(deg)
    minu_f = (deg - gra) * 60
    minu = int(minu_f)
    sek = (minu_f - minu) * 60
    return [gra, minu, sek]


def deg2gra(deg: float) -> float:
    """
    Umrechnung von Grad in Gon
    :param deg: Winkel in Grad
    :type deg: float
    :return: Winkel in Gon
    :rtype: float
    """
    return deg * 10/9


def deg2rad(deg: float | np.ndarray) -> float | np.ndarray:
    """
    Umrechnung von Grad in Radiant
    :param deg: Winkel in Grad
    :type deg: float or np.ndarray
    :return: Winkel in Radiant
    :rtype: float or np.ndarray
    """
    return deg * pi / 180


def gra2gms(gra: float) -> list:
    """
    Umrechnung von Gon in Grad-Minuten-Sekunden
    :param gra: Winkel in Gon
    :type gra: float
    :return: Winkel in Grad-Minuten-Sekunden
    :rtype: list
    """
    deg = gra2deg(gra)
    gra = int(deg)
    minu_f = (deg - gra) * 60
    minu = int(minu_f)
    sek = (minu_f - minu) * 60
    return [gra, minu, sek]


def gra2rad(gra: float) -> float:
    """
    Umrechnung von Gon in Radiant
    :param gra: Winkel in Gon
    :type gra: float
    :return: Winkel in Radiant
    :rtype: float
    """
    return gra * pi / 200


def gra2deg(gra: float) -> float:
    """
    Umrechnung von Gon in Grad
    :param gra: Winkel in Gon
    :type gra: float
    :return: Winkel in Grad
    :rtype: float
    """
    return gra * 9/10


def rad2deg(rad: float) -> float:
    """
    Umrechnung von Radiant in Grad
    :param rad: Winkel in Radiant
    :type rad: float
    :return: Winkel in Grad
    :rtype: float
    """
    return rad * 180 / pi


def rad2gra(rad: float) -> float:
    """
    Umrechnung von Radiant in Gon
    :param rad: Winkel in Radiant
    :type rad: float
    :return: Winkel in Gon
    :rtype: float
    """
    return rad * 200 / pi


def rad2gms(rad: float) -> list:
    """
    Umrechnung von Radiant in Grad-Minuten-Sekunden
    :param rad: Winkel in Radiant
    :type rad: float
    :return: Winkel in Grad-Minuten-Sekunden
    :rtype: list
    """
    deg = rad2deg(rad)
    gra = int(deg)
    minu_f = (deg - gra) * 60
    minu = int(minu_f)
    sek = (minu_f - minu) * 60
    return [gra, minu, sek]


def gms2rad(gms: list) -> float:
    """
    Umrechnung von Grad-Minuten-Sekunden in Radiant
    :param gms: Winkel in Grad-Minuten-Sekunden
    :type gms: list
    :return: Winkel in Radiant
    :rtype: float
    """
    deg = gms[0] + gms[1] / 60 + gms[2] / 3600
    return deg2rad(deg)


def gms2deg(gms: list) -> float:
    """
    Umrechnung von Grad-Minuten-Sekunden in Grad
    :param gms: Winkel in Grad-Minuten-Sekunden
    :type gms: list
    :return: Winkel in Grad
    :rtype: float
    """
    deg = gms[0] + gms[1] / 60 + gms[2] / 3600
    return deg


def gms2gra(gms: list) -> float:
    """
    Umrechnung von Grad-Minuten-Sekunden in Gon
    :param gms: Winkel in Grad-Minuten-Sekunden
    :type gms: list
    :return: Winkel in Gon
    :rtype: float
    """
    deg = gms[0] + gms[1] / 60 + gms[2] / 3600
    return deg2gra(deg)
