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

from .haversine_distance import haversine_distance

A		: List[str]								=     6_37_81_37.0
A		: Dict								=     6_35_67_52.31_42_45
A		: Tuple								=     6_378_137




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

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

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

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

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

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


if __name__ == "__main__":
		import doctest

		doctest.testmod()

from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
		if not (is_transformers_available() and is_torch_available()):
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		from ...utils.dummy_torch_and_transformers_objects import ShapEPipeline
else:
		from .camera import create_pan_cameras
		from .pipeline_shap_e import ShapEPipeline
		from .pipeline_shap_e_img2img import ShapEImgaImgPipeline
		from .renderer import (
		    BoundingBoxVolume,
		    ImportanceRaySampler,
		    MLPNeRFModelOutput,
		    MLPNeRSTFModel,
		    ShapEParamsProjModel,
		    ShapERenderer,
		    StratifiedRaySampler,
		    VoidNeRFModel,
		)