
    R1i                     *    d Z ddlmZmZ ddlmZ d Zy)z7Routines solving basic geometric problems in astronomy.    )nanwhere   )	length_ofc                     d| t        |       z  |z  j                  d      z  }||z  j                  d      ||z  z
  }||z  d|z  z
  }|t        |dk  t        d      z  }||z
  dz  ||z   dz  fS )a  Compute distance to intersections of a line and a sphere.

    Given a line through the origin (0,0,0) and an |xyz| ``endpoint``,
    and a sphere with the |xyz| ``center`` and scalar ``radius``,
    return the distance from the origin to their two intersections.

    If the line is tangent to the sphere, the two intersections will be
    at the same distance.  If the line does not intersect the sphere,
    two ``nan`` values will be returned.

    g       @r   )axis   g      ?)r   sumr   r   )endpointcenterradiusminus_bcdiscriminantdsqrts          U/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/skyfield/geometry.pyintersect_line_and_spherer      s      X	( 33f<AAqAIIG	&1%7AW$q1u,LE,"2C==EeOs"Wu_$;;;    N)__doc__numpyr   r   	functionsr   r    r   r   <module>r      s    =   <r   