






from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

lowerCamelCase      :       Optional[int]    =						6_3_7_8_1_3_7.0
lowerCamelCase      :       Optional[Any]    =						6_3_5_6_7_5_2.3_1_4_2_4_5
lowerCamelCase      :       Optional[Any]    =						6378137





def    __lowerCAmelCase   (    __snake_case       ,			__snake_case       ,			__snake_case       ,			__snake_case							):
     __lowerCAmelCase             =       (AXIS_A - AXIS_B) / AXIS_A
     # Parametric latitudes
     # https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
     __lowerCAmelCase             =       atan((1 - flattening) * tan(radians(__snake_case							)							)							)
     __lowerCAmelCase             =       atan((1 - flattening) * tan(radians(__snake_case							)							)							)

     # Compute central angle between two points
     # using haversine theta. sigma =  haversine_distance / equatorial radius
     __lowerCAmelCase             =       haversine_distance(__snake_case       ,			__snake_case       ,			__snake_case       ,			__snake_case							) / EQUATORIAL_RADIUS

     # Intermediate P and Q values
     __lowerCAmelCase             =       (b_lata + b_lata) / 2
     __lowerCAmelCase             =       (b_lata - b_lata) / 2

     # Intermediate X value
     # X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
     __lowerCAmelCase             =       (sin(__snake_case							) ** 2) * (cos(__snake_case							) ** 2)
     __lowerCAmelCase             =       cos(sigma / 2							) ** 2
     __lowerCAmelCase             =       (sigma - sin(__snake_case							)) * (x_numerator / x_demonimator)

     # Intermediate Y value
     # Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
     __lowerCAmelCase             =       (cos(__snake_case							) ** 2) * (sin(__snake_case							) ** 2)
     __lowerCAmelCase             =       sin(sigma / 2							) ** 2
     __lowerCAmelCase             =       (sigma + sin(__snake_case							)) * (y_numerator / y_denominator)

     return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))


if __name__ == "__main__":
 import doctest

 doctest.testmod()














# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
lowerCamelCase      :       Dict    =						abspath(join(dirname(dirname(__file__)), '''src'''))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='''ignore''', category=FutureWarning)





def    __lowerCAmelCase   (    __snake_case							):
     from diffusers.utils.testing_utils import pytest_addoption_shared

     pytest_addoption_shared(__snake_case							)





def    __lowerCAmelCase   (    __snake_case							):
     from diffusers.utils.testing_utils import pytest_terminal_summary_main

     __lowerCAmelCase             =       terminalreporter.config.getoption("--make-reports"							)
     if make_reports:
          pytest_terminal_summary_main(__snake_case       ,			id=__snake_case							)






