
"""simple docstring"""
from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

_a      :			List[Any]					=							6_378_137.0
_a      :			int					=							6_356_752.314_245
_a      :			int					=							6_378_137
def 				a__   (   a   :				float       ,     a   :				float       ,     a   :				float       ,     a   :				float		):

		"""simple docstring"""







		_snake_case     :						Optional[int]						=   (AXIS_A - AXIS_B) / AXIS_A
		# Parametric latitudes
		# https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
		_snake_case     :						int						=   atan((1 - flattening) * tan(radians(a		)		)		)
		_snake_case     :						Dict						=   atan((1 - flattening) * tan(radians(a		)		)		)

		# Compute central angle between two points
		# using haversine theta. sigma =  haversine_distance / equatorial radius
		_snake_case     :						List[Any]						=   haversine_distance(a       ,     a       ,     a       ,     a		) / EQUATORIAL_RADIUS

		# Intermediate P and Q values
		_snake_case     :						Tuple						=   (b_lata + b_lata) / 2
		_snake_case     :						List[Any]						=   (b_lata - b_lata) / 2

		# Intermediate X value
		# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
		_snake_case     :						Optional[Any]						=   (sin(a		) ** 2) * (cos(a		) ** 2)
		_snake_case     :						Optional[int]						=   cos(sigma / 2		) ** 2
		_snake_case     :						Any						=   (sigma - sin(a		)) * (x_numerator / x_demonimator)

		# Intermediate Y value
		# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
		_snake_case     :						Optional[Any]						=   (cos(a		) ** 2) * (sin(a		) ** 2)
		_snake_case     :						str						=   sin(sigma / 2		) ** 2
		_snake_case     :						List[str]						=   (sigma + sin(a		)) * (y_numerator / y_denominator)

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


if __name__ == "__main__":
				import doctest

				doctest.testmod()



"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_a      :			Optional[int]					=							{
    """configuration_pix2struct""": [
        """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """Pix2StructConfig""",
        """Pix2StructTextConfig""",
        """Pix2StructVisionConfig""",
    ],
    """processing_pix2struct""": ["""Pix2StructProcessor"""],
}

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _a      :			List[Any]					=							["""Pix2StructImageProcessor"""]


try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _a      :			Dict					=							[
        """PIX2STRUCT_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """Pix2StructPreTrainedModel""",
        """Pix2StructForConditionalGeneration""",
        """Pix2StructVisionModel""",
        """Pix2StructTextModel""",
    ]

if TYPE_CHECKING:
    from .configuration_pixastruct import (
        PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP,
        PixaStructConfig,
        PixaStructTextConfig,
        PixaStructVisionConfig,
    )
    from .processing_pixastruct import PixaStructProcessor

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .image_processing_pixastruct import PixaStructImageProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_pixastruct import (
            PIX2STRUCT_PRETRAINED_MODEL_ARCHIVE_LIST,
            PixaStructForConditionalGeneration,
            PixaStructPreTrainedModel,
            PixaStructTextModel,
            PixaStructVisionModel,
        )

else:
    import sys

    _a      :			Optional[int]					=							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

