
    gG                     <    d Z ddlZddlmZ ddlmZ  G d d      Zy)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y)	GeodesicLinezPoints on a geodesic pathc                 L   ddl m} |j                  | _        	 |j                  | _        	 |j                  | _        |j
                  | _        |j                  | _        ||j                  z  |j                  z  |j                  z  | _
        	 t        j                  |      | _        	 || _        	 t        j                   |      st        j                   |      rPt        j"                  |      | _        t        j&                  t        j(                  |            \  | _        | _        n|| _        	 || _        	 || _        	 t        j&                  t        j(                  | j                              \  }	}
|	| j                  z  }	t        j.                  |	|
      \  }	}
t1        |j2                  |
      }
t        j4                  d|j6                  t        j8                  |	      z  z         | _        | j*                  |
z  | _        t        j>                  | j,                  | j*                  |	z        | _         |	| _!        | j<                  |	z  | _"        |	dk7  s| j,                  dk7  r|
| j,                  z  ndx| _#        | _$        t        j.                  | jB                  | jF                        \  | _!        | _#        t        j8                  | j@                        |j6                  z  | _%        | jJ                  ddt        j4                  d| jJ                  z         z   z  | jJ                  z   z  }| j                  |jL                  z  r|jO                  |      | _(        tS        tU        |jV                  dz               | _,        |j[                  || jX                         |j]                  d| jB                  | jF                  | jX                        | _/        t        j`                  | j^                        }t        jb                  | j^                        }| jB                  |z  | jF                  |z  z   | _2        | jF                  |z  | jB                  |z  z
  | _3        | j                  |jh                  z  rBtS        tU        |jj                  dz               | _6        |jo                  || jl                         | j                  |jp                  z  r|js                  |      | _:        tS        tU        |jv                  dz               | _<        |j{                  || jx                         |j]                  d| jB                  | jF                  | jx                        | _>        | j                  |j~                  z  rtS        tU        |j                              | _A        |j                  || j                         | j                   | j<                  z  |j                  |      z  | _D        |j]                  d| jB                  | jF                  | j                        | _E        | j                  |j                  z  rtS        tU        |j                              | _H        |j                  || j                         t        j8                  | j                        | j@                  z  | j<                  z  |j                  z  | _K        |j]                  d| jB                  | jF                  | j                        | _L        t        j                  | _N        	 t        j                  | _O        y)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                 Z/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/geographiclib/geodesicline.py__init__zGeodesicLine.__init__B   s   ( 0VVDF4VVDF#ggDGxxDHxxDH)))H,<,<<&&'DI% D!DI?DI@zz%DJJu-##D)di#||DMM$,?@dj$*di@djAdjC <<dii 89LE55DHH;L599UE*LE5C4NE		!dii$''%.889DI **u$DK **TZZe);<DK DKt{{U':$)QJ$**/ "'!3GHJDK$+  $yydkkBDK wwt{{#dii/DH
((a1tyyTXX667$((B
CCyy8??"??3'djuX]]Q./0dimmC#((dkk4;;		3di
((499
a488DII#6qKK!OdkkAo5dkKK!OdkkAo5dk yy8###hnnq012djnnS$**%yy8??"??3'djuX]]Q./0dimmC#((dkk4;;		3di yy8??"uX]]+,di
iiTYY66'DKK'$))C.8di((dkk4;;		3di yy8??"uX]]+,di
iiTYY4;;.<txxGdh((t{{DKK4dixxDHGxxDHJ    c           	      V   ddl m} t        j                  x}x}x}x}x}	x}
x}x}}|| j                  |j
                  z  z  }|s1| 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                  |      }|j                  d| j                   |z  | j"                  |z  z   | j"                  |z  | j                   |z  z
  | j$                         }||| j&                  z
  z
  }t        j                  |      }t        j                  |      }t)        | j*                        dkD  r| j,                  |z  | j.                  |z  z   }| j.                  |z  | j,                  |z  z
  }|j                  d||| j0                        }d| j                  z   ||| j&                  z
  z   z  || j                  z  z
  }||t        j2                  d| j4                  t        j6                  |      z  z         z  z
  }t        j                  |      }t        j                  |      }| j,                  |z  | j.                  |z  z   }| j.                  |z  | j,                  |z  z
  }t        j2                  d| j4                  t        j6                  |      z  z         }||j8                  |j:                  z  |j<                  z  z  rW|st)        | j*                        dkD  r|j                  d||| j0                        }d| j                  z   || j&                  z
  z  }| j>                  |z  }t        j@                  | jB                  | j>                  |z        }|dk(  r|jD                  x}}| jB                  }| j>                  |z  }||j8                  z  r&|r"| j                  d| j                  z   |z  |z   z  n|}	||jF                  z  r| jB                  |z  }|}t        jH                  d| jB                        } ||jJ                  z  r| |t        jL                  ||      t        jL                  | j,                  | j.                        z
  z
  t        jL                  | |z  |      t        jL                  | | jN                  z  | jP                        z
  z   z  nOt        jL                  || jP                  z  || jN                  z  z
  || jP                  z  || jN                  z  z         }!|!| jR                  ||j                  d||| jT                        | jV                  z
  z   z  z   }"t        jX                  |"      }#||jJ                  z  r| jZ                  |#z   nGt        j\                  t        j\                  | jZ                        t        j\                  |#      z         }||j^                  z  r#t        j`                  || jb                  |z        }||jd                  z  rt        j`                  ||      }||j:                  |j<                  z  z  rX|j                  d||| jf                        }$d| jh                  z   |$| jj                  z
  z  }%| j                  | jh                  z
  |z  ||%z
  z   }&||j:                  z  rO| j                  || j.                  |z  z  | jl                  | j,                  |z  z  z
  | j.                  |z  |&z  z
  z  }
||j<                  z  r| j4                  || j,                  z
  z  || j,                  z   z  | jl                  |z   z  }'||'|z  ||&z  z
  | j,                  z  | jl                  z  z   }||'| j,                  z  | j.                  |&z  z
  |z  |z  z
  }||jn                  z  rp|j                  d||| jp                        }(| j>                  dk(  s| jB                  dk(  r?|| jr                  z  || jt                  z  z
  })|| jr                  z  || jt                  z  z   }*n| j>                  | jB                  z  |dk  r"| j.                  d|z
  z  || j,                  z  z   n$|| j.                  |z  d|z   z  | j,                  z   z  z  })t        j6                  | jB                        t        j6                  | j>                        | j.                  z  |z  z   }*| jv                  t        jL                  |)|*      z  | jx                  |(| jz                  z
  z  z   }|r|nt        jX                  |      }|||||	|
|||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   si   /=AXXECE$EEEsESE3Estyy8,,,,GYY(++h.B.BBC$dCc3;; CSsll7#e||G,nff A

N34e}}U+ee
((5/atxx1$$T$(KK!OdkkAo$E$(KK!OdkkAo$E$(JJ0 0c sTYY'exxf%	TVVt	, f$t{{V';;f$t{{V';;$$T5%CTZZES499_$=>$''!"tyyTXX-F)FGGG%488E?& KK& 4;;#77EKK& 4;;#77E
))A4775>11
2C(00083I3IIK	CK$&$$T5%C^dii0cKK%EJJt{{DKK%$78Eznn$eeKKEu!4""":ADGGDJJ%/#56wc###kkE!e55
--4;;
'a H000 EzzE?zzdkk4;;?@A zz!E/?zz!dkk/4;;?@A B JJut{{2UT[[5HH$t{{2UT[[5HHJ  dii''eUDIIF99 	 e ll5!e#*X-A-A#Adii% 1 1$)) < $ 1 1% 8!9 :  """[[5 01d!!![[&d(((8+A+AAB""4tyyAc^dii0cZZ$**$-s;c	8))	) ggt{{U': ;))t{{U':;!<;;.45 6 
8))	)XX,-dkk!#&*ii#o7E	ECK/4;;>JJDKK$++*;;uDsJJ""5%		Bc		T[[A-#edjj&88#edjj&88 t{{*?E{$++V
$v';
;v-V<t{{JKM ''$++&''$++&4u<=XX

6622XXtyy)*c '$,,u"5CdD#sCc99rc   c           	         ddl m} | j                  ||j                  z  r| j                  nt        j                  | j                        | j                  |d}| j                  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ii#*X-A-A#Adii		*ii-F 6:5F5FS'62CtT3S#sx   GF5M"""TF6N###dVF^!!!D6&>''''''fUm36%=uMrc   c           	      2   ddl m} | j                  ||j                  z  r| j                  nt        j                  | j                        | j                  |d}| j                  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ii#*X-A-A#Adii		*ii-F 6:5F5F
C62CtT3S#sx   G"""CF5M"""TF6N###dVF^!!!D6&>''''''fUm36%=uMrc   c           
      j    || _         | j                  d| j                   d      \	  | _        }}}}}}}}y)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  s8     DH'+'8'8!'L$DHaAq!Q1rc   c           	          ddl m} || _        | j                  d| j                  |j                        \	  }}}}| _        }}}}y)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  sE     0DH'+'8'8txx9A9J9J(L$Aq!Q!Q1rc   N)__name__
__module____qualname____doc__r   STANDARDrf   r   rW   rb   r   r   r   r   r    rc   ra   r   r   ?   sh    ! )11!--.xxxKvW:r %7$?$? B (:'B'B @M
Lrc   r   )r   r   geographiclib.geomathr    geographiclib.geodesiccapabilityr   r   r   rc   ra   <module>r      s$   &t  & ?lL lLrc   