o
    ÓèFhèG  ã                   @   s6   d Z ddlZddlmZ ddlmZ G d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                   @   s`   e Zd ZdZejejB ejejfdd„Z	dd„ Z
ejfdd„Zejfdd	„Zd
d„ Zdd„ ZdS )ÚGeodesicLinezPoints on a geodesic pathc                 C   s²  ddl m} |j| _	 |j| _	 |j| _|j| _|j| _||jB |jB |j	B | _
	 t |¡| _	 || _	 t |¡s>t |¡rQt |¡| _t t |¡¡\| _| _n|| _	 || _	 || _	 t t | j¡¡\}	}
|	| j9 }	t |	|
¡\}	}
t|j|
ƒ}
t d|jt |	¡  ¡| _| j|
 | _t | j| j|	 ¡| _ |	| _!| j|	 | _"|	dks¬| jdkr±|
| j nd | _#| _$t | j!| j#¡\| _!| _#t | j ¡|j | _%| j%ddt d| j% ¡  | j%  }| j
|j&@ �r+| '|¡| _(t)t*|j+d ƒƒ| _,| -|| j,¡ | .d| j!| j#| j,¡| _/t 0| j/¡}t 1| j/¡}| j!| | j#|  | _2| j#| | j!|  | _3| j
|j4@ �rCt)t*|j5d ƒƒ| _6| 7|| j6¡ | j
|j8@ �rm| 9|¡| _:t)t*|j;d ƒƒ| _<| =|| j<¡ | .d| j!| j#| j<¡| _>| j
|j?@ �rœt)t*|j@ƒƒ| _A| B|| jA¡ | j | j | C|¡ | _D| .d| j!| j#| jA¡| _E| j
|jF@ �rÎt)t*|jGƒƒ| _H| I|| jH¡ t | j¡| j  | j |jJ | _K| .d| j!| j#| jH¡| _LtjM| _N	 tjM| _Od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Úc© r^   úS/var/www/html/loop/nvenv/lib/python3.10/site-packages/geographiclib/geodesicline.pyÚ__init__B   s˜   ÿ 

ÿ
ÿ$ÿÿÿ ÿzGeodesicLine.__init__c           +   	   C   s"  ddl m} tj } } } } }	 }
 } }}|| j|j@ M }|s7| j|j|j@ @ s7|||||	|
|||f	S d}d}|rJt |¡}t 	|¡\}}n™|| j
d| j   }t |¡r[|ntj}t |¡}t |¡}| d| j| | j|  | j| | j|  | j¡ }||| j  }t |¡}t |¡}t| jƒdkrã| j| | j|  }| j| | j|  }| d||| j¡}d| j ||| j   || j
  }||t d| jt |¡  ¡  }t |¡}t |¡}| j| | j|  }| j| | j|  }t d| jt |¡  ¡}||j|jB |jB @ �r.|�st| jƒdk�r$| d||| j¡}d| j || j  }| j| }t  | j!| j| ¡}|dk�rG|j" }}| j!}| j| }||j@ �rf|�rd| j
d| j | |  n|}	||j#@ �rë| j!| }|}t $d| j!¡} ||j%@ �r¤| |t &||¡t &| j| j¡  t &| | |¡t &| | j' | j(¡   nt &|| j( || j'  || j( || j'  ¡}!|!| j)|| d||| j*¡| j+    }"t ,|"¡}#||j%@ �rÝ| j-|# nt .t .| j-¡t .|#¡ ¡}||j/@ �rút 0|| j1| ¡}||j2@ �rt 0||¡}||j|jB @ �r…| d||| j3¡}$d| j4 |$| j5  }%| j| j4 | ||%  }&||j@ �rM| j
|| j|  | j6| j|   | j| |&   }
||j@ �r…| j|| j  || j  | j6|  }'||'| ||&  | j | j6  }||'| j | j|&  | |  }||j7@ �rü| d||| j8¡}(| jdk�s | j!dk�rµ|| j9 || j:  })|| j9 || j:  }*n6| j| j! |dk�rË| jd|  || j  n|| j| d|  | j   })t | j!¡t | j¡| j |  }*| j;t &|)|*¡ | j<|(| j=   }|�r|nt ,|¡}|||||	|
|||f	S )z4Private: General solution of position along geodesicr   r   g        r   Tg{®Gáz„?F)>r	   r   r   rT   r   ÚOUT_MASKÚDISTANCE_INÚradiansr   r   r   r/   Úisfiniter7   r8   r5   r9   r:   r=   r6   Úabsr   r(   r*   r3   r!   r,   r#   ÚDISTANCEÚREDUCEDLENGTHÚGEODESICSCALEr'   r&   r%   r    Ú	LONGITUDEÚcopysignr   Úatan2r)   r+   rK   rH   rL   Údegreesr   r   r   Úatan2dr   r   rC   rA   rE   r$   ÚAREArO   r   r   r   rR   rS   )+rW   Ú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Úcalp12r^   r^   r_   Ú_GenPosition½   sâ   &ÿ
ýÿ"ÿ


"û
ÿÿÿýÿúÿÿ
ÿÿÿþÿÿ  

"þ
ÿÿzGeodesicLine._GenPositionc              	   C   sà   ddl m} | j||j@ r| jnt | j¡| j|dœ}|  d||¡\	}}}}}}	}
}}||j	M }||d< ||j
@ r=||d< ||j@ rF||d< ||j@ rO||d< ||j@ rX|	|d	< ||j@ re|
|d
< ||d< ||j@ rn||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   rv   Frr   rs   rt   ru   rw   rx   ry   rz   )r	   r   r   r   r   r   r   r   r–   ra   r   ri   r   rg   rh   rn   )rW   rv   rq   r   Úresultrr   rs   rt   ru   rw   rx   ry   rz   r^   r^   r_   ÚPositionV  s&   
ýÿ

zGeodesicLine.Positionc              	   C   sê   ddl m} | j||j@ r| jnt | j¡| j|dœ}|  d||¡\	}}}}}}	}
}}||j	M }||j
@ r9||d< ||j@ rB||d< ||j@ rK||d< ||j@ rT||d< ||j@ r]|	|d	< ||j@ rj|
|d
< ||d< ||j@ rs||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   rr   Trv   rs   rt   ru   rw   rx   ry   rz   )r	   r   r   r   r   r   r   r   r–   ra   rf   r   ri   r   rg   rh   rn   )rW   rr   rq   r   r—   rs   rt   ru   rv   rw   rx   ry   rz   r^   r^   r_   ÚArcPositionw  s&   
ýÿ

zGeodesicLine.ArcPositionc              
   C   s.   || _ |  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)rU   r–   rV   )rW   rU   Ú_r^   r^   r_   ÚSetDistance—  s   (zGeodesicLine.SetDistancec              	   C   s<   ddl m} || _|  d| j|j¡\	}}}}| _}}}}dS )z…Specify 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   rV   r–   rf   rU   )rW   rV   r   rš   r^   r^   r_   ÚSetArc¡  s
   
ÿzGeodesicLine.SetArcN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚSTANDARDrb   r   rT   r`   r–   r˜   r™   r›   rœ   r^   r^   r^   r_   r   ?   s    ÿ
ý{ ! 
r   )r    r   Úgeographiclib.geomathr   Ú geographiclib.geodesiccapabilityr   r   r^   r^   r^   r_   Ú<module>   s
    :