
    OiG                     D    d Z ddlZddlmZ ddlmZ  G d d          ZdS )a  Define the :class:`~geographiclib.geodesicline.GeodesicLine` class

The constructor defines the starting point of the line.  Points on the
line are given by

  * :meth:`~geographiclib.geodesicline.GeodesicLine.Position` position
    given in terms of distance
  * :meth:`~geographiclib.geodesicline.GeodesicLine.ArcPosition` position
    given in terms of spherical arc length

A reference point 3 can be defined with

  * :meth:`~geographiclib.geodesicline.GeodesicLine.SetDistance` set
    position of 3 in terms of the distance from the starting point
  * :meth:`~geographiclib.geodesicline.GeodesicLine.SetArc` set
    position of 3 in terms of the spherical arc length from the starting point

The object can also be constructed by

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

The public attributes for this class are

  * :attr:`~geographiclib.geodesicline.GeodesicLine.a`
    :attr:`~geographiclib.geodesicline.GeodesicLine.f`
    :attr:`~geographiclib.geodesicline.GeodesicLine.caps`
    :attr:`~geographiclib.geodesicline.GeodesicLine.lat1`
    :attr:`~geographiclib.geodesicline.GeodesicLine.lon1`
    :attr:`~geographiclib.geodesicline.GeodesicLine.azi1`
    :attr:`~geographiclib.geodesicline.GeodesicLine.salp1`
    :attr:`~geographiclib.geodesicline.GeodesicLine.calp1`
    :attr:`~geographiclib.geodesicline.GeodesicLine.s13`
    :attr:`~geographiclib.geodesicline.GeodesicLine.a13`

    N)Math)GeodesicCapabilityc                       e Zd ZdZej        ej        z  ej        ej        fdZ	d Z
ej        fdZej        fdZd Zd ZdS )	GeodesicLinezPoints on a geodesic pathc                 "   ddl m} |j        | _        	 |j        | _        	 |j        | _        |j        | _        |j        | _        ||j        z  |j        z  |j	        z  | _
        	 t          j        |          | _        	 || _        	 t          j        |          st          j        |          rMt          j        |          | _        t          j        t          j        |                    \  | _        | _        n|| _        	 || _        	 || _        	 t          j        t          j        | j                            \  }	}
|	| j        z  }	t          j        |	|
          \  }	}
t1          |j        |
          }
t          j        d|j        t          j        |	          z  z             | _        | j        |
z  | _        t          j        | j        | j        |	z            | _         |	| _!        | j        |	z  | _"        |	dk    s| j        dk    r
|
| j        z  ndx| _#        | _$        t          j        | j!        | j#                  \  | _!        | _#        t          j        | j                   |j        z  | _%        | j%        ddt          j        d| j%        z             z   z  | j%        z   z  }| j
        |j&        z  r|'                    |          | _(        tS          tU          |j+        dz                       | _,        |-                    || j,                   |.                    d| j!        | j#        | j,                  | _/        t          j0        | j/                  }t          j1        | j/                  }| j!        |z  | j#        |z  z   | _2        | j#        |z  | j!        |z  z
  | _3        | j
        |j4        z  rDtS          tU          |j5        dz                       | _6        |7                    || j6                   | j
        |j8        z  r|9                    |          | _:        tS          tU          |j;        dz                       | _<        |=                    || j<                   |.                    d| j!        | j#        | j<                  | _>        | j
        |j?        z  rtS          tU          |j@                            | _A        |B                    || jA                   | j         | j        z  |C                    |          z  | _D        |.                    d| j!        | j#        | jA                  | _E        | j
        |jF        z  rtS          tU          |jG                            | _H        |I                    || jH                   t          j        | j                  | j         z  | j        z  |jJ        z  | _K        |.                    d| j!        | j#        | jH                  | _L        t          jM        | _N        	 t          jM        | _O        dS )av  Construct a GeodesicLine object

    :param geod: a :class:`~geographiclib.geodesic.Geodesic` 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>`

    This creates an object allowing points along a geodesic starting at
    (*lat1*, *lon1*), with azimuth *azi1* to be found.  The default
    value of *caps* is STANDARD | DISTANCE_IN.  The optional parameters
    *salp1* and *calp1* should not be supplied; they are part of the
    private interface.

    r   Geodesic      TFN)Pgeographiclib.geodesicr	   af_b_c2_f1LATITUDEAZIMUTHLONG_UNROLLcapsr   LatFixlat1lon1mathisnanAngNormalizeazi1sincosdAngRoundsalp1calp1normmaxtiny_sqrt_ep2sq_dn1_salp0hypot_calp0_ssig1_somg1_csig1_comg1_k2CAP_C1_A1m1f_A1m1listrangenC1__C1a_C1f_SinCosSeries_B11sincos_stau1_ctau1CAP_C1pnC1p__C1pa_C1pfCAP_C2_A2m1f_A2m1nC2__C2a_C2f_B21CAP_C3nC3__C3a_C3f_A3f_A3c_B31CAP_C4nC4__C4a_C4f_e2_A4_B41nans13a13)selfgeodr   r   r   r   r   r    r	   sbet1cbet1epsscs                 R/srv/django_bis/venv311/lib/python3.11/site-packages/geographiclib/geodesicline.py__init__zGeodesicLine.__init__B   s$   ( 0/////VDF4VDF#gDGxDHxDH))H,<<&'DI% D!!DI?DI@z% 	DDJu-- 	D#D))di#|DM$,?,?@@dj$**di@djAdjC <di 8 899LE55DH;L59UE**LE5C4N4NE	!di$'%..8899DI *u$DK *TZe);<<DK DKt{U':$)QJJ$*// "'!3!3GHJDK$+  $ydkBBDK wt{##di/DH
(a1tyTX6667$(B
CCy8?" 	6??3''djuX]Q.//00dimmC###((dk4;	3 3di
(49

a48DI#6#6qK!OdkAo5dkK!OdkAo5dk y8## &hnq01122djnnS$*%%%y8?" 3??3''djuX]Q.//00dimmC###((dk4;	3 3di y8?" 3uX]++,,di
iiTY6'DK'$))C..8di((dk4;	3 3di y8?" 4uX]++,,di
iiTY4;.<txGdh((t{DK4 4dixDHGxDHJJ    c           	      &   ddl m} t          j        x}x}x}x}x}	x}
x}x}}|| j        |j        z  z  }|s"| j        |j        |j        z  z  s|||||	|
|||f	S d}d}|r-t          j        |          }t          j	        |          \  }}n|| j
        d| j        z   z  z  }t          j        |          r|nt          j        }t          j        |          }t          j        |          }|                    d| j        |z  | j        |z  z   | j        |z  | j        |z  z
  | j                   }||| j        z
  z
  }t          j        |          }t          j        |          }t)          | j                  dk    r| j        |z  | j        |z  z   }| j        |z  | j        |z  z
  }|                    d||| j                  }d| j        z   ||| j        z
  z   z  || j
        z  z
  }||t          j        d| j        t          j        |          z  z             z  z
  }t          j        |          }t          j        |          }| j        |z  | j        |z  z   }| j        |z  | j        |z  z
  }t          j        d| j        t          j        |          z  z             }||j        |j        z  |j        z  z  rL|st)          | j                  dk    r|                    d||| j                  }d| j        z   || j        z
  z  }| j        |z  }t          j         | j!        | j        |z            }|dk    r	|j"        x}}| j!        }| j        |z  }||j        z  r|r| j
        d| j        z   |z  |z   z  n|}	||j#        z  r}| j!        |z  }|}t          j$        d| j!                  } ||j%        z  rw| |t          j&        ||          t          j&        | j        | j                  z
  z
  t          j&        | |z  |          t          j&        | | j'        z  | j(                  z
  z   z  n:t          j&        || j(        z  || j'        z  z
  || j(        z  || j'        z  z             }!|!| j)        ||                    d||| j*                  | j+        z
  z   z  z   }"t          j,        |"          }#||j%        z  r
| j-        |#z   n?t          j.        t          j.        | j-                  t          j.        |#          z             }||j/        z  rt          j0        || j1        |z            }||j2        z  rt          j0        ||          }||j        |j        z  z  r|                    d||| j3                  }$d| j4        z   |$| j5        z
  z  }%| j        | j4        z
  |z  ||%z
  z   }&||j        z  r6| j
        || j        |z  z  | j6        | j        |z  z  z
  | j        |z  |&z  z
  z  }
||j        z  rd| j        || j        z
  z  || j        z   z  | j6        |z   z  }'||'|z  ||&z  z
  | j        z  | j6        z  z   }||'| j        z  | j        |&z  z
  |z  |z  z
  }||j7        z  r|                    d||| j8                  }(| j        dk    s| j!        dk    r+|| j9        z  || j:        z  z
  })|| j9        z  || j:        z  z   }*n| j        | j!        z  |dk    r| j        d|z
  z  || j        z  z   n|| j        |z  d|z   z  | j        z   z  z  })t          j        | j!                  t          j        | j                  | j        z  |z  z   }*| j;        t          j&        |)|*          z  | j<        |(| j=        z
  z  z   }|r|nt          j,        |          }|||||	|
|||f	S )z4Private: General solution of position along geodesicr   r   g        r
   Tg{Gz?F)>r   r	   r   rW   r   OUT_MASKDISTANCE_INradiansr   r   r   r2   isfiniter:   r;   r8   r<   r=   r@   r9   absr   r+   r-   r6   r$   r/   r&   DISTANCEREDUCEDLENGTHGEODESICSCALEr*   r)   r(   r#   	LONGITUDEcopysignr   atan2r,   r.   rN   rK   rO   degreesr   r   r   atan2dr   r   rF   rD   rH   r'   AREArR   r    r   r   rU   rV   )+rZ   arcmodes12_a12outmaskr	   a12lat2lon2azi2s12m12M12M21S12B12AB1sig12ssig12csig12tau12r_   r`   ssig2csig2serrdn2sbet2cbet2salp2calp2somg2comg2Eomg12lam12lon12B22AB2J12tB42salp12calp12s+                                              ra   _GenPositionzGeodesicLine._GenPosition   s=   //////=AXECE$EEEsESE3Esty8,,,G <Y(+h.BBC< $dCc3;; CSs ,;l7##e|G,,nfff A
N34e}U++9eee
(5//atx1$$T$(K!OdkAo$E$(K!OdkAo$E$(J0 0 0c sTY'exf%	TVt		, f$t{V';;f$t{V';;$$T5%CCTZES49_$=>$'!"tyTX-F)FGGGG%48E??& K& 4;#77EK& 4;#77E
)A475>>11
2
2C(0083IIK 1	 DCKK$&&$$T5%CC^di0cK%EJt{DK%$788Ezzn$eeKEu!4"" O:ANDGDJ%/#566wc## ;kE!e55
-4;
'
'a H00JqEzE??zdk4;??@A z!E/??z!dk/4;??@A B B Jut{2UT[5HH$t{2UT[5HHJ J  di''eUDIFF9 	 e l5!!e#*X-A#A :di% 1$) < < $ 1% 8 8!9 : :  "" 2[5 011d!! '[&&d((8+AAB K""4tyAAc^di0cZ$*$-s;c	8)	) 6 gt{U': ;)t{U':;!<;.45 6 
8)	) KX,-dk!#&*i#o7E	ECK/4;>JJDK$+*;;uDsJJ +""5%	BBc			T[A--#edj&88#edj&88 t{*?E{{$+V
$v';
;
;v-V<t{JKM '$+&&'$+&&4u<=X
66222Xty)*c 
5''$,u"5"5CdD#sCc99rc   c           	         ddl m} | j        ||j        z  r| j        nt          j        | j                  | j        |d}|                     d||          \	  }}}}}}	}
}}||j	        z  }||d<   ||j
        z  r||d<   ||j        z  r||d<   ||j        z  r||d<   ||j        z  r|	|d	<   ||j        z  r
|
|d
<   ||d<   ||j        z  r||d<   |S )a  Find the position on the line given *s12*

    :param s12: the distance from the first point to the second in
      meters
    :param outmask: the :ref:`output mask <outmask>`
    :return: a :ref:`dict`

    The default value of *outmask* is STANDARD, i.e., the *lat1*,
    *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are
    returned.  The :class:`~geographiclib.geodesicline.GeodesicLine`
    object must have been constructed with the DISTANCE_IN capability.

    r   r   )r   r   r   rz   Frv   rw   rx   ry   r{   r|   r}   r~   )r   r	   r   r   r   r   r   r   r   re   r   rm   r   rk   rl   rr   )rZ   rz   ru   r	   resultrv   rw   rx   ry   r{   r|   r}   r~   s                ra   PositionzGeodesicLine.PositionV  s.    0/////i#*X-A#A +dii	**i- -F 6:5F5FS'6 62CtT3S#sx  GF5M""9TF6N##:dVF^!!8D6&>''<'' /fUm36%=3uMrc   c           	         ddl m} | j        ||j        z  r| j        nt          j        | j                  | j        |d}|                     d||          \	  }}}}}}	}
}}||j	        z  }||j
        z  r||d<   ||j        z  r||d<   ||j        z  r||d<   ||j        z  r||d<   ||j        z  r|	|d	<   ||j        z  r
|
|d
<   ||d<   ||j        z  r||d<   |S )ao  Find the position on the line given *a12*

    :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`

    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   rv   Trz   rw   rx   ry   r{   r|   r}   r~   )r   r	   r   r   r   r   r   r   r   re   rj   r   rm   r   rk   rl   rr   )rZ   rv   ru   r	   r   rw   rx   ry   rz   r{   r|   r}   r~   s                ra   ArcPositionzGeodesicLine.ArcPositionw  s;    0/////i#*X-A#A +dii	**i- -F 6:5F5F
C6 62CtT3S#sx  G""7CF5M""9TF6N##:dVF^!!8D6&>''<'' /fUm36%=3uMrc   c           
      j    || _         |                     d| j         d          \	  | _        }}}}}}}}dS )zvSpecify the position of point 3 in terms of distance

    :param s13: distance from point 1 to point 3 in meters

    Fr   N)rX   r   rY   )rZ   rX   _s      ra   SetDistancezGeodesicLine.SetDistance  s=     DH'+'8'8!'L'L$DHaAq!Q111rc   c           	          ddl m} || _        |                     d| j        |j                  \	  }}}}| _        }}}}dS )zSpecify the position of point 3 in terms of arc length

    :param a13: spherical arc length from point 1 to point 3 in degrees

    r   r   TN)r   r	   rY   r   rj   rX   )rZ   rY   r	   r   s       ra   SetArczGeodesicLine.SetArc  sY     0/////DH'+'8'8tx9A9J(L (L$Aq!Q!Q111rc   N)__name__
__module____qualname____doc__r   STANDARDrf   r   rW   rb   r   r   r   r   r    rc   ra   r   r   ?   s        !! )1!-.xxK xK xK xKvW: W: W:r %7$?    B (:'B    @M M M
L 
L 
L 
L 
Lrc   r   )r   r   geographiclib.geomathr    geographiclib.geodesiccapabilityr   r   r   rc   ra   <module>r      s   & &t  & & & & & & ? ? ? ? ? ?lL lL lL lL lL lL lL lL lL lLrc   