a
    }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|srt|rt|| _tt|\| _| _n|| _|| _|| _tt| j\}	}
|	| j9 }	t|	|
\}	}
t|j|
}
td|jt|	  | _| j|
 | _t| j| j|	 | _ |	| _!| j|	 | _"|	dksL| jdkrV|
| j nd | _#| _$t| j!| j#\| _!| _#t| j |j | _%| j%ddtd| j%   | j%  }| j
|j&@ rJ|'|| _(t)t*|j+d | _,|-|| j, |.d| j!| j#| j,| _/t0| j/}t1| j/}| j!| | j#|  | _2| j#| | j!|  | _3| j
|j4@ rzt)t*|j5d | _6|7|| j6 | j
|j8@ r|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@ rt)t*|jG| _H|I|| jH t| j| j  | j |jJ | _K|.d| j!| j#| jH| _LtjM| _Nt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   ZLatFixlat1lon1mathisnanAngNormalizeazi1sincosdZAngRoundsalp1calp1Znormmaxtiny_sqrtZ_ep2sq_dn1_salp0hypot_calp0_ssig1_somg1_csig1_comg1_k2ZCAP_C1Z_A1m1f_A1m1listrangeZnC1__C1aZ_C1f_SinCosSeries_B11sincos_stau1_ctau1ZCAP_C1pZnC1p__C1paZ_C1pfZCAP_C2Z_A2m1f_A2m1ZnC2__C2aZ_C2f_B21ZCAP_C3ZnC3__C3aZ_C3fZ_A3f_A3c_B31ZCAP_C4ZnC4__C4aZ_C4fZ_e2_A4_B41nans13a13)selfZgeodr   r   r   r   r   r   r   Zsbet1Zcbet1Zepssc rC   V/var/www/html/django/DPS/env/lib/python3.9/site-packages/geographiclib/geodesicline.py__init__B   s     

$ zGeodesicLine.__init__c           +   	   C   s&  ddl m} tj } } } } }	 }
 } }}|| j|j@ M }|sn| j|j|j@ @ sn|||||	|
|||f	S d}d}|rt|}t	|\}}n4|| 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rL|d||| j}d| j || j  }| j| }t | j!| j| }|dkr|j" }}| j!}| j| }||j@ r|r| j
d| j | |  n|}	||j#@ r| j!| }|}t$d| j!} ||j%@ rL| |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@ r| j
|| j|  | j6| j|   | j| |&   }
||j@ r| j|| j  || j  | j6|  }'||'| ||&  | j | j6  }||'| j | j|&  | |  }||j7@ r|d||| j8}(| jdksD| j!dkrn|| j9 || j:  })|| j9 || j:  }*nl| 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   r=   r   OUT_MASKDISTANCE_INradiansr   r   r   r)   isfiniter/   r0   r-   r1   r2   r3   r.   absr   r$   r&   r,   r   r(   r   DISTANCEREDUCEDLENGTHGEODESICSCALEr#   r"   r!   r   	LONGITUDEcopysignr   atan2r%   r'   r8   r7   r9   degreesr   r   r   Zatan2dr   r   r5   r4   r6   r    AREAr:   r   r   r   r;   r<   )+r@   ZarcmodeZs12_a12outmaskr   a12lat2lon2azi2s12m12M12M21S12ZB12ZAB1Zsig12Zssig12Zcsig12Ztau12rA   rB   Zssig2Zcsig2ZserrZdn2Zsbet2Zcbet2Zsalp2Zcalp2Zsomg2Zcomg2EZomg12Zlam12Zlon12ZB22ZAB2ZJ12tZB42Zsalp12Zcalp12rC   rC   rD   _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
@ rz||d< ||j@ r||d< ||j@ r||d< ||j@ r|	|d	< ||j@ r|
|d
< ||d< ||j@ 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   rX   FrT   rU   rV   rW   rY   rZ   r[   r\   )r	   r   r   r   r   r   r   r   r_   rF   r   rN   r   rL   rM   rR   )r@   rX   rS   r   resultrT   rU   rV   rW   rY   rZ   r[   r\   rC   rC   rD   PositionV  s&    


zGeodesicLine.Positionc              	   C   s   ddl m} | j||j@ r | jn
t| j| j|d}| d||\	}}}}}}	}
}}||j	M }||j
@ rr||d< ||j@ r||d< ||j@ r||d< ||j@ r||d< ||j@ r|	|d	< ||j@ r|
|d
< ||d< ||j@ 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   rT   TrX   rU   rV   rW   rY   rZ   r[   r\   )r	   r   r   r   r   r   r   r   r_   rF   rK   r   rN   r   rL   rM   rR   )r@   rT   rS   r   r`   rU   rV   rW   rX   rY   rZ   r[   r\   rC   rC   rD   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)r>   r_   r?   )r@   r>   _rC   rC   rD   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   r?   r_   rK   r>   )r@   r?   r   rc   rC   rC   rD   SetArc  s
    
zGeodesicLine.SetArcN)__name__
__module____qualname____doc__r   STANDARDrG   r   r=   rE   r_   ra   rb   rd   re   rC   rC   rC   rD   r   ?   s   
{ ! 
r   )ri   r   Zgeographiclib.geomathr   Z geographiclib.geodesiccapabilityr   r   rC   rC   rC   rD   <module>   s   :