
    ph                         S r SSKrSSKrSSKJr  SSKJr  SSKJr   " S S5      r	\	" \R                  \R                  5      \	l        g)aO  Define the :class:`~geographiclib.geodesic.Geodesic` class

The ellipsoid parameters are defined by the constructor.  The direct and
inverse geodesic problems are solved by

  * :meth:`~geographiclib.geodesic.Geodesic.Inverse` Solve the inverse
    geodesic problem
  * :meth:`~geographiclib.geodesic.Geodesic.Direct` Solve the direct
    geodesic problem
  * :meth:`~geographiclib.geodesic.Geodesic.ArcDirect` Solve the direct
    geodesic problem in terms of spherical arc length

:class:`~geographiclib.geodesicline.GeodesicLine` objects can be created
with

  * :meth:`~geographiclib.geodesic.Geodesic.Line`
  * :meth:`~geographiclib.geodesic.Geodesic.DirectLine`
  * :meth:`~geographiclib.geodesic.Geodesic.ArcDirectLine`
  * :meth:`~geographiclib.geodesic.Geodesic.InverseLine`

:class:`~geographiclib.polygonarea.PolygonArea` objects can be created
with

  * :meth:`~geographiclib.geodesic.Geodesic.Polygon`

The public attributes for this class are

  * :attr:`~geographiclib.geodesic.Geodesic.a`
    :attr:`~geographiclib.geodesic.Geodesic.f`

*outmask* and *caps* bit masks are

  * :const:`~geographiclib.geodesic.Geodesic.EMPTY`
  * :const:`~geographiclib.geodesic.Geodesic.LATITUDE`
  * :const:`~geographiclib.geodesic.Geodesic.LONGITUDE`
  * :const:`~geographiclib.geodesic.Geodesic.AZIMUTH`
  * :const:`~geographiclib.geodesic.Geodesic.DISTANCE`
  * :const:`~geographiclib.geodesic.Geodesic.STANDARD`
  * :const:`~geographiclib.geodesic.Geodesic.DISTANCE_IN`
  * :const:`~geographiclib.geodesic.Geodesic.REDUCEDLENGTH`
  * :const:`~geographiclib.geodesic.Geodesic.GEODESICSCALE`
  * :const:`~geographiclib.geodesic.Geodesic.AREA`
  * :const:`~geographiclib.geodesic.Geodesic.ALL`
  * :const:`~geographiclib.geodesic.Geodesic.LONG_UNROLL`

:Example:

    >>> from geographiclib.geodesic import Geodesic
    >>> # The geodesic inverse problem
    ... Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50)
    {'lat1': -41.32,
     'a12': 179.6197069334283,
     's12': 19959679.26735382,
     'lat2': 40.96,
     'azi2': 18.825195123248392,
     'azi1': 161.06766998615882,
     'lon1': 174.81,
     'lon2': -5.5}

    N)Math)	Constants)GeodesicCapabilityc                      \ rS rSrSrSr\r\r\r\r	\r
\r\r\r\\S-
  -  S-  r\r\\S-   -  S-  rSr\\R&                  R(                  -   S-   r\R.                  " \R&                  R0                  5      r\R&                  R4                  rS\-  r\R.                  " \5      r\\-  rS	\-  r\ RB                  r!\ RD                  r"\ RF                  r#\ RH                  r$\ RJ                  r%\ RL                  r&\ RN                  r'\ RP                  r(\ RR                  r)\ RT                  r*\+S
 5       r,\+S 5       r-\+S 5       r.\+S 5       r/\+S 5       r0\+S 5       r1\+S 5       r2S r3S r4S r5S r6S r7S r8S r9S r:S r;S r<S r=\ R|                  4S jr?S r@\ R|                  4S jrA\ R|                  4S jrB\ R|                  \ R                  -  4S  jrD\ R|                  \ R                  -  4S! jrE\ R|                  \ R                  -  4S" jrF\ R|                  \ R                  -  4S# jrG\ R|                  \ R                  -  4S$ jrHS(S% jrI\ R                  rJ \ R                  rK \ R                  rL \ R                  rM \ R                  rN \ R|                  r> \ R                  rC \ R                  rO \ R                  rP \ R                  rQ \ R                  rR \ R                  rSS&rTg'))GeodesicV   zSolve geodesic problems            
      i  c                    [        U5      nX@-
  nSX!-
  -  X!-   -  nSnUS-  (       a
  US-  oCU   nOSnUS-  nU(       a0  US-  nUS-  oFU-  U-
  X4   -   nUS-  oFU-  U-
  X4   -   nU(       a  M0  U (       a  SU-  U-  U-  $ X(U-
  -  $ )z9Private: Evaluate a trig series using Clenshaw summation.r   r   r
   )len)	sinpsinxcosxcknary1y0s	            nC:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\geographiclib/geodesic.py_SinCosSeriesGeodesic._SinCosSeriesz   s     	AA	A	
dk	dk	*B	
B1u1faQ4bb	QA
1fa1fa7R<!$&b1fa7R<!$&b	 !
 &*QX_r! %r'"%    c                 T   [         R                  " U 5      n[         R                  " U5      nX#-   S-
  S-  nUS:X  a  US::  Gdb  X#-  S-  n[         R                  " U5      nXF-  nXUSU-  -   -  nUn	US:  aa  XW-   n
XS:  a  [        R                  " U5      * O[        R                  " U5      -  n
[         R                  " U
5      nXUS:w  a  Xk-  OS-   -  n	OQ[        R
                  " [        R                  " U* 5      XW-   * 5      nU	SU-  [        R                  " US-  5      -  -  n	[        R                  " [         R                  " U	5      U-   5      nU	S:  a  X=U	-
  -  OX-   nX-
  SU-  -  nU[        R                  " U[         R                  " U5      -   5      U-   -  nU$ SnU$ )z Private: solve astroid equation.r
   r	   r      r      )r   sqmathsqrtcbrtatan2cos)xypqrSr2r3discuT3Tangvuvwr   s                    r   _AstroidGeodesic._Astroid   s   
 	
A
A	
aA6a1f %!)a771:b6b a"f*d
a	V 	q&tyydiio=IIbM	AF"&** jjD5)QV95 	
QUTXXcAg&&&
))DGGAJN
#aa%1A;QUb6a!e
a 		"twwqz/*Q.
/a
 H aHr   c                     / SQn[         R                  S-  n[        R                  " X!S[        R                  " U 5      5      XS-      -  nX0-   SU -
  -  $ )zPrivate: return A1-1.)r
   r   @   r      r   r   r
   )r   nA1_r   polyvalr!   epscoeffmts       r   _A1m1fGeodesic._A1m1f   O    E 	qAQq$''#,/%A,>AGC  r   c                    / SQn[         R                  " U 5      nU nSn[        S[        R                  S-   5       HK  n[        R                  U-
  S-  nU[         R
                  " XrXS5      -  X%U-   S-      -  X'   XWS-   -  nX@-  nMM     g)zPrivate: return C1.)r	       r:      	   rH      r          rQ   rL   r   r
   r   N)r   r!   ranger   nC1_r=   r?   r   r@   eps2dolrA   s           r   _C1fGeodesic._C1f       E 773<DA	A1hmma'(==1
"aa005Q3CCadq5jaha	 )r   c                    / SQn[         R                  " U 5      nU nSn[        S[        R                  S-   5       HK  n[        R                  U-
  S-  nU[         R
                  " XrXS5      -  X%U-   S-      -  X'   XWS-   -  nX@-  nMM     g)zPrivate: return C1')   iPrN   i   i  ii   i 0  it     ii
     i  ra   i  i   r   r
   r   N)r   r!   rS   r   nC1p_r=   rU   s           r   _C1pfGeodesic._C1pf   s    E 773<DA	A1hnnq()>>A!
#aa005Q3CCadq5jaha	 *r   c                     / SQn[         R                  S-  n[        R                  " X!S[        R                  " U 5      5      XS-      -  nX0-
  SU -   -  $ )zPrivate: return A2-1)iii@r   r;   r   r   r
   )r   nA2_r   r=   r!   r>   s       r   _A2m1fGeodesic._A2m1f   rE   r   c                    / SQn[         R                  " U 5      nU nSn[        S[        R                  S-   5       HK  n[        R                  U-
  S-  nU[         R
                  " XrXS5      -  X%U-   S-      -  X'   XWS-   -  nX@-  nMM     g)zPrivate: return C2)r
   r      rI   #   r:   r`   rL      P   rN      rk   rP   ?   rR   M   rL   r   r
   r   N)r   r!   rS   r   nC2_r=   rU   s           r   _C2fGeodesic._C2f   r\   r   c           
         [        U5      U l         [        U5      U l         SU R                  -
  U l        U R                  SU R                  -
  -  U l        U R                  [
        R                  " U R                  5      -  U l        U R                  SU R                  -
  -  U l        U R                  U R                  -  U l	        [
        R                  " U R                  5      [
        R                  " U R                  5      U R                  S:X  a  SOU R                  S:  a4  [        R                  " [        R                  " U R                  5      5      O4[        R                  " [        R                  " U R                  * 5      5      [        R                  " [        U R                  5      5      -  -  -   S-  U l        S[         R"                  -  [        R                  " [%        S[        U R                  5      5      ['        SSU R                  S-  -
  5      -  S-  5      -  U l        [        R*                  " U R                  5      (       a  U R                  S:  d  [-        S5      e[        R*                  " U R                  5      (       a  U R                  S:  d  [-        S5      e[/        [1        [         R2                  5      5      U l        [/        [1        [         R6                  5      5      U l        [/        [1        [         R:                  5      5      U l        U R?                  5         U RA                  5         U RC                  5         g	)
zConstruct a Geodesic object

:param a: the equatorial radius of the ellipsoid in meters
:param f: the flattening of the ellipsoid

An exception is thrown if *a* or the polar semi-axis *b* = *a* (1 -
*f*) is not a finite positive quantity.

r
   r   r   皙?gMbP?      ?z!Equatorial radius is not positivezPolar semi-axis is not positiveN)"floataf_f1_e2r   r!   _ep2_n_br"   atanhr#   atanabs_c2r   tol2_maxmin_etol2isfinite
ValueErrorlistrS   nA3x__A3xnC3x__C3xnC4x__C4x_A3coeff_C3coeff_C4coeff)selfrx   ry   s      r   __init__Geodesic.__init__  s0    1XDF41XDF#466zDHvvTVV$DH477488,,DIffTVV$DGfftxxDG$''$''"2hh!m59XX\$**TYYtxx01))DIItxxi013txx=)*#+ + -.	.DH &Cs466{4K47QtvvaxZ4H5IKL5M *O ODK==  TVVaZ:;;==!!dggk899U8>>*+DIU8>>*+DIU8>>*+DIMMOMMOMMOr   c                 (   / SQnSnSn[        [        R                  S-
  SS5       Hh  n[        [        R                  U-
  S-
  U5      n[        R
                  " XQX R                  5      XU-   S-      -  U R                  U'   US-  nX%S-   -  nMj     g)z#Private: return coefficients for A3)   r   r:   rG   r   rG   rj   r    rG   r      r
   rG   r   r
   r
   r   r
   rG   r   N)rS   r   nA3_r   r   r=   r}   r   )r   r@   rX   r   jrA   s         r   r   Geodesic._A3coeffC  s    E 	
Aq18==1$b"-
hmma!#Q
'a\\!Aww7%A	:JJdiil1faq5ja	 .r   c                 p   / SQnSnSn[        S[        R                  5       H  n[        [        R                  S-
  US-
  S5       Hh  n[        [        R                  U-
  S-
  U5      n[        R
                  " XaX R                  5      XU-   S-      -  U R                  U'   US-  nX&S-   -  nMj     M     g)z#Private: return coefficients for C3)-r    r   r      r   rG   r    r    r:   rG   r   r
   r   rG   r
   r   r   r;   r
   r    r   r   r   r    r:   r
   r   r   rI   rn   rP   irM   r`   r   rJ   r      rn   rP   irn   rP      i 
  r   r
   rG   r   N)rS   r   nC3_r   r   r=   r}   r   r   r@   rX   r   rY   r   rA   s          r   r   Geodesic._C3coeffT  s    E" 	
Aq11hmm$X]]Q&Ar2!!A%q)||Aa9Ea%!)<LL		!	Q	U
	 3 %r   c                 Z   / SQnSnSn[        [        R                  5       H  n[        [        R                  S-
  US-
  S5       H^  n[        R                  U-
  S-
  n[        R                  " XaX R
                  5      XU-   S-      -  U R                  U'   US-  nX&S-   -  nM`     M     g)z#Private: return coefficients for C4)Ma   :  i@       i iPi%  r   i`i@7   ir   r:   ip  r   i  iEr   d      i<  ih  iiNu  r   r
   i1#  ii   i  i  ir   i@  ii#  ir   iii  i0i  r   r   i)  i@  iXo i i  ir   i`i@  r   i  r   ixiW  i   i0i i   i ix  i rK   r   i i@  i/ r   i r   r
   rG   r   N)rS   r   nC4_r   r=   r}   r   r   s          r   r   Geodesic._C4coeffo  s    E. 	
Aq18==!X]]Q&Ar2!MMA!||Aa9Ea%!)<LL		!	Q	U
	 3 "r   c                 j    [         R                  " [        R                  S-
  U R                  SU5      $ )zPrivate: return A3r
   r   )r   r=   r   r   r   )r   r?   s     r   _A3fGeodesic._A3f  s&     <<)499a==r   c                     SnSn[        S[        R                  5       HJ  n[        R                  U-
  S-
  nX1-  nU[        R                  " X`R
                  XA5      -  X%'   XFS-   -  nML     g)zPrivate: return C3r
   r   N)rS   r   r   r   r=   r   r   r?   r   multrX   rY   rA   s          r   _C3fGeodesic._C3f  sc     D	A1hmm$
--!
a
a
kdDLLIIq66adq5ja	 %r   c                     SnSn[        [        R                  5       HJ  n[        R                  U-
  S-
  nU[        R                  " X`R
                  XA5      -  X%'   XFS-   -  nX1-  nML     g)zPrivate: return C4r
   r   N)rS   r   r   r   r=   r   r   s          r   _C4fGeodesic._C4f  sa     D	A8==!
--!
a
aDLLIIq66adq5ja
kd	 "r   c                    U[         R                  -  n[        R                  =n=n=n=nnU[         R                  [         R
                  -  [         R                  -  -  (       a  [         R                  U5      n[         R                  X5        U[         R
                  [         R                  -  -  (       a4  [         R                  U5      n[         R                  X5        UU-
  nSU-   nSU-   nU[         R                  -  (       a  [         R                  SXgU5      [         R                  SX4U5      -
  nWUU-   -  nU[         R
                  [         R                  -  -  (       a@  [         R                  SXgU5      [         R                  SX4U5      -
  nWU-  UU-  WU-  -
  -   nOU[         R
                  [         R                  -  -  (       aj  [        S[         R                  5       H  nWUU   -  WUU   -  -
  UU'   M     WU-  [         R                  SXgU5      [         R                  SX4U5      -
  -   nU[         R
                  -  (       a  WnXU-  -  XSU-  -  -
  XG-  W-  -
  nU[         R                  -  (       aL  XG-  X6-  -   nU R                  X-
  -  X-   -  XX-   -  nUUU-  UW-  -
  U-  U-  -   nUUU-  UU-  -
  U-  U-  -
  nXUUU4$ )z"Private: return a bunch of lengthsr
   T)r   OUT_MASKr"   nanDISTANCEREDUCEDLENGTHGEODESICSCALErC   rZ   rg   rr   r   rS   rq   r|   )r   r?   sig12ssig1csig1dn1ssig2csig2dn2cbet1cbet2outmaskC1aC2as12bm12bm0M12M21A1A2m0xB1B2J12rY   csig12rB   s                               r   _LengthsGeodesic._Lengths  s    x   G
 $(88+D+4+"+sS(##h&<&<<(() *??3bmmC	H**X-C-CC	D__S!c2gVr6b"""""4s;""4s;<b 52:d	H**X-C-CC	D$$T5=$$T5=>EkR"WrBw./	H**X-C-CC	DQ&!c!frCF{*A '%K811$cJ#11$cJK Lc'''b U]#cU]&;;mc!"d'''}u},f
))u}
%
739
Eaa%i%#+-6<<ca%i%#+-6<<cr3##r   c                 
   Sn[         R                  =n=pXB-  XQ-  -
  nXR-  XA-  -   nXB-  nUXQ-  -  nUS:  =(       a    US:  =(       a    XW-  S:  nU(       a  [        R                  " X-   5      nUU[        R                  " X%-   5      -   -  n[         R                  " SU R
                  U-  -   5      nXpR                  U-  -  n[         R                  " U5      n[         R                  " U5      nOUnU	nUU-  nUS:  a$  UXQ-  [        R                  " U5      -  SU-   -  -   O#UXQ-  [        R                  " U5      -  SU-
  -  -
  n[         R                  " UU5      nX-  X%-  U-  -   nU(       au  UU R                  :  ae  UU-  nUX$-  US:  a  [        R                  " U5      SU-   -  OSU-
  -  -
  n[        R                  " X5      u  p[         R                  " UU5      nGOH[        U R                  5      S:  dJ  US:  dD  US[        U R                  5      -  [         R                  -  [        R                  " U5      -  :  a  GO[         R                  " U* U	* 5      nU R                   S:  a  [        R                  " U5      U R
                  -  nUSS[         R                  " SU-   5      -   -  U-   -  nU R                   U-  U R#                  U5      -  [         R                  -  nUU-  n UU-  n!UU -  n"OXR-  XA-  -
  n#[         R                  " UU#5      n$U R%                  U R                  [         R                  U$-   X* X4XVX%[&        R(                  X5      u  n%n&n'  n%SU&X%-  U'-  [         R                  -  -  -   n!U!S:  a  UU!-  O4U R                   * [        R                  " U5      -  [         R                  -  n U U-  nUU-  n"U"[&        R*                  * :  a  U!S[&        R,                  -
  :  a  U R                   S:  a<  [/        S	U!* 5      n[         R                  " S[        R                  " U5      -
  5      * nO[1        U![&        R*                  * :  a  S
OSU!5      n[         R                  " S[        R                  " U5      -
  5      nO[&        R3                  U!U"5      n(UU R                   S:  a  U!* U(-  SU(-   -  OU"* SU(-   -  U(-  -  n)[         R                  " U)5      n[         R                  " U)5      * nUU-  nUXQ-  [        R                  " U5      -  SU-
  -  -
  nUS::  d  [        R                  " UU5      u  nnOSnSnUUUXU4$ )z3Private: Find a starting value for Newton's method.rG   r   g      ?r
   ru   r	   r   g{Gzrv                 )r"   r   r   r!   r#   r|   rz   sinr&   hypotr   normr%   r   r}   piry   r   r   r   r   tol1_xthresh_r   r   r7   )*r   sbet1r   r   sbet2r   r   lam12slam12clam12r   r   r   salp2calp2dnmsbet12cbet12sbet12a	shortlinesbetm2omg12somg12comg12salp1calp1ssig12r   lam12xk2r?   lamscalebetscaler'   r(   cbet12abet12adummyr   r   r   omg12as*                                             r   _InverseStartGeodesic._InverseStart  s    Edhh..]U]*F]U]*F mGu}G!DD1DIwwu}%f ///fIIa$))f,,-cxx#~&exxf%fvFNEAG1fu}twwv.!f*==U]TWWV_4F
CC 
 ZZu%F]U]V33FVdkk)fneu}+1Q; )-1v:(F<=JH HeYYu,lejj(e
dgg,#

A+
ADGG$tww.?
?

 zz6'F7+f	1WWU^dii'ATYYq2v../"4566E>DIIcN2TWW<e#Xh -%-/GW- )-
''477V#UFC
..):%tR +dgg566#$u9GaK&&4775>1DGG; 	e#X	
hnn_	R(*;*;%;!;66Q;cA2,%$))A4F*G(Ga8>>/1sta@%))A./%H a#!qb1fa!en$%2Q<>4&!TXXf-=,=6%-$''&/9QZHHQJYYue,leUe%c11r   c                 t   US:X  a  US:X  a  [         R                  * nXr-  n[        R                  " XU-  5      nUnX-  nX-  =nn[        R
                  " UU5      u  nnXR:w  a  X-  OUnXR:w  d  [        U5      U* :w  aH  [        R                  " [        R                  " X-  5      X!* :  a	  XR-
  X%-   -  OX-
  X-   -  -   5      U-  O
[        U5      nUnX-  nUU-  =nn[        R
                  " UU5      u  nn[        R                  " [        SUU-  UU-  -
  5      S-   UU-  UU-  -   5      n[        SUU-  UU-  -
  5      S-   nUU-  UU-  -   n[        R                  " UU
-  UU	-  -
  UU
-  UU	-  -   5      n[        R                  " U5      U R                  -  nUSS[        R                  " SU-   5      -   -  U-   -  n U R                  U U5        [         R                  SUUU5      [         R                  SUUU5      -
  n!U R                  * U R                  U 5      -  U-  UU!-   -  n"UU"-   n#U(       aa  US:X  a  SU R                   -  U-  U-  n$OUU R#                  U UUUUUUXbU[         R$                  X5      u  n%n$    n%U$U R                   UU-  -  -  n$O[        R&                  n$U#UUUUUUUU U"U$4$ )zPrivate: Solve hybrid problemr   r   r   r
   Tr   )r   tiny_r"   r   r   r   r   r#   r!   r%   r   r|   r   r   ry   r   rz   r   r   r   )&r   r   r   r   r   r   r   r   r   slam120clam120diffpr   r   C3asalp0calp0r   somg1r   comg1r   r   r   somg2r   comg2r   r   r   etar   r?   B312domg12r   dlam12r   s&                                         r   	_Lambda12Geodesic._Lambda12p  s   
 zeqj ~~oe MEJJuem,E
 E5=5M!EE99UE*LE5 #^EME #e*"6 YYtwwu}-=BV^5=9#m>@ ACHI =@J 
 E5=5EM!EE99UE*LE5 JJs3 =>D % =?E eemeem34s:Femeem3F
**Vg%(88g%(88:C 
$))	#B
Q1r6**+b0
1CIIc3""4s;""4s;<Dvvg		#&.%$,?F&LE	!txx#%--1]]
ueUCs5

 
 #.,*vueU 	$((eem,,xxf5%ueUCF r   c                    [         R                  =n=n=n=n	=pU[        R                  -  n[        R
                  " X$5      u  p[         R                  " SU5      nX-  oU-  n[         R                  " U5      n[        R                  " X5      u  nnSU-
  U-
  n[        R                  " [        R                  " U5      5      n[        R                  " [        R                  " U5      5      n[        U5      [        U5      :  d  [         R                  " U5      (       a  SOSnUS:  a  US-  nXp[         R                  " SU* 5      nUU-  nUU-  n[        R                  " U5      u  nnUU R                  -  n[        R                  " UU5      u  nn[!        [        R"                  U5      n[        R                  " U5      u  nnUU R                  -  n[        R                  " UU5      u  nn[!        [        R"                  U5      nUU* :  a  UU:X  a  [         R                  " UU5      nO[        U5      U* :X  a  Un[         R$                  " SU R&                  [        R(                  " U5      -  -   5      n[         R$                  " SU R&                  [        R(                  " U5      -  -   5      n[+        [-        [        R.                  S-   5      5      n[+        [-        [        R0                  S-   5      5      n[+        [-        [        R2                  5      5      nUS:H  =(       d    US:H  nU(       Ga  UnUnSn Sn!Un"UU-  n#Un$U U-  n%[         R4                  " [!        SU#U$-  U"U%-  -
  5      S-   U#U%-  U"U$-  -   5      n&U R7                  U R8                  U&U"U#UU$U%UUUU[        R:                  -  [        R<                  -  UU5      u  n'n(n)pU&S:  d  U(S:  ar  U&S[        R"                  -  :  d   U&[        R>                  :  a  U'S:  d  U(S:  a  S=n&=n(n'U(U R@                  -  n(U'U R@                  -  n'[         RB                  " U&5      nOS	nS
n*Sn+Sn,U(       d  US:X  a  U RD                  S::  d  XRD                  S-  :  a  S=nn S=nn!U RF                  U-  n'XR                  -  =n&n,U R@                  [         RH                  " U&5      -  n(U[        RJ                  -  (       a  [         RL                  " U&5      =pXR                  -  nGO3U(       Gd+  U RO                  UUUUUUUUUUU5      u  n&nnn!n n-U&S:  a  U&U R@                  -  U--  n'[        R(                  " U-5      U R@                  -  [         RH                  " U&U--  5      -  n(U[        RJ                  -  (       a  [         RL                  " U&U--  5      =p[         RB                  " U&5      nXR                  U--  -  n,GOYSn.S	=n/n0[        R"                  n1Sn2[        R"                  n3Sn4U.[        RP                  :  Ga  U RS                  UUUUUUUUUUU.[        RT                  :  UUU5      u  n5n!n n&n"n#n$n%n6n7n8U0(       d)  [        U55      U/(       a  SOS[        R>                  -  :  d  GOU5S:  a%  U.[        RT                  :  d  UU-  U4U3-  :  a  Un3Un4O*U5S:  a$  U.[        RT                  :  d  UU-  U2U1-  :  a  Un1Un2U.S-  n.U.[        RT                  :  a  U8S:  a  U5* U8-  n9[         RH                  " U95      n:[         RL                  " U95      n;UU;-  UU:-  -   n<U<S:  af  [        U95      [         RV                  :  aI  UU;-  UU:-  -
  nU<n[        R                  " UU5      u  nn[        U55      S[        R>                  -  :*  n/GM  U1U3-   S-  nU2U4-   S-  n[        R                  " UU5      u  nnS	n/[        U1U-
  5      U2U-
  -   [        RX                  :  =(       d%    [        UU3-
  5      UU4-
  -   [        RX                  :  n0U.[        RP                  :  a  GM  UU[        R<                  [        RJ                  -  -  (       a  [        R:                  O[        RZ                  -  n=U R7                  W6U&W"W#UW$W%UUUU=UU5      u  n'n(n)pU(U R@                  -  n(U'U R@                  -  n'[         RB                  " U&5      nU[        R\                  -  (       aB  [         RH                  " W75      n>[         RL                  " U75      n?UU?-  UU>-  -
  n*UU?-  UU>-  -   n+U[        R:                  -  (       a  SW'-   nU[        R<                  -  (       a  SW(-   nU[        R\                  -  (       GaY  WU-  n@[         R^                  " WUU-  5      nAUAS:w  Ga1  W@S:w  Ga*  Un"UU-  n#Un$W U-  n%[        R(                  " WA5      U R&                  -  nBUBSS[         R$                  " SUB-   5      -   -  UB-   -  n6[        R(                  " U RF                  5      UA-  W@-  U R`                  -  nC[        R                  " U"U#5      u  n"n#[        R                  " U$U%5      u  n$n%[+        [-        [        Rb                  5      5      nDU Re                  U6UD5        [        Rg                  S	U"U#UD5      nE[        Rg                  S	U$U%UD5      nFUCUFUE-
  -  nOSnU(       d2  U*S
:X  a,  [         RH                  " U,5      n*[         RL                  " U,5      n+U(       dQ  U+S:  aK  UU-
  S:  aB  SU+-   n7SU-   nGSU-   nHS[         R4                  " U*UUH-  UUG-  -   -  U7UU-  UGUH-  -   -  5      -  nIONW!U-  W U-  -
  nJU U-  U!U-  -   nKUJS:X  a  WKS:  a  [        R"                  U-  nJSnK[         R4                  " WJWK5      nIXRh                  WI-  -  nUUU-  U-  -  nUS-  nUS:  a"  WW!nn!WW nn U[        RJ                  -  (       a  XpWUU-  -  nWUU-  -  nW!UU-  -  n!W UU-  -  n XgUUU!U XX4
$ )z/Private: General version of the inverse problemr
      rG   r   irv   r   r    Fg       @r   r   rj   r   g-g      ?)5r"   r   r   r   r   AngDiffcopysignradianssincosdeAngRoundLatFixr   isnansincosdrz   r   r   r  r#   r|   r!   r   rS   rT   rq   r   r%   r   r}   r   r   tol0_r~   degreesry   rx   r   r   r&   r   maxit2_r  maxit1_r   tolb_EMPTYAREAr   r{   r   r   r   r   )Lr   lat1lon1lat2lon2r   a12s12m12r   r   S12lon12lon12slonsignr   r   r   swapplatsignr   r   r   r   r   r   r   r   r  meridianr   r   r   r   r   r   r   r   r   s12xm12xr   r   r   r   r   numittripntripbsalp1acalp1asalp1bcalp1br4   r?   r  dvdalp1sdalp1cdalp1nsalp1
lengthmasksdomg12cdomg12r  r	  r   A4C4aB41B42dbet1dbet2alp12salp12calp12sL                                                                               r   _GenInverseGeodesic._GenInverse  sC   (,0C0#00c0Cx   G LL,MEmmAu%GOE&6VLLE]]51NFFEkV#F ==T*+D==T*+D d)c$i'4::d+;+;BEqymgDmmAu%GGODGOD <<%LE5u'8u99UE*LE5C4NE<<%LE5u'8u99UE*LE5C4NE v~	%eU+	Uv	
))A		DGGEN22
3C
))A		DGGEN22
3C uX]]Q&'
(C
uX]]Q&'
(C
uX]]#
$Cs{)fkH
 efee35 eUU]UeUU]U jjS%%-%%-"?@3F"'%-%%-"?Ae %)MMuc5%eU(###h&<&<<c3%H!dD% 
daiA&&X^^#TAX #
#%
#$ll5!  F3&
	1&&3,. ee3.55VVe^dhh&&eeWWtxx&d	8))	)HHUO#HHc 04/A/Auc5%eVVS#0O,eUE5% 
!tww$tww&%#+)>>X+++hhus{+
+#ll5!C( #$h&&& #nnE3ucE66583C3C+C#s1eUE5%
 3q65aa8>>%IIU 0 00efVm3FUF1u%("2"22+v5FUF
1*%X%%%"q&BrEEXXe_FtxxfV^efn4Fzc%j4772fnuv~5ee!YYue4leU !fX^^ 33e F?A%%F?A%%5%0,%%v~&&5.9HNNJ Kuv~&%&.9HNNJ [ h&&&` "h&<&<&.&<&<'= >  (( %NN	,

 '+mm
ueUCsE5
c3' #dE3 	ll5!X]]"HHV$'0@gG#fw&66&G#fw&66& """$Jc'''$Jcemejj.e	!
uu}uuu}uWWU^dii'ATYYq2v../"45WWTVV_u$u,txx7yy.uyy.u5'(		#s$$UE5#>$$UE5#>C#I &C-%488E?&
7

%-$
 VQYUE	DJJ55=55=+H J &55=55=+H JM M ..
 Q;6A:>>E)&&

66*	XXc	UW_w&&c	Sjc qyEUeEUe	8))	)S	UW_Eeuw6e	UW_Eeuw6eUE5%3CCr   c           
      H   U R                  XX4U5      u
  pgppppU[        R                  -  nU[        R                  -  (       a"  [        R
                  " X$5      u  nnUU-   U-   nO[        R                  " U5      n[        R                  " U5      U[        R                  -  (       a  UO[        R                  " U5      [        R                  " U5      US.nUUS'   U[        R                  -  (       a  UUS'   U[        R                  -  (       a2  [        R                  " X5      US'   [        R                  " X5      US'   U[        R                  -  (       a  UUS'   U[        R                  -  (       a
  UUS'   UUS'   U[        R                  -  (       a  UUS	'   U$ )
a  Solve the inverse geodesic problem

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param lat2: latitude of the second point in degrees
:param lon2: longitude of the second point in degrees
:param outmask: the :ref:`output mask <outmask>`
:return: a :ref:`dict`

Compute geodesic between (*lat1*, *lon1*) and (*lat2*, *lon2*).
The default value of *outmask* is STANDARD, i.e., the *lat1*,
*lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are
returned.

)r%  r&  r'  r(  r)  r*  azi1azi2r+  r   r   r,  )rM  r   r   LONG_UNROLLr   r  AngNormalizer  r   AZIMUTHatan2dr   r   r$  )r   r%  r&  r'  r(  r   r)  r*  r   r   r   r   r+  r   r   r,  r-  eresults                      r   InverseGeodesic.Inverse  sV   $ >B=M=M
$g>':Ce5#x   G%%%d)heQUladt$dkk$'%(<(<<d%kk$'	F
 F5M"""CF5M!!!{{50fVn{{50fVn''''''fUm36%=uMr   c                 z    SSK Jn  U(       d  U[        R                  -  nU" XX#U5      nUR	                  XEU5      $ )z*Private: General version of direct problemr   GeodesicLine)geographiclib.geodesicliner\  r   DISTANCE_IN_GenPosition)	r   r%  r&  rP  arcmodes12_a12r   r\  lines	            r   
_GenDirectGeodesic._GenDirect  s8    7Gx333GD8DWw77r   c           	      z   U R                  XUSXE5      u	  pgppJpnU[        R                  -  n[        R                  " U5      U[        R
                  -  (       a  UO[        R                  " U5      [        R                  " U5      US.nXnS'   U[        R                  -  (       a  X~S'   U[        R                  -  (       a  XS'   U[        R                  -  (       a  XS'   U[        R                  -  (       a  XS'   U[        R                  -  (       a  XS'   XS	'   U[        R                  -  (       a  XS
'   U$ )a/  Solve the direct geodesic problem

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param azi1: azimuth at the first point in degrees
:param s12: the distance from the first point to the second in
  meters
:param outmask: the :ref:`output mask <outmask>`
:return: a :ref:`dict`

Compute geodesic starting at (*lat1*, *lon1*) with azimuth *azi1*
and length *s12*.  The default value of *outmask* is STANDARD, i.e.,
the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12*
entries are returned.

F)r%  r&  rP  r*  r)  r'  r(  rQ  r+  r   r   r,  )rc  r   r   r   r  rR  rS  LATITUDE	LONGITUDErT  r   r   r$  )r   r%  r&  rP  r*  r   r)  r'  r(  rQ  r+  r   r   r,  rW  s                  r   DirectGeodesic.Direct'  s   & 6:__
$s6-2Ct3Ssx   Gkk$'%(<(<<d%''-	F
 5M"""T6N###dF^!!!D&>''''''Um3%=uMr   c           	         U R                  XUSXE5      u	  pFpxppnU[        R                  -  n[        R                  " U5      U[        R
                  -  (       a  UO[        R                  " U5      [        R                  " U5      US.nU[        R                  -  (       a  XS'   U[        R                  -  (       a  XnS'   U[        R                  -  (       a  X~S'   U[        R                  -  (       a  XS'   U[        R                  -  (       a  XS'   U[        R                  -  (       a  XS'   XS	'   U[        R                  -  (       a  XS
'   U$ )a]  Solve the direct geodesic problem in terms of spherical arc length

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param azi1: azimuth at the first point in degrees
:param a12: spherical arc length from the first point to the second
  in degrees
:param outmask: the :ref:`output mask <outmask>`
:return: a :ref:`dict`

Compute geodesic starting at (*lat1*, *lon1*) with azimuth *azi1*
and arc length *a12*.  The default value of *outmask* is STANDARD,
i.e., the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*,
*a12* entries are returned.

T)r%  r&  rP  r)  r*  r'  r(  rQ  r+  r   r   r,  )rc  r   r   r   r  rR  rS  r   rf  rg  rT  r   r   r$  )r   r%  r&  rP  r)  r   r'  r(  rQ  r*  r+  r   r   r,  rW  s                  r   	ArcDirectGeodesic.ArcDirectL  s   & 6:__
$c6,2Ct3Ssx   Gkk$'%(<(<<d%''-	F
 """C5M"""T6N###dF^!!!D&>''''''Um3%=uMr   c                 "    SSK Jn  U" XX#U5      $ )a  Return a GeodesicLine object

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param azi1: azimuth at the first point in degrees
:param caps: the :ref:`capabilities <outmask>`
:return: a :class:`~geographiclib.geodesicline.GeodesicLine`

This allows points along a geodesic starting at (*lat1*, *lon1*),
with azimuth *azi1* to be found.  The default value of *caps* is
STANDARD | DISTANCE_IN, allowing direct geodesic problem to be
solved.

r   r[  )r]  r\  )r   r%  r&  rP  capsr\  s         r   LineGeodesic.Lineq  s    $ 8D55r   c                     SSK Jn  U(       d  U[        R                  -  nU" XX#U5      nU(       a  UR	                  U5        U$ UR                  U5        U$ )z#Private: general form of DirectLiner   r[  )r]  r\  r   r^  SetArcSetDistance)	r   r%  r&  rP  r`  ra  rn  r\  rb  s	            r   _GenDirectLineGeodesic._GenDirectLine  sR     8DH000DD5D
kk' K wKr   c                 *    U R                  XUSXE5      $ )a  Define a GeodesicLine object in terms of the direct geodesic
problem specified in terms of spherical arc length

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param azi1: azimuth at the first point in degrees
:param s12: the distance from the first point to the second in
  meters
:param caps: the :ref:`capabilities <outmask>`
:return: a :class:`~geographiclib.geodesicline.GeodesicLine`

This function sets point 3 of the GeodesicLine to correspond to
point 2 of the direct geodesic problem.  The default value of *caps*
is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be
solved.

Frt  )r   r%  r&  rP  r*  rn  s         r   
DirectLineGeodesic.DirectLine  s    * t4BBr   c                 *    U R                  XUSXE5      $ )a  Define a GeodesicLine object in terms of the direct geodesic
problem specified in terms of spherical arc length

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param azi1: azimuth at the first point in degrees
:param a12: spherical arc length from the first point to the second
  in degrees
:param caps: the :ref:`capabilities <outmask>`
:return: a :class:`~geographiclib.geodesicline.GeodesicLine`

This function sets point 3 of the GeodesicLine to correspond to
point 2 of the direct geodesic problem.  The default value of *caps*
is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be
solved.

Trw  )r   r%  r&  rP  r)  rn  s         r   ArcDirectLineGeodesic.ArcDirectLine  s    * t4sAAr   c           
      &   SSK Jn  U R                  XX4S5      u
  pxp          n[        R                  " X5      nU[
        R                  [
        R                  -  -  (       a  U[
        R                  -  nU" XX+XYU
5      nUR                  U5        U$ )aX  Define a GeodesicLine object in terms of the invese geodesic problem

:param lat1: latitude of the first point in degrees
:param lon1: longitude of the first point in degrees
:param lat2: latitude of the second point in degrees
:param lon2: longitude of the second point in degrees
:param caps: the :ref:`capabilities <outmask>`
:return: a :class:`~geographiclib.geodesicline.GeodesicLine`

This function sets point 3 of the GeodesicLine to correspond to
point 2 of the inverse geodesic problem.  The default value of *caps*
is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be
solved.

r   r[  )
r]  r\  rM  r   rU  r   r   r^  r   rr  )r   r%  r&  r'  r(  rn  r\  r)  _r   r   rP  rb  s                r   InverseLineGeodesic.InverseLine  s    & 8-1-=-=
$a.!*CE!Q1a;;u$Dx  8#7#778
hdDUCDKKKr   c                     SSK Jn  U" X5      $ )zReturn a PolygonArea object

:param polyline: if True then the object describes a polyline
  instead of a polygon
:return: a :class:`~geographiclib.polygonarea.PolygonArea`

r   )PolygonArea)geographiclib.polygonarear  )r   polyliner  s      r   PolygonGeodesic.Polygon  s     6t&&r   )r   r   r   r~   r   r{   r|   r   rz   r}   rx   ry   N)F)U__name__
__module____qualname____firstlineno____doc__GEOGRAPHICLIB_GEODESIC_ORDERr<   rT   rb   rf   rq   r   r   r   r   r   r   r!  sys
float_infomant_digr   r"   r#   r   r  epsilonr  r   r   r"  r   r   CAP_NONECAP_C1CAP_C1pCAP_C2CAP_C3CAP_C4CAP_ALLCAP_MASKOUT_ALLr   staticmethodr   r7   rC   rZ   rc   rg   rr   r   r   r   r   r   r   r   r   r   r  rM  STANDARDrX  rc  rh  rk  r^  ro  rt  rx  r{  r  r  r#  rf  rg  rT  r   r   r   r$  ALLrR  __static_attributes__ r   r   r   r   V   s   !"	%$	%$
&%	%$	%$	%$
%	%$4!8
"%	%$4!8
"%'cnn---2'
))CNN&&
'%
..
 
 %
+%
))E
%
%-%E\((((&&&'''&&&&&&&&&'''((('''(((% %2 , ,\ ! !  &  & ! !  &.`"6B>


3$lH2XJZuDp	 +33(V8 *22#L -55#L %--))*6, /77'334 +33#//0C0 +33#//0B0 ,44$001:
' %**%#$--("$..)#$,,'-$--(!$--($00+$22-'$22-2$))$$((#$00+r   r   )r  r"   r  geographiclib.geomathr   geographiclib.constantsr    geographiclib.geodesiccapabilityr   r   WGS84_aWGS84_fWGS84r  r   r   <module>r     sH   ;^  
 & - ?p pd% )++Y->->? +r   