o
    2cG                     @   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?@ rt)t*|j@| _A|B|| jA | j | j |C| | _D|.d| j!| j#| jA| _E| j
|jF@ rt)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^   P/var/www/html/gps/gps/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/@ rt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{Gz?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 )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   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
    :