ó
    ‰*£h: ã                   ó¦  • S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	J
r
  SSKJr  SSKJr  SSKJr  SS	KJrJrJr  SS
KJr  SSKJr  SSKJrJrJrJr  SSKJrJ r   SSK!J"r"  SSK#J$r$J%r%  SSK&J'r'J(r(  SSK)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SSK1J2r2  SSK3J4r4  SSK5J6r6J7r7  SSK8r8\9" S5       V s/ s H  n \" S5      PM     sn u  r:r; " S S\ 5      r< " S S\<5      r= " S  S!\<5      r> " S" S#\<5      r? " S$ S%\<5      r@ " S& S'\@\=5      rA " S( S)\@\>5      rB " S* S+\@\?5      rC " S, S-\<5      rD " S. S/\D\=5      rE " S0 S1\D\>5      rF " S2 S3\D\?5      rGgs  sn f )4zžLine-like geometrical entities.

Contains
========
LinearEntity
Line
Ray
Segment
LinearEntity2D
Line2D
Ray2D
Segment2D
LinearEntity3D
Line3D
Ray3D
Segment3D

é    )ÚTuple)ÚN)ÚExpr)ÚRationalÚooÚFloat)ÚEq)ÚS)Úordered)Ú_symbolÚDummyÚuniquely_named_symbol)Úsympify)Ú	Piecewise)Ú	_pi_coeffÚacosÚtanÚatan2é   )ÚGeometryEntityÚGeometrySet)ÚGeometryError)ÚPointÚPoint3D)ÚfindÚintersection)ÚAnd)ÚMatrix)ÚIntersection©Úsimplify)Úsolve)Úlinear_coeffs)ÚUndecidableÚ
filldedentNé   Ú
line_dummyc                   óú   • \ rS rSrSrSS jrS rS r\S 5       r	S r
S	 rSS
 jr\S 5       rS r\S 5       rS rS rS rS r\S 5       r\S 5       r\S 5       rS rS rS r\S 5       rS rSS jrS rSrg)ÚLinearEntityé2   a.  A base class for all linear entities (Line, Ray and Segment)
in n-dimensional Euclidean space.

Attributes
==========

ambient_dimension
direction
length
p1
p2
points

Notes
=====

This is an abstract class and is not meant to be instantiated.

See Also
========

sympy.geometry.entity.GeometryEntity

Nc                 óü   • [         R                  " X5      u  pX:X  a  [        SU R                  -  5      e[	        U5      [	        U5      :w  a  [        SU R                  -  5      e[
        R                  " XU40 UD6$ )Nú&%s.__new__ requires two unique Points.z2%s.__new__ requires two Points of equal dimension.)r   Ú_normalize_dimensionÚ
ValueErrorÚ__name__Úlenr   Ú__new__©ÚclsÚp1Úp2Úkwargss       ÚP/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/geometry/line.pyr1   ÚLinearEntity.__new__K   s{   € Ü×+Ò+¨BÓ3‰ˆØ‹8ô Ø8¸3¿<¹<ÑGóIð Iäˆr‹7”c˜"“gÓÜØDÀsÇ|Á|ÑSóUð Uô ×%Ò% c¨rÑ<°VÑ<Ð<ó    c                 óV   • U R                  U5      nUb  U$ [        SU < SU< S35      e)zuReturn a definitive answer or else raise an error if it cannot
be determined that other is on the boundaries of self.zCannot decide whether 'z' contains 'Ú')Úcontainsr$   )ÚselfÚotherÚresults      r7   Ú__contains__ÚLinearEntity.__contains__X   s4   € ð —‘˜uÓ%ˆàÑØˆMåÛ>BÃEÐJóLð Lr9   c                 ó†   • U R                   U:X  a  gXR                   -
  nU R                  nUR                  U5      S:”  a  gg)zîTest whether the point `other` lies in the positive span of `self`.
A point x is 'in front' of a point y if x.dot(y) >= 0.  Return
-1 if `other` is behind `self.p1`, 0 if `other` is `self.p1` and
and 1 if `other` is in front of `self.p1`.r   r   éÿÿÿÿ)r4   Ú	directionÚdot)r=   r>   Úrel_posÚds       r7   Ú
_span_testÚLinearEntity._span_testc   s=   € ð
 �7‰7�eÓØàŸ'™'‘/ˆØ�N‰NˆØ�5‰5�‹>˜AÓØØr9   c                 ó,   • [        U R                  5      $ )a£  A property method that returns the dimension of LinearEntity
object.

Parameters
==========

p1 : LinearEntity

Returns
=======

dimension : integer

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(1, 1)
>>> l1 = Line(p1, p2)
>>> l1.ambient_dimension
2

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0, 0), Point(1, 1, 1)
>>> l1 = Line(p1, p2)
>>> l1.ambient_dimension
3

)r0   r4   ©r=   s    r7   Úambient_dimensionÚLinearEntity.ambient_dimensionq   s   € ô> �4—7‘7‹|Ðr9   c                 óþ   • [        U [        5      (       d   [        U[        5      (       d  [        S5      eU R                  UR                  p2[	        UR                  U5      [        U5      [        U5      -  -  5      $ )aš  Return the non-reflex angle formed by rays emanating from
the origin with directions the same as the direction vectors
of the linear entities.

Parameters
==========

l1 : LinearEntity
l2 : LinearEntity

Returns
=======

angle : angle in radians

Notes
=====

From the dot product of vectors v1 and v2 it is known that:

    ``dot(v1, v2) = |v1|*|v2|*cos(A)``

where A is the angle formed between the two vectors. We can
get the directional vectors of the two lines and readily
find the angle between the two using the above formula.

See Also
========

is_perpendicular, Ray2D.closing_angle

Examples
========

>>> from sympy import Line
>>> e = Line((0, 0), (1, 0))
>>> ne = Line((0, 0), (1, 1))
>>> sw = Line((1, 1), (0, 0))
>>> ne.angle_between(e)
pi/4
>>> sw.angle_between(e)
3*pi/4

To obtain the non-obtuse angle at the intersection of lines, use
the ``smallest_angle_between`` method:

>>> sw.smallest_angle_between(e)
pi/4

>>> from sympy import Point3D, Line3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(-1, 2, 0)
>>> l1, l2 = Line3D(p1, p2), Line3D(p2, p3)
>>> l1.angle_between(l2)
acos(-sqrt(2)/3)
>>> l1.smallest_angle_between(l2)
acos(sqrt(2)/3)
ú#Must pass only LinearEntity objects)Ú
isinstancer)   Ú	TypeErrorrD   r   rE   Úabs©Úl1Úl2Úv1Úv2s       r7   Úangle_betweenÚLinearEntity.angle_between’   s]   € ôt ˜"œl×+Ñ+´J¸rÄ<×4PÑ4PÜÐAÓBÐBà—‘˜rŸ|™|ˆBÜ�B—F‘F˜2“J¤ B£¬¨B«¡Ñ0Ó1Ð1r9   c                 ó  • [        U [        5      (       d   [        U[        5      (       d  [        S5      eU R                  UR                  p2[	        [        UR                  U5      5      [        U5      [        U5      -  -  5      $ )aÏ  Return the smallest angle formed at the intersection of the
lines containing the linear entities.

Parameters
==========

l1 : LinearEntity
l2 : LinearEntity

Returns
=======

angle : angle in radians

Examples
========

>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 0), Point(0, 4), Point(2, -2)
>>> l1, l2 = Line(p1, p2), Line(p1, p3)
>>> l1.smallest_angle_between(l2)
pi/4

See Also
========

angle_between, is_perpendicular, Ray2D.closing_angle
rO   )rP   r)   rQ   rD   r   rR   rE   rS   s       r7   Úsmallest_angle_betweenÚ#LinearEntity.smallest_angle_betweenÒ   s`   € ô: ˜"œl×+Ñ+´J¸rÄ<×4PÑ4PÜÐAÓBÐBà—‘˜rŸ|™|ˆBÜ”C˜Ÿ™˜r›
“O¤S¨£W¬S°«W¡_Ñ5Ó6Ð6r9   c                 óì   • [        USS9nUR                  S U R                   5       ;   a!  [        [	        SUR                  -  5      5      eU R
                  U R                  U R
                  -
  U-  -   $ )a;  A parameterized point on the Line.

Parameters
==========

parameter : str, optional
    The name of the parameter which will be used for the parametric
    point. The default value is 't'. When this parameter is 0, the
    first point used to define the line will be returned, and when
    it is 1 the second point will be returned.

Returns
=======

point : Point

Raises
======

ValueError
    When ``parameter`` already appears in the Line's definition.

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(1, 0), Point(5, 3)
>>> l1 = Line(p1, p2)
>>> l1.arbitrary_point()
Point2D(4*t + 1, 3*t)
>>> from sympy import Point3D, Line3D
>>> p1, p2 = Point3D(1, 0, 0), Point3D(5, 3, 1)
>>> l1 = Line3D(p1, p2)
>>> l1.arbitrary_point()
Point3D(4*t + 1, 3*t, t)

T©Úrealc              3   ó8   #   • U  H  oR                   v •  M     g 7f©N)Úname)Ú.0Úfs     r7   Ú	<genexpr>Ú/LinearEntity.arbitrary_point.<locals>.<genexpr>!  s   é € Ð8Ò&7 —f–fÒ&7ùs   ‚zx
                Symbol %s already appears in object
                and cannot be used as a parameter.
                )r   rb   Úfree_symbolsr.   r%   r4   r5   ©r=   Ú	parameterÚts      r7   Úarbitrary_pointÚLinearEntity.arbitrary_pointõ   ss   € ôV �I DÑ)ˆØ�6‰6Ñ8 d×&7Ò&7Ó8Ó8ÜœZð )ð —f‘fñ)ó ó ð ð �w‰w˜$Ÿ'™' D§G¡GÑ+¨QÑ.Ñ.Ð.r9   c                  óV   • [        U 6 nUR                  (       a  [        U5      S:X  a  gg)a¹  Is a sequence of linear entities concurrent?

Two or more linear entities are concurrent if they all
intersect at a single point.

Parameters
==========

lines
    A sequence of linear entities.

Returns
=======

True : if the set of linear entities intersect in one point
False : otherwise.

See Also
========

sympy.geometry.util.intersection

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(3, 5)
>>> p3, p4 = Point(-2, -2), Point(0, 2)
>>> l1, l2, l3 = Line(p1, p2), Line(p1, p3), Line(p1, p4)
>>> Line.are_concurrent(l1, l2, l3)
True
>>> l4 = Line(p2, p3)
>>> Line.are_concurrent(l2, l3, l4)
False
>>> from sympy import Point3D, Line3D
>>> p1, p2 = Point3D(0, 0, 0), Point3D(3, 5, 2)
>>> p3, p4 = Point3D(-2, -2, -2), Point3D(0, 2, 1)
>>> l1, l2, l3 = Line3D(p1, p2), Line3D(p1, p3), Line3D(p1, p4)
>>> Line3D.are_concurrent(l1, l2, l3)
True
>>> l4 = Line3D(p2, p3)
>>> Line3D.are_concurrent(l2, l3, l4)
False

r   TF)r   Úis_FiniteSetr0   )ÚlinesÚcommon_pointss     r7   Úare_concurrentÚLinearEntity.are_concurrent*  s*   € ô^ % eÐ,ˆØ×%×%¬#¨mÓ*<ÀÓ*AØØr9   c                 ó   • [        5       e)zµSubclasses should implement this method and should return
True if other is on the boundaries of self;
False if not on the boundaries of self;
None if a determination cannot be made.)ÚNotImplementedError©r=   r>   s     r7   r<   ÚLinearEntity.contains^  s   € ô
 "Ó#Ð#r9   c                 ó4   • U R                   U R                  -
  $ )aÅ  The direction vector of the LinearEntity.

Returns
=======

p : a Point; the ray from the origin to this point is the
    direction of `self`

Examples
========

>>> from sympy import Line
>>> a, b = (1, 1), (1, 3)
>>> Line(a, b).direction
Point2D(0, 2)
>>> Line(b, a).direction
Point2D(0, -2)

This can be reported so the distance from the origin is 1:

>>> Line(b, a).direction.unit
Point2D(0, -1)

See Also
========

sympy.geometry.point.Point.unit

)r5   r4   rK   s    r7   rD   ÚLinearEntity.directione  s   € ð> �w‰w˜Ÿ™Ñ Ð r9   c                 ó  • S nS nS n[        U[        5      (       d  [        XR                  S9nUR                  (       a  U R                  U5      (       a  U/$ / $ [        U[        5      (       Ga„  [        R                  " U R                  U R                  UR                  UR                  5      n[        R                  " U6 nUS:X  aú  [        U [        5      (       a  U/$ [        U[        5      (       a  U /$ [        U [        5      (       a  [        U[        5      (       a  U" X5      $ [        U [        5      (       a  [        U[        5      (       a  U" X5      $ [        U [        5      (       a  [        U[        5      (       a  U" X5      $ [        U [        5      (       a  [        U[        5      (       a  U" X5      $ GO0US:X  Ga'  [        USS 6 n[        USS 6 nUR                  R                  UR                  5      (       a  / $ [!        UR                  UR                  * /5      R#                  5       n	[!        UR                  UR                  -
  /5      R#                  5       n
U	R%                  SU
5      R'                  SS	9u  p¼[)        U5      S:w  a  [+        S
R-                  Xš5      5      eUS   nUR                  U-  U R                  -   n[        U [        5      (       a  [        U[        5      (       a  U/$ [        U [        5      (       d  U R                  U5      (       a  UR                  U5      (       a  U/$ U R/                  [0        5      (       d  UR/                  [0        5      (       d  / $ [3        U R5                  [6        5      UR5                  [8        5      -
  [6        [8        SS9S   nS nU" U[6           U 5      (       a  U" U[8           U5      (       a  U/$ / $ / $ UR;                  U 5      $ )a
  The intersection with another geometrical entity.

Parameters
==========

o : Point or LinearEntity

Returns
=======

intersection : list of geometrical entities

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Line, Segment
>>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(7, 7)
>>> l1 = Line(p1, p2)
>>> l1.intersection(p3)
[Point2D(7, 7)]
>>> p4, p5 = Point(5, 0), Point(0, 3)
>>> l2 = Line(p4, p5)
>>> l1.intersection(l2)
[Point2D(15/8, 15/8)]
>>> p6, p7 = Point(0, 5), Point(2, 6)
>>> s1 = Segment(p6, p7)
>>> l1.intersection(s1)
[]
>>> from sympy import Point3D, Line3D, Segment3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(7, 7, 7)
>>> l1 = Line3D(p1, p2)
>>> l1.intersection(p3)
[Point3D(7, 7, 7)]
>>> l1 = Line3D(Point3D(4,19,12), Point3D(5,25,17))
>>> l2 = Line3D(Point3D(-3, -15, -19), direction_ratio=[2,8,8])
>>> l1.intersection(l2)
[Point3D(1, 1, -3)]
>>> p6, p7 = Point3D(0, 5, 2), Point3D(2, 6, 3)
>>> s1 = Segment3D(p6, p7)
>>> l1.intersection(s1)
[]

c                 óL  • U R                   R                  UR                   5      S:”  a%  U R                  UR                  5      S:¼  a  U/$ U /$ U R                  UR                  5      nUS:  a  / $ US:X  a  UR                  /$ [	        U R                  UR                  5      /$ ©Nr   )rD   rE   rH   r4   ÚSegment)Úray1Úray2Ústs      r7   Úintersect_parallel_raysÚ:LinearEntity.intersection.<locals>.intersect_parallel_rays·  s�   € Ø�~‰~×!Ñ! $§.¡.Ó1°AÓ5ð "&§¡°·±Ó!9¸QÓ!>˜�vÐJÀTÀFÐJð —_‘_ T§W¡WÓ-�Ø˜“6Ø�IØ˜1“WØ ŸG™G˜9Ð$Ü §¡¨¯©Ó1Ð2Ð2r9   c                 ó6  • U R                  UR                  5      U R                  UR                  5      p2US:  a  US:  a  / $ US:¼  a	  US:¼  a  U/$ US:¼  a!  [        U R                  UR                  5      /$ [        U R                  UR                  5      /$ r{   )rH   r4   r5   r|   )ÚrayÚsegÚst1Úst2s       r7   Ú"intersect_parallel_ray_and_segmentÚELinearEntity.intersection.<locals>.intersect_parallel_ray_and_segmentÅ  s€   € Ø—~‘~ c§f¡fÓ-¨s¯~©~¸c¿f¹fÓ/E�Ø�Q‹w˜3 ›7Ø�	Ø˜“˜c Q›hØ�u�Ø˜“Ü §¡¨¯©Ó/Ð0Ð0ä §¡¨¯©Ó/Ð0Ð0r9   c                 ó¾  • U R                  U5      (       a  U/$ UR                  U 5      (       a  U /$ U R                  R                  UR                  5      S:  a   [        UR                  UR
                  5      nU R                  UR
                  5      S:  a  XpUR                  U R                  5      S:  a  / $ [        UR
                  U R                  5      /$ r{   )r<   rD   rE   r|   r5   r4   rH   )Úseg1Úseg2s     r7   Úintersect_parallel_segmentsÚ>LinearEntity.intersection.<locals>.intersect_parallel_segmentsÐ  s«   € Ø�}‰}˜T×"Ñ"Ø�v�Ø�}‰}˜T×"Ñ"Ø�v�ð �~‰~×!Ñ! $§.¡.Ó1°AÓ5Ü˜tŸw™w¨¯©Ó0�à�‰˜tŸw™wÓ'¨!Ó+Ø!�dØ�‰˜tŸw™wÓ'¨!Ó+Ø�	Ü˜DŸG™G T§W¡WÓ-Ð.Ð.r9   ©Údimr   r&   NTr    z+Failed when solving Mx=b when M={} and b={})r   r&   )Údictr   c                 óô   • [        U[        5      (       a  g[        U[        5      (       a  U R                  $ [        U[        5      (       a"  U R                  =(       a    SU -
  R                  $ [        S5      e)NTr   zunexpected line type)rP   ÚLineÚRayÚis_nonnegativer|   r.   )ÚpÚls     r7   ÚokÚ%LinearEntity.intersection.<locals>.ok'  s_   € Ü! !¤T×*Ñ*à#Ü! !¤S×)Ñ)à ×/Ñ/Ð/Ü! !¤W×-Ñ-à ×/Ñ/×J°Q¸±U×4JÑ4JÐJÜ$Ð%;Ó<Ð<r9   )rP   r   r   rL   Úis_Pointr<   r)   r-   r4   r5   Úaffine_rankr’   r“   r|   rD   Úis_scalar_multipler   Ú	transposeÚ
col_insertÚrrefr0   r   ÚformatÚatomsr   r"   rk   rj   Úur   )r=   r>   r€   r‡   rŒ   ÚptsÚrankrT   rU   ÚmÚvÚm_rrefÚpivotsÚcoeffÚline_intersectionÚtur—   s                    r7   r   ÚLinearEntity.intersection†  sK  € òb	3ò		1ò	/ô  ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEØ�>�>Ø�}‰}˜U×#Ñ#Ø�w�à�	Ü˜œ|×,Ò,ô ×,Ò,¨T¯W©W°d·g±g¸u¿x¹xÈÏÉÓRˆCÜ×$Ò$ cÐ*ˆDà�q‹yä˜d¤D×)Ñ)Ø!˜7�NÜ˜e¤T×*Ñ*Ø ˜6�Mä˜d¤C×(Ñ(¬Z¸¼s×-CÑ-CÙ2°4Ó?Ð?Ü˜d¤C×(Ñ(¬Z¸¼w×-GÑ-GÙ=¸dÓJÐJÜ˜d¤G×,Ñ,´¸EÄ3×1GÑ1GÙ=¸eÓJÐJÜ˜d¤G×,Ñ,´¸EÄ7×1KÑ1KÙ6°tÓCÐCùØ˜”ä˜3˜r ˜7�^�Ü˜3˜q˜r˜7�^�ð
 —<‘<×2Ñ2°2·<±<×@Ñ@Ø�Iô ˜BŸL™L¨2¯<©<¨-Ð8Ó9×CÑCÓE�Ü˜BŸE™E B§E¡E™M˜?Ó+×5Ñ5Ó7�ð "#§¡¨a°Ó!3×!8Ñ!8À$Ð!8Ð!G‘�ä�v“; !Ó#Ü'Ð(U×(\Ñ(\Ð]^Ó(bÓcÐcØ˜t™�Ø$&§L¡L°Ñ$6¸¿¹Ñ$@Ð!ô ˜d¤D×)Ñ)¬j¸Ä×.EÑ.EØ-Ð.Ð.ä ¤d×+Ñ+Ø—]‘]Ð#4×5Ñ5ØŸ™Ð'8×9Ñ9Ø-Ð.Ð.Ø—z‘z¤%×(Ñ(°·±¼U×1CÑ1Cð �Iô
 ˜4×/Ñ/´Ó2°U×5JÑ5JÌ1Ó5MÑMÜ”q˜tñ%Ø%&ñ(�ò
=ñ �bœ‘e˜T—?‘?¡r¨"¬Q©%°×'7Ñ'7Ø-Ð.Ð.Ø�	ð �	à×!Ñ! $Ó'Ð'r9   c                 ó¶   • [        U [        5      (       d   [        U[        5      (       d  [        S5      eU R                  R	                  UR                  5      $ )a  Are two linear entities parallel?

Parameters
==========

l1 : LinearEntity
l2 : LinearEntity

Returns
=======

True : if l1 and l2 are parallel,
False : otherwise.

See Also
========

coefficients

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(1, 1)
>>> p3, p4 = Point(3, 4), Point(6, 7)
>>> l1, l2 = Line(p1, p2), Line(p3, p4)
>>> Line.is_parallel(l1, l2)
True
>>> p5 = Point(6, 6)
>>> l3 = Line(p3, p5)
>>> Line.is_parallel(l1, l3)
False
>>> from sympy import Point3D, Line3D
>>> p1, p2 = Point3D(0, 0, 0), Point3D(3, 4, 5)
>>> p3, p4 = Point3D(2, 1, 1), Point3D(8, 9, 11)
>>> l1, l2 = Line3D(p1, p2), Line3D(p3, p4)
>>> Line3D.is_parallel(l1, l2)
True
>>> p5 = Point3D(6, 6, 6)
>>> l3 = Line3D(p3, p5)
>>> Line3D.is_parallel(l1, l3)
False

rO   )rP   r)   rQ   rD   r›   ©rT   rU   s     r7   Úis_parallelÚLinearEntity.is_parallel;  sC   € ôZ ˜"œl×+Ñ+´J¸rÄ<×4PÑ4PÜÐAÓBÐBà�|‰|×.Ñ.¨r¯|©|Ó<Ð<r9   c                 óð   • [        U [        5      (       d   [        U[        5      (       d  [        S5      e[        R                  R                  U R                  R                  UR                  5      5      $ )aä  Are two linear entities perpendicular?

Parameters
==========

l1 : LinearEntity
l2 : LinearEntity

Returns
=======

True : if l1 and l2 are perpendicular,
False : otherwise.

See Also
========

coefficients

Examples
========

>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(-1, 1)
>>> l1, l2 = Line(p1, p2), Line(p1, p3)
>>> l1.is_perpendicular(l2)
True
>>> p4 = Point(5, 3)
>>> l3 = Line(p1, p4)
>>> l1.is_perpendicular(l3)
False
>>> from sympy import Point3D, Line3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(-1, 2, 0)
>>> l1, l2 = Line3D(p1, p2), Line3D(p2, p3)
>>> l1.is_perpendicular(l2)
False
>>> p4 = Point3D(5, 3, 7)
>>> l3 = Line3D(p1, p4)
>>> l1.is_perpendicular(l3)
False

rO   )rP   r)   rQ   r
   ÚZeroÚequalsrD   rE   r­   s     r7   Úis_perpendicularÚLinearEntity.is_perpendicularm  sP   € ôV ˜"œl×+Ñ+´J¸rÄ<×4PÑ4PÜÐAÓBÐBä�v‰v�}‰}˜RŸ\™\×-Ñ-¨b¯l©lÓ;Ó<Ð<r9   c                 ód   • [        U R                  U R                  5      nUR                  U5      $ )zó
Return True if self and other are contained in the same line.

Examples
========

>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 1), Point(3, 4), Point(2, 3)
>>> l1 = Line(p1, p2)
>>> l2 = Line(p1, p3)
>>> l1.is_similar(l2)
True
)r’   r4   r5   r<   )r=   r>   r–   s      r7   Ú
is_similarÚLinearEntity.is_similar�  s'   € ô �—‘˜$Ÿ'™'Ó"ˆØ�z‰z˜%Ó Ð r9   c                 ó"   • [         R                  $ )zœ
The length of the line.

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(3, 5)
>>> l1 = Line(p1, p2)
>>> l1.length
oo
)r
   ÚInfinityrK   s    r7   ÚlengthÚLinearEntity.length®  s   € ô �z‰zÐr9   c                 ó    • U R                   S   $ )zåThe first defining point of a linear entity.

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(5, 3)
>>> l = Line(p1, p2)
>>> l.p1
Point2D(0, 0)

r   ©ÚargsrK   s    r7   r4   ÚLinearEntity.p1¾  ó   € ð& �y‰y˜‰|Ðr9   c                 ó    • U R                   S   $ )zæThe second defining point of a linear entity.

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(5, 3)
>>> l = Line(p1, p2)
>>> l.p2
Point2D(5, 3)

r   r½   rK   s    r7   r5   ÚLinearEntity.p2Ó  rÀ   r9   c                 óX   • [        XR                  S9n[        XU R                  -   5      $ )aW  Create a new Line parallel to this linear entity which passes
through the point `p`.

Parameters
==========

p : Point

Returns
=======

line : Line

See Also
========

is_parallel

Examples
========

>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 0), Point(2, 3), Point(-2, 2)
>>> l1 = Line(p1, p2)
>>> l2 = l1.parallel_line(p3)
>>> p3 in l2
True
>>> l1.is_parallel(l2)
True
>>> from sympy import Point3D, Line3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(2, 3, 4), Point3D(-2, 2, 0)
>>> l1 = Line3D(p1, p2)
>>> l2 = l1.parallel_line(p3)
>>> p3 in l2
True
>>> l1.is_parallel(l2)
True

rŽ   )r   rL   r’   rD   ©r=   r•   s     r7   Úparallel_lineÚLinearEntity.parallel_lineè  s)   € ôP �!×/Ñ/Ñ0ˆÜ�A˜4Ÿ>™>Ñ)Ó*Ð*r9   c                 ó–   • [        XR                  S9nX;   a  XR                  R                  -   n[	        XR                  U5      5      $ )aÑ  Create a new Line perpendicular to this linear entity which passes
through the point `p`.

Parameters
==========

p : Point

Returns
=======

line : Line

See Also
========

sympy.geometry.line.LinearEntity.is_perpendicular, perpendicular_segment

Examples
========

>>> from sympy import Point3D, Line3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(2, 3, 4), Point3D(-2, 2, 0)
>>> L = Line3D(p1, p2)
>>> P = L.perpendicular_line(p3); P
Line3D(Point3D(-2, 2, 0), Point3D(4/29, 6/29, 8/29))
>>> L.is_perpendicular(P)
True

In 3D the, the first point used to define the line is the point
through which the perpendicular was required to pass; the
second point is (arbitrarily) contained in the given line:

>>> P.p2 in L
True
rŽ   )r   rL   rD   Úorthogonal_directionr’   Ú
projectionrÄ   s     r7   Úperpendicular_lineÚLinearEntity.perpendicular_line  s@   € ôJ �!×/Ñ/Ñ0ˆØ‹9Ø—N‘N×7Ñ7Ñ7ˆAÜ�A—‘ qÓ)Ó*Ð*r9   c                 óÆ   • [        XR                  S9nX;   a  U$ U R                  U5      n[        [	        U R
                  U R                  5      U5      u  n[        X5      $ )aí  Create a perpendicular line segment from `p` to this line.

The endpoints of the segment are ``p`` and the closest point in
the line containing self. (If self is not a line, the point might
not be in self.)

Parameters
==========

p : Point

Returns
=======

segment : Segment

Notes
=====

Returns `p` itself if `p` is on this linear entity.

See Also
========

perpendicular_line

Examples
========

>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(0, 2)
>>> l1 = Line(p1, p2)
>>> s1 = l1.perpendicular_segment(p3)
>>> l1.is_perpendicular(s1)
True
>>> p3 in s1
True
>>> l1.perpendicular_segment(Point(4, 0))
Segment2D(Point2D(4, 0), Point2D(2, 2))
>>> from sympy import Point3D, Line3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(0, 2, 0)
>>> l1 = Line3D(p1, p2)
>>> s1 = l1.perpendicular_segment(p3)
>>> l1.is_perpendicular(s1)
True
>>> p3 in s1
True
>>> l1.perpendicular_segment(Point3D(4, 0, 0))
Segment3D(Point3D(4, 0, 0), Point3D(4/3, 4/3, 4/3))

rŽ   )r   rL   rÊ   r   r’   r4   r5   r|   ©r=   r•   r–   r5   s       r7   Úperpendicular_segmentÚ"LinearEntity.perpendicular_segment=  sV   € ôh �!×/Ñ/Ñ0ˆØ‹9ØˆHØ×#Ñ# AÓ&ˆäœ4 §¡¨¯©Ó1°1Ó5‰ˆä�q‹~Ðr9   c                 ó2   • U R                   U R                  4$ )a.  The two points used to define this linear entity.

Returns
=======

points : tuple of Points

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(5, 11)
>>> l1 = Line(p1, p2)
>>> l1.points
(Point2D(0, 0), Point2D(5, 11))

)r4   r5   rK   s    r7   ÚpointsÚLinearEntity.pointsz  s   € ð0 —‘˜Ÿ™Ð!Ð!r9   c                 ó€  ^ • [        U[        5      (       d  [        UT R                  S9nU 4S jn[        U[        5      (       a  U" U5      $ [        U[        5      (       aÊ  U" UR
                  5      U" UR                  5      pCX4:X  a  U$ UR                  X45      n[        T U5      nUR                  (       a  U$ UR                  (       a  [        U5      S:X  a  Uu  nU$ T R                  R                  UR                  5      S:  a  UR                  u  p4UR                  XC5      nU$ [!        SU< ST < 35      e)a~  Project a point, line, ray, or segment onto this linear entity.

Parameters
==========

other : Point or LinearEntity (Line, Ray, Segment)

Returns
=======

projection : Point or LinearEntity (Line, Ray, Segment)
    The return type matches the type of the parameter ``other``.

Raises
======

GeometryError
    When method is unable to perform projection.

Notes
=====

A projection involves taking the two points that define
the linear entity and projecting those points onto a
Line and then reforming the linear entity using these
projections.
A point P is projected onto a line L by finding the point
on L that is closest to P. This point is the intersection
of L and the line perpendicular to L that passes through P.

See Also
========

sympy.geometry.point.Point, perpendicular_line

Examples
========

>>> from sympy import Point, Line, Segment, Rational
>>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(Rational(1, 2), 0)
>>> l1 = Line(p1, p2)
>>> l1.projection(p3)
Point2D(1/4, 1/4)
>>> p4, p5 = Point(10, 0), Point(12, 1)
>>> s1 = Segment(p4, p5)
>>> l1.projection(s1)
Segment2D(Point2D(5, 5), Point2D(13/2, 13/2))
>>> p1, p2, p3 = Point(0, 0, 1), Point(1, 1, 2), Point(2, 0, 1)
>>> l1 = Line(p1, p2)
>>> l1.projection(p3)
Point3D(2/3, 2/3, 5/3)
>>> p4, p5 = Point(10, 0, 1), Point(12, 1, 3)
>>> s1 = Segment(p4, p5)
>>> l1.projection(s1)
Segment3D(Point3D(10/3, 10/3, 13/3), Point3D(5, 5, 6))

rŽ   c                 óz   >• [         R                  " U TR                  -
  TR                  5      TR                  -   $ ra   )r   Úprojectr4   rD   )r•   r=   s    €r7   Ú
proj_pointÚ+LinearEntity.projection.<locals>.proj_pointÑ  s)   ø€ Ü—=’=  T§W¡W¡¨d¯n©nÓ=ÀÇÁÑGÐGr9   r   r   zDo not know how to project z onto )rP   r   r   rL   r)   r4   r5   Ú	__class__r   Úis_emptyrn   r0   rD   rE   r¾   Úfuncr   )r=   r>   rÖ   r4   r5   Ú	projectedÚas   `      r7   rÉ   ÚLinearEntity.projection”  s  ø€ ôt ˜%¤×0Ñ0Ü˜% T×%;Ñ%;Ñ<ˆEõ	Hô �eœU×#Ñ#Ù˜eÓ$Ð$Ü˜œ|×,Ñ,Ù §¡Ó)©:°e·h±hÓ+?�à‹xØ�	ØŸ™¨Ó/ˆIÜ$ T¨9Ó5ˆIØ×!×!Ø Ð à×%×%¬#¨i«.¸AÓ*=à‘�Ø�à�~‰~×!Ñ! )×"5Ñ"5Ó6¸Ó:Ø"Ÿ™‘�Ø%ŸN™N¨2Ó2�	ØÐåÛ7<ºdÐCóEð 	Er9   c                 ó¾  • Ub  [         R                  " U5      nO[         nU R                  [        5      n[	        U [
        5      (       a  [        UR                  SS5      5      nOY[	        U [        5      (       a  UR                  5       nO3[	        U [        5      (       a  UR                  SS5      nO[        S5      eUR                  [        [        U5      5      $ )aè  A random point on a LinearEntity.

Returns
=======

point : Point

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Line, Ray, Segment
>>> p1, p2 = Point(0, 0), Point(5, 3)
>>> line = Line(p1, p2)
>>> r = line.random_point(seed=42)  # seed value is optional
>>> r.n(3)
Point2D(-0.72, -0.432)
>>> r in line
True
>>> Ray(p1, p2).random_point(seed=42).n(3)
Point2D(0.72, 0.432)
>>> Segment(p1, p2).random_point(seed=42).n(3)
Point2D(3.2, 1.92)

r   r   zunhandled line type)ÚrandomÚRandomrk   rj   rP   r“   rR   Úgaussr|   r’   rt   Úsubsr   )r=   ÚseedÚrngÚptr¥   s        r7   Úrandom_pointÚLinearEntity.random_pointí  s£   € ð< ÑÜ—-’- Ó%‰CäˆCØ×!Ñ!¤!Ó$ˆÜ�dœC× Ñ Ü�C—I‘I˜a “OÓ$‰AÜ˜œg×&Ñ&Ø—
‘
“‰AÜ˜œd×#Ñ#Ø—	‘	˜!˜Q“‰Aä%Ð&;Ó<Ð<Ø�w‰w”qœ( 1›+Ó&Ð&r9   c                 ó²  • [        U[        5      (       d  [        SU-  5      eXp2UR                  R                  UR                  R                  :w  az  [        U[
        5      (       a  X2p2[        R                  " UR                  UR                  SS9u  pE[        R                  " UR                  UR                  SS9u  pF[        XV5      n[        X#5      nU(       d  [        S5      eUS   n[        U[        5      (       a  U /$ UR                  R                  n	UR                  R                  n
[        XˆU	-   U
-   5      n[        XˆU	-   U
-
  5      nX¼/$ )aÖ  Returns the perpendicular lines which pass through the intersections
of self and other that are in the same plane.

Parameters
==========

line : Line3D

Returns
=======

list: two Line instances

Examples
========

>>> from sympy import Point3D, Line3D
>>> r1 = Line3D(Point3D(0, 0, 0), Point3D(1, 0, 0))
>>> r2 = Line3D(Point3D(0, 0, 0), Point3D(0, 1, 0))
>>> r1.bisectors(r2)
[Line3D(Point3D(0, 0, 0), Point3D(1, 1, 0)), Line3D(Point3D(0, 0, 0), Point3D(1, -1, 0))]

zExpecting LinearEntity, not %sÚignore)Úon_morphzThe lines do not intersectr   )rP   r)   r   r4   rL   ÚLine2Dr   r-   r5   r’   r   rD   Úunit)r=   r>   rT   rU   Ú_r4   r5   Úpointrå   Úd1Úd2Úbis1Úbis2s                r7   Ú	bisectorsÚLinearEntity.bisectors  s   € ô0 ˜%¤×.Ñ.ÜÐ @À5Ñ HÓIÐIàˆBð �5‰5×"Ñ" b§e¡e×&=Ñ&=Ó=Ü˜"œf×%Ñ%Ø�BÜ×.Ò.¨r¯u©u°b·e±eÀhÑO‰EˆAÜ×.Ò.¨r¯u©u°b·e±eÀhÑO‰EˆAÜ�b“ˆBä˜RÓ$ˆö ÜÐ <Ó=Ð=à�q‘ˆBÜ˜"œd×#Ñ#à�v�ð �\‰\×ÑˆØ�\‰\×Ñˆä�B˜R™ "™Ó%ˆÜ�B˜R™ "™Ó%ˆàˆ|Ðr9   © ra   ©rj   ) r/   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r1   r@   rH   ÚpropertyrL   rX   r[   rk   Ústaticmethodrq   r<   rD   r   r®   r³   r¶   rº   r4   r5   rÅ   rÊ   rÎ   rÑ   rÉ   ræ   ró   Ú__static_attributes__rõ   r9   r7   r)   r)   2   sú   † ñô0=ò	Lòð ñó ðò@>2ò@!7ôF3/ðj ñ1ó ð1òf$ð ñ!ó ð!ò@s(òj0=òd.=ò`!ð" ñó ðð ñó ðð( ñó ðò()+òV(+òT;ðz ñ"ó ð"ò2WEôr+'õZ8r9   r)   c                   ó:   • \ rS rSrSrS rS rS rS rS
S jr	Sr
g	)r’   iU  a&  An infinite line in space.

A 2D line is declared with two distinct points, point and slope, or
an equation. A 3D line may be defined with a point and a direction ratio.

Parameters
==========

p1 : Point
p2 : Point
slope : SymPy expression
direction_ratio : list
equation : equation of a line

Notes
=====

`Line` will automatically subclass to `Line2D` or `Line3D` based
on the dimension of `p1`.  The `slope` argument is only relevant
for `Line2D` and the `direction_ratio` argument is only relevant
for `Line3D`.

The order of the points will define the direction of the line
which is used when calculating the angle between lines.

See Also
========

sympy.geometry.point.Point
sympy.geometry.line.Line2D
sympy.geometry.line.Line3D

Examples
========

>>> from sympy import Line, Segment, Point, Eq
>>> from sympy.abc import x, y, a, b

>>> L = Line(Point(2,3), Point(3,5))
>>> L
Line2D(Point2D(2, 3), Point2D(3, 5))
>>> L.points
(Point2D(2, 3), Point2D(3, 5))
>>> L.equation()
-2*x + y + 1
>>> L.coefficients
(-2, 1, 1)

Instantiate with keyword ``slope``:

>>> Line(Point(0, 0), slope=0)
Line2D(Point2D(0, 0), Point2D(1, 0))

Instantiate with another linear object

>>> s = Segment((0, 0), (0, 1))
>>> Line(s).equation()
x

The line corresponding to an equation in the for `ax + by + c = 0`,
can be entered:

>>> Line(3*x + y + 18)
Line2D(Point2D(0, -18), Point2D(1, -21))

If `x` or `y` has a different name, then they can be specified, too,
as a string (to match the name) or symbol:

>>> Line(Eq(3*a + b, -18), x='a', y=b)
Line2D(Point2D(0, -18), Point2D(1, -21))
c                 ó.  ^^• [        U5      S:X  Ga  [        US   [        [        45      (       aø  [	        SU5      mU(       d  SnSnO$UR                  ST5      nUR                  ST5      nU(       a  [        S5      eUS   m[        T[        5      (       a  TR                  TR                  -
  mUU4S jnU" U5      nU" U5      n[        TX45      u  pgnU(       a  [        SU* U-  4U* U-  S9$ U(       a  [        U* U-  S4[        S9$ [        S	[        S
5      X41-
  -  5      e[        U5      S:”  aÞ  US   n	[        U5      S:”  a  US   n
OS n
[        U	[        5      (       a(  U
(       a  [        S5      e[        U	R                  5      nOI[        U	5      n	[        U	5      nU
c%  [        U
[        5      (       a  U
R                   U:w  a  [        U
5      n
US:X  a  [#        Xš40 UD6$ US:X  a  [%        Xš40 UD6$ [        R&                  " X	U
40 UD6$ g )Nr   r   Ú?ÚxÚyz"expecting only x and y as keywordsc                 óB   >•  [        U T5      $ ! [         a    Ts $ f = fra   )r   r.   )r  ÚequationÚmissings    €€r7   Úfind_or_missingÚ%Line.__new__.<locals>.find_or_missing­  s)   ø€ ð#Ü  8Ó,Ð,øÜ!ó #Ø"’Nð#ús   ƒ ��)Úslopeznot found in equation: %sÚxyz)If p1 is a LinearEntity, p2 must be None.r&   é   )r0   rP   r   r	   r   Úpopr.   ÚlhsÚrhsr#   r’   r   Úsetr)   r4   r   rL   rë   ÚLine3Dr1   )r3   r¾   r6   r  r  r  rÜ   ÚbÚcr4   r5   r�   r  r  s               @@r7   r1   ÚLine.__new__�  sð  ù€ Üˆt‹9˜Œ>œj¨¨a©´4¼°*×=Ñ=Ü+¨C°Ó6ˆGÞØ�Ø‘à—J‘J˜s GÓ,�Ø—J‘J˜s GÓ,�ÞÜ Ð!EÓFÐFà˜A‘wˆHÜ˜(¤B×'Ñ'Ø#Ÿ<™<¨(¯,©,Ñ6�ö#ñ
   Ó"ˆAÙ Ó"ˆAä# H¨aÓ3‰GˆA�!æÜ˜Q   1¡˜I¨a¨R°©TÑ2Ð2ÞÜ˜a˜R ™T 1˜I¬RÑ0Ð0äÐ8¼CÀ»IÈÈÑ<NÑOÓPÐPô �4‹y˜1‹}Ø˜!‘W�Ü�t“9˜q“=Ø˜a™‘Bà�Bä˜b¤,×/Ñ/ÞÜ(Ð)TÓUÐUÜ˜bŸe™e›*‘Cä˜r›�BÜ˜b›'�CØ‘~¬°B¼×)>Ñ)>À2×CWÑCWÐ[^ÓC^Ü" 2›Y˜à˜!“8Ü! "Ñ3¨FÑ3Ð3Ø˜A“XÜ! "Ñ3¨FÑ3Ð3Ü#×+Ò+¨C°RÑB¸6ÑBÐBð+ r9   c                 ó€  • [        U[        5      (       d  [        XR                  S9n[        U[        5      (       a+  [        R                  " XR
                  U R                  5      $ [        U[        5      (       aA  [        R                  " U R
                  U R                  UR
                  UR                  5      $ g)a‚  
Return True if `other` is on this Line, or False otherwise.

Examples
========

>>> from sympy import Line,Point
>>> p1, p2 = Point(0, 1), Point(3, 4)
>>> l = Line(p1, p2)
>>> l.contains(p1)
True
>>> l.contains((0, 1))
True
>>> l.contains((0, 0))
False
>>> a = (0, 0, 0)
>>> b = (1, 1, 1)
>>> c = (2, 2, 2)
>>> l1 = Line(a, b)
>>> l2 = Line(b, a)
>>> l1 == l2
False
>>> l1 in l2
True

rŽ   F)rP   r   r   rL   Úis_collinearr4   r5   r)   ru   s     r7   r<   ÚLine.containsÖ  s€   € ô6 ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEÜ�eœU×#Ñ#Ü×%Ò% e¯W©W°d·g±gÓ>Ð>Ü�eœ\×*Ñ*Ü×%Ò% d§g¡g¨t¯w©w¸¿¹À%Ç(Á(ÓKÐKØr9   c                 óÔ   • [        U[        5      (       d  [        XR                  S9nU R	                  U5      (       a  [
        R                  $ U R                  U5      R                  $ )aÐ  
Finds the shortest distance between a line and a point.

Raises
======

NotImplementedError is raised if `other` is not a Point

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(1, 1)
>>> s = Line(p1, p2)
>>> s.distance(Point(-1, 1))
sqrt(2)
>>> s.distance((-1, 2))
3*sqrt(2)/2
>>> p1, p2 = Point(0, 0, 0), Point(1, 1, 1)
>>> s = Line(p1, p2)
>>> s.distance(Point(-1, 1, 1))
2*sqrt(6)/3
>>> s.distance((-1, 1, 1))
2*sqrt(6)/3

rŽ   )	rP   r   r   rL   r<   r
   r±   rÎ   rº   ru   s     r7   ÚdistanceÚLine.distanceù  sP   € ô6 ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEØ�=‰=˜×ÑÜ—6‘6ˆMØ×)Ñ)¨%Ó0×7Ñ7Ð7r9   c                 ó°   • [        U[        5      (       d  g[        R                  " U R                  UR                  U R
                  UR
                  5      $ ©úAReturns True if self and other are the same mathematical entitiesF)rP   r’   r   r  r4   r5   ru   s     r7   r²   ÚLine.equals  s9   € ä˜%¤×&Ñ&ØÜ×!Ò! $§'¡'¨5¯8©8°T·W±W¸e¿h¹hÓGÐGr9   c                 ó    • [        USS9nUSS/$ )a  The plot interval for the default geometric plot of line. Gives
values that will produce a line that is +/- 5 units long (where a
unit is the distance between the two points that define the line).

Parameters
==========

parameter : str, optional
    Default value is 't'.

Returns
=======

plot_interval : list (plot interval)
    [parameter, lower_bound, upper_bound]

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(5, 3)
>>> l1 = Line(p1, p2)
>>> l1.plot_interval()
[t, -5, 5]

Tr^   éûÿÿÿé   ©r   rh   s      r7   Úplot_intervalÚLine.plot_interval   s   € ô6 �I DÑ)ˆØ�2�qˆzÐr9   rõ   Nrö   )r/   r÷   rø   rù   rú   r1   r<   r  r²   r!  rý   rõ   r9   r7   r’   r’   U  s'   † ñFòN7Còr!òF8òBH÷r9   r’   c                   óX   • \ rS rSrSrSS jrSS jrS rS rS r	SS	 jr
\S
 5       rSrg)r“   i?  av  A Ray is a semi-line in the space with a source point and a direction.

Parameters
==========

p1 : Point
    The source of the Ray
p2 : Point or radian value
    This point determines the direction in which the Ray propagates.
    If given as an angle it is interpreted in radians with the positive
    direction being ccw.

Attributes
==========

source

See Also
========

sympy.geometry.line.Ray2D
sympy.geometry.line.Ray3D
sympy.geometry.point.Point
sympy.geometry.line.Line

Notes
=====

`Ray` will automatically subclass to `Ray2D` or `Ray3D` based on the
dimension of `p1`.

Examples
========

>>> from sympy import Ray, Point, pi
>>> r = Ray(Point(2, 3), Point(3, 5))
>>> r
Ray2D(Point2D(2, 3), Point2D(3, 5))
>>> r.points
(Point2D(2, 3), Point2D(3, 5))
>>> r.source
Point2D(2, 3)
>>> r.xdirection
oo
>>> r.ydirection
oo
>>> r.slope
2
>>> Ray(Point(0, 0), angle=pi/4).slope
1

Nc                 óð   • [        U5      nUb"  [         R                  " U[        U5      5      u  p[        U5      nUS:X  a  [        X40 UD6$ US:X  a  [	        X40 UD6$ [
        R                  " XU40 UD6$ ©Nr&   r
  )r   r-   r0   ÚRay2DÚRay3Dr)   r1   ©r3   r4   r5   r6   r�   s        r7   r1   ÚRay.__new__t  sw   € Ü�2‹YˆØ‰>Ü×/Ò/°´E¸"³IÓ>‰FˆBÜ�"‹gˆà�!‹8Ü˜Ñ* 6Ñ*Ð*Ø�A‹XÜ˜Ñ* 6Ñ*Ð*Ü×#Ò# C¨RÑ:°6Ñ:Ð:r9   c                 óD  • [        U R                  5      [        U R                  5      4nU Vs/ s H)  nSR                  UR                  UR
                  5      PM+     nnSR                  US   SR                  USS 5      5      nSR                  SU-  Xb5      $ s  snf )	úïReturns SVG path element for the LinearEntity.

Parameters
==========

scale_factor : float
    Multiplication factor for the SVG stroke-width.  Default is 1.
fill_color : str, optional
    Hex string for fill color. Default is "#66cc99".
ú{},{}ú	M {} L {}r   ú L r   Nz¡<path fill-rule="evenodd" fill="{2}" stroke="#555555" stroke-width="{0}" opacity="0.6" d="{1}" marker-start="url(#markerCircle)" marker-end="url(#markerArrow)"/>ç       @©r   r4   r5   rŸ   r  r  Újoin©r=   Úscale_factorÚ
fill_colorÚvertsr•   ÚcoordsÚpaths          r7   Ú_svgÚRay._svg€  sŒ   € ô �4—7‘7“œQ˜tŸw™w›ZÐ(ˆÙ49Ó:²E¨q�'—.‘. §¡ a§c¡cÖ*±EˆÐ:Ø×!Ñ! &¨¡)¨U¯Z©Z¸¸q¸r¸
Ó-CÓDˆðQ÷ ‰&��L‘ $Ó
3ð		4ùò ;ó   ¯0Bc                 ó\  • [        U[        5      (       d  [        XR                  S9n[        U[        5      (       a€  [        R                  " U R
                  U R                  U5      (       aN  [        U R                  U R
                  -
  R                  XR
                  -
  5      [        R                  :¬  5      $ g[        U[        5      (       a   [        R                  " U R
                  U R                  UR
                  UR                  5      (       aY  [        U R                  U R
                  -
  R                  UR                  UR
                  -
  5      [        R                  :„  5      $ g[        U[        5      (       a%  UR
                  U ;   =(       a    UR                  U ;   $ g)aÑ  
Is other GeometryEntity contained in this Ray?

Examples
========

>>> from sympy import Ray,Point,Segment
>>> p1, p2 = Point(0, 0), Point(4, 4)
>>> r = Ray(p1, p2)
>>> r.contains(p1)
True
>>> r.contains((1, 1))
True
>>> r.contains((1, 3))
False
>>> s = Segment((1, 1), (2, 2))
>>> r.contains(s)
True
>>> s = Segment((1, 2), (2, 5))
>>> r.contains(s)
False
>>> r1 = Ray((2, 2), (3, 3))
>>> r.contains(r1)
True
>>> r1 = Ray((2, 2), (3, 5))
>>> r.contains(r1)
False
rŽ   F)rP   r   r   rL   r  r4   r5   ÚboolrE   r
   r±   r“   r|   ru   s     r7   r<   ÚRay.contains•  s!  € ô: ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEÜ�eœU×#Ñ#Ü×!Ò! $§'¡'¨4¯7©7°E×:Ñ:ô ˜TŸW™W t§w¡wÑ.×3Ñ3°E¿G¹G±OÓDÌÏÉÑNÓOÐOØÜ˜œs×#Ñ#Ü×!Ò! $§'¡'¨4¯7©7°E·H±H¸e¿h¹h×GÑGÜ˜TŸW™W t§w¡wÑ.×3Ñ3°E·H±H¸u¿x¹xÑ4GÓHÌ1Ï6É6ÑQÓRÐRØÜ˜œw×'Ñ'Ø—8‘8˜tÑ#×8¨¯©°DÑ(8Ð8ð r9   c                 óp  • [        U[        5      (       d  [        XR                  S9nU R	                  U5      (       a  [
        R                  $ [        U R                  U R                  5      R                  U5      nU R	                  U5      (       a  [        X-
  5      $ [        XR                  -
  5      $ )a  
Finds the shortest distance between the ray and a point.

Raises
======

NotImplementedError is raised if `other` is not a Point

Examples
========

>>> from sympy import Point, Ray
>>> p1, p2 = Point(0, 0), Point(1, 1)
>>> s = Ray(p1, p2)
>>> s.distance(Point(-1, -1))
sqrt(2)
>>> s.distance((-1, 2))
3*sqrt(2)/2
>>> p1, p2 = Point(0, 0, 0), Point(1, 1, 2)
>>> s = Ray(p1, p2)
>>> s
Ray3D(Point3D(0, 0, 0), Point3D(1, 1, 2))
>>> s.distance(Point(-1, -1, 2))
4*sqrt(3)/3
>>> s.distance((-1, -1, 2))
4*sqrt(3)/3

rŽ   )rP   r   r   rL   r<   r
   r±   r’   r4   r5   rÉ   rR   Úsource)r=   r>   Úprojs      r7   r  ÚRay.distanceÅ  s†   € ô: ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEØ�=‰=˜×ÑÜ—6‘6ˆMä�D—G‘G˜TŸW™WÓ%×0Ñ0°Ó7ˆØ�=‰=˜×ÑÜ�u‘|Ó$Ð$ä�uŸ{™{Ñ*Ó+Ð+r9   c                 óŒ   • [        U[        5      (       d  gU R                  UR                  :H  =(       a    UR                  U ;   $ r  )rP   r“   r?  r5   ru   s     r7   r²   Ú
Ray.equalsí  s3   € ä˜%¤×%Ñ%ØØ�{‰{˜eŸl™lÑ*×?¨u¯x©x¸4Ñ/?Ð?r9   c                 ó    • [        USS9nUSS/$ )aÔ  The plot interval for the default geometric plot of the Ray. Gives
values that will produce a ray that is 10 units long (where a unit is
the distance between the two points that define the ray).

Parameters
==========

parameter : str, optional
    Default value is 't'.

Returns
=======

plot_interval : list
    [parameter, lower_bound, upper_bound]

Examples
========

>>> from sympy import Ray, pi
>>> r = Ray((0, 0), angle=pi/4)
>>> r.plot_interval()
[t, 0, 10]

Tr^   r   é
   r   rh   s      r7   r!  ÚRay.plot_intervaló  s   € ô4 �I DÑ)ˆØ�1�bˆzÐr9   c                 ó   • U R                   $ )aC  The point from which the ray emanates.

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Point, Ray
>>> p1, p2 = Point(0, 0), Point(4, 1)
>>> r1 = Ray(p1, p2)
>>> r1.source
Point2D(0, 0)
>>> p1, p2 = Point(0, 0, 0), Point(4, 1, 5)
>>> r1 = Ray(p2, p1)
>>> r1.source
Point3D(4, 1, 5)

)r4   rK   s    r7   r?  Ú
Ray.source  s   € ð. �w‰wˆr9   rõ   ra   ©g      ð?z#66cc99rö   )r/   r÷   rø   rù   rú   r1   r8  r<   r  r²   r!  rû   r?  rý   rõ   r9   r7   r“   r“   ?  s=   † ñ3ôh
;ô4ò*.ò`&,òP@ôð: ñó ór9   r“   c                   ód   • \ rS rSrSrS rS rS rS r\	S 5       r
\	S 5       rSS
 jrSS jrSrg	)r|   i*  a  A line segment in space.

Parameters
==========

p1 : Point
p2 : Point

Attributes
==========

length : number or SymPy expression
midpoint : Point

See Also
========

sympy.geometry.line.Segment2D
sympy.geometry.line.Segment3D
sympy.geometry.point.Point
sympy.geometry.line.Line

Notes
=====

If 2D or 3D points are used to define `Segment`, it will
be automatically subclassed to `Segment2D` or `Segment3D`.

Examples
========

>>> from sympy import Point, Segment
>>> Segment((1, 0), (1, 1)) # tuples are interpreted as pts
Segment2D(Point2D(1, 0), Point2D(1, 1))
>>> s = Segment(Point(4, 3), Point(1, 1))
>>> s.points
(Point2D(4, 3), Point2D(1, 1))
>>> s.slope
2/3
>>> s.length
sqrt(13)
>>> s.midpoint
Point2D(5/2, 2)
>>> Segment((1, 0, 0), (1, 1, 1)) # tuples are interpreted as pts
Segment3D(Point3D(1, 0, 0), Point3D(1, 1, 1))
>>> s = Segment(Point(4, 3, 9), Point(1, 1, 7)); s
Segment3D(Point3D(4, 3, 9), Point3D(1, 1, 7))
>>> s.points
(Point3D(4, 3, 9), Point3D(1, 1, 7))
>>> s.length
sqrt(17)
>>> s.midpoint
Point3D(5/2, 2, 8)

c                 óæ   • [         R                  " [        U5      [        U5      5      u  p[        U5      nUS:X  a  [        X40 UD6$ US:X  a  [	        X40 UD6$ [
        R                  " XU40 UD6$ r%  )r   r-   r0   Ú	Segment2DÚ	Segment3Dr)   r1   r(  s        r7   r1   ÚSegment.__new__b  sm   € Ü×+Ò+¬E°"«I´u¸R³yÓA‰ˆÜ�"‹gˆà�!‹8Ü˜RÑ. vÑ.Ð.Ø�A‹XÜ˜RÑ. vÑ.Ð.Ü×#Ò# C¨RÑ:°6Ñ:Ð:r9   c           
      óP  • [        U[        5      (       d  [        XR                  S9n[        U[        5      (       Ga†  [        R                  " XR
                  U R                  5      (       GaU  [        U [        5      (       aÌ  SU R                  -  R                  S5      nUSL aR  U R
                  R                  UR                  -
  U R                  R                  UR                  -
  -  S:*  nUS;   a  U$ USL aR  U R
                  R                  UR                  -
  U R                  R                  UR                  -
  -  S:*  nUS;   a  U$ XR
                  -
  XR                  -
  pTU R                  U R
                  -
  n [        [        [        [        U5      [        U5      -   [        U5      -
  S5      5      5      $ [        U[&        5      (       a%  UR
                  U ;   =(       a    UR                  U ;   $ g! [          a    [#        SR%                  X5      5      ef = f)a«  
Is the other GeometryEntity contained within this Segment?

Examples
========

>>> from sympy import Point, Segment
>>> p1, p2 = Point(0, 1), Point(3, 4)
>>> s = Segment(p1, p2)
>>> s2 = Segment(p2, p1)
>>> s.contains(s2)
True
>>> from sympy import Point3D, Segment3D
>>> p1, p2 = Point3D(0, 1, 1), Point3D(3, 4, 5)
>>> s = Segment3D(p1, p2)
>>> s2 = Segment3D(p2, p1)
>>> s.contains(s2)
True
>>> s.contains((p1 + p2)/2)
True
rŽ   r   r   F)TFTzCannot determine if {} is in {})rP   r   r   rL   r  r4   r5   rL  r  r²   r  r  r<  r!   r	   rR   rQ   r$   rŸ   r|   )r=   r>   ÚvertÚisinrï   rð   rG   s          r7   r<   ÚSegment.containsl  s­  € ô, ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEÜ�eœU×#Ò#Ü×!Ò! %¯©°$·'±'×:Ò:Ü˜d¤I×.Ñ.ð ˜dŸj™j™L×0Ñ0°Ó3�DØ˜u’}Ø $§¡§	¡	¨E¯G©GÑ 3°d·g±g·i±iÀ%Ç'Á'Ñ6IÑJÈaÑO˜Ø =Ó0Ø#'˜KØ˜t’|Ø $§¡§	¡	¨E¯G©GÑ 3°d·g±g·i±iÀ%Ç'Á'Ñ6IÑJÈaÑO˜Ø =Ó0Ø#'˜Kà§¡™¨%·'±'©/�BØ—G‘G˜dŸg™gÑ%�ð]ô  ¤¬¬C°«G´c¸"³gÑ,=ÄÀAÃÑ,FÈÓ)JÓ KÓLÐLô �eœW×%Ñ%Ø—8‘8˜tÑ#×8¨¯©°DÑ(8Ð8àøô !ó ]Ü%Ð&G×&NÑ&NÈuÓ&[Ó\Ð\ð]ús   Æ>H  È %H%c                 ó´   • [        XR                  5      =(       a=    [        [        U R                  5      5      [        [        UR                  5      5      :H  $ )r  )rP   rÚ   Úlistr   r¾   ru   s     r7   r²   ÚSegment.equals£  sA   € ä˜%§¡Ó+÷ =´Ü�D—I‘IÓó1 Ü#'¬°·
±
Ó(;Ó#<ñ1=ð 	=r9   c                 ó  • [        U[        5      (       d  [        XR                  S9n[        U[        5      (       aÇ  XR                  -
  nXR
                  -
  nU R                  R                  U5      S:¬  nU R                  R                  U5      S:*  nU(       a6  U(       a/  [        U R                  U R
                  5      R                  U5      $ U(       a  U(       d  [        U5      $ U(       d  U(       a  [        U5      $ [        5       e)a  
Finds the shortest distance between a line segment and a point.

Raises
======

NotImplementedError is raised if `other` is not a Point

Examples
========

>>> from sympy import Point, Segment
>>> p1, p2 = Point(0, 1), Point(3, 4)
>>> s = Segment(p1, p2)
>>> s.distance(Point(10, 15))
sqrt(170)
>>> s.distance((0, 12))
sqrt(73)
>>> from sympy import Point3D, Segment3D
>>> p1, p2 = Point3D(0, 0, 3), Point3D(1, 1, 4)
>>> s = Segment3D(p1, p2)
>>> s.distance(Point3D(10, 15, 12))
sqrt(341)
>>> s.distance((10, 15, 12))
sqrt(341)
rŽ   r   )rP   r   r   rL   r4   r5   rD   rE   r’   r  rR   rt   )r=   r>   Úvp1Úvp2Údot_prod_sign_1Údot_prod_sign_2s         r7   r  ÚSegment.distance¨  sÀ   € ô6 ˜%¤×0Ñ0Ü˜%×%;Ñ%;Ñ<ˆEÜ�eœU×#Ñ#ØŸ'™'‘/ˆCØŸ'™'‘/ˆCà"Ÿn™n×0Ñ0°Ó5¸Ñ:ˆOØ"Ÿn™n×0Ñ0°Ó5¸Ñ:ˆOÞ¦?Ü˜DŸG™G T§W¡WÓ-×6Ñ6°uÓ=Ð=Þ¦Ü˜3“x�Þ"¦Ü˜3“x�Ü!Ó#Ð#r9   c                 óX   • [         R                  " U R                  U R                  5      $ )al  The length of the line segment.

See Also
========

sympy.geometry.point.Point.distance

Examples
========

>>> from sympy import Point, Segment
>>> p1, p2 = Point(0, 0), Point(4, 3)
>>> s1 = Segment(p1, p2)
>>> s1.length
5
>>> from sympy import Point3D, Segment3D
>>> p1, p2 = Point3D(0, 0, 0), Point3D(4, 3, 3)
>>> s1 = Segment3D(p1, p2)
>>> s1.length
sqrt(34)

)r   r  r4   r5   rK   s    r7   rº   ÚSegment.lengthÓ  ó   € ô0 �~Š~˜dŸg™g t§w¡wÓ/Ð/r9   c                 óX   • [         R                  " U R                  U R                  5      $ )aŒ  The midpoint of the line segment.

See Also
========

sympy.geometry.point.Point.midpoint

Examples
========

>>> from sympy import Point, Segment
>>> p1, p2 = Point(0, 0), Point(4, 3)
>>> s1 = Segment(p1, p2)
>>> s1.midpoint
Point2D(2, 3/2)
>>> from sympy import Point3D, Segment3D
>>> p1, p2 = Point3D(0, 0, 0), Point3D(4, 3, 3)
>>> s1 = Segment3D(p1, p2)
>>> s1.midpoint
Point3D(2, 3/2, 3/2)

)r   Úmidpointr4   r5   rK   s    r7   r`  ÚSegment.midpointí  r^  r9   Nc                 óœ   • U R                  U R                  5      nUb-  [        XR                  S9nX2;   a  [	        X0R                  5      $ U$ )a³  The perpendicular bisector of this segment.

If no point is specified or the point specified is not on the
bisector then the bisector is returned as a Line. Otherwise a
Segment is returned that joins the point specified and the
intersection of the bisector and the segment.

Parameters
==========

p : Point

Returns
=======

bisector : Line or Segment

See Also
========

LinearEntity.perpendicular_segment

Examples
========

>>> from sympy import Point, Segment
>>> p1, p2, p3 = Point(0, 0), Point(6, 6), Point(5, 1)
>>> s1 = Segment(p1, p2)
>>> s1.perpendicular_bisector()
Line2D(Point2D(3, 3), Point2D(-3, 9))

>>> s1.perpendicular_bisector(p3)
Segment2D(Point2D(5, 1), Point2D(3, 3))

rŽ   )rÊ   r`  r   rL   r|   rÍ   s       r7   Úperpendicular_bisectorÚSegment.perpendicular_bisector  sG   € ðH ×#Ñ# D§M¡MÓ2ˆØ‰=Ü�q×4Ñ4Ñ5ˆBØ‹wÜ˜r§=¡=Ó1Ð1Øˆr9   c                 ó    • [        USS9nUSS/$ )a²  The plot interval for the default geometric plot of the Segment gives
values that will produce the full segment in a plot.

Parameters
==========

parameter : str, optional
    Default value is 't'.

Returns
=======

plot_interval : list
    [parameter, lower_bound, upper_bound]

Examples
========

>>> from sympy import Point, Segment
>>> p1, p2 = Point(0, 0), Point(5, 3)
>>> s1 = Segment(p1, p2)
>>> s1.plot_interval()
[t, 0, 1]

Tr^   r   r   r   rh   s      r7   r!  ÚSegment.plot_interval2  s   € ô4 �I DÑ)ˆØ�1�aˆyÐr9   rõ   ra   rö   )r/   r÷   rø   rù   rú   r1   r<   r²   r  rû   rº   r`  rc  r!  rý   rõ   r9   r7   r|   r|   *  sQ   † ñ6òn;ò5òn=ò
)$ðV ñ0ó ð0ð2 ñ0ó ð0ô2)÷Vr9   r|   c                   ó>   • \ rS rSrSr\S 5       rS r\S 5       rSr	g)ÚLinearEntity2DiP  a   A base class for all linear entities (line, ray and segment)
in a 2-dimensional Euclidean space.

Attributes
==========

p1
p2
coefficients
slope
points

Notes
=====

This is an abstract class and is not meant to be instantiated.

See Also
========

sympy.geometry.entity.GeometryEntity

c                 óî   • U R                   nU Vs/ s H  o"R                  PM     nnU Vs/ s H  o"R                  PM     nn[        U5      [        U5      [	        U5      [	        U5      4$ s  snf s  snf )zgReturn a tuple (xmin, ymin, xmax, ymax) representing the bounding
rectangle for the geometric figure.

)rÑ   r  r  ÚminÚmax)r=   r5  r•   ÚxsÚyss        r7   ÚboundsÚLinearEntity2D.boundsh  s`   € ð —‘ˆÙ Ó!š5�a�cŒc™5ˆÐ!Ù Ó!š5�a�cŒc™5ˆÐ!Ü�B“œ˜R›¤# b£'¬3¨r«7Ð3Ð3ùò "ùÚ!s
   ‘A-¬A2c                 ól   • [        XR                  S9n[        XU R                  R                  -   5      $ )aC  Create a new Line perpendicular to this linear entity which passes
through the point `p`.

Parameters
==========

p : Point

Returns
=======

line : Line

See Also
========

sympy.geometry.line.LinearEntity.is_perpendicular, perpendicular_segment

Examples
========

>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 0), Point(2, 3), Point(-2, 2)
>>> L = Line(p1, p2)
>>> P = L.perpendicular_line(p3); P
Line2D(Point2D(-2, 2), Point2D(-5, 4))
>>> L.is_perpendicular(P)
True

In 2D, the first point of the perpendicular line is the
point through which was required to pass; the second
point is arbitrarily chosen. To get a line that explicitly
uses a point in the line, create a line from the perpendicular
segment from the line to the point:

>>> Line(L.perpendicular_segment(p3))
Line2D(Point2D(-2, 2), Point2D(4/13, 6/13))
rŽ   )r   rL   r’   rD   rÈ   rÄ   s     r7   rÊ   Ú!LinearEntity2D.perpendicular_lines  s1   € ôN �!×/Ñ/Ñ0ˆô �A˜4Ÿ>™>×>Ñ>Ñ>Ó?Ð?r9   c                 ó’   • U R                   U R                  -
  R                  u  pUS:X  a  [        R                  $ [        X!-  5      $ )aP  The slope of this linear entity, or infinity if vertical.

Returns
=======

slope : number or SymPy expression

See Also
========

coefficients

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(0, 0), Point(3, 5)
>>> l1 = Line(p1, p2)
>>> l1.slope
5/3

>>> p3 = Point(0, 4)
>>> l2 = Line(p1, p3)
>>> l2.slope
oo

r   )r4   r5   r¾   r
   r¹   r!   )r=   rï   rð   s      r7   r  ÚLinearEntity2D.slope   s;   € ð: —'‘'˜DŸG™GÑ#×)Ñ)‰ˆØ�‹7Ü—:‘:ÐÜ˜™‹Ðr9   rõ   N)
r/   r÷   rø   rù   rú   rû   rn  rÊ   r  rý   rõ   r9   r7   rh  rh  P  s6   † ñð. ñ4ó ð4ò+@ðZ ñó ór9   rh  c                   óF   • \ rS rSrSrS	S jrS
S jr\S 5       rSS jr	Sr
g)rë   iÃ  a»  An infinite line in space 2D.

A line is declared with two distinct points or a point and slope
as defined using keyword `slope`.

Parameters
==========

p1 : Point
pt : Point
slope : SymPy expression

See Also
========

sympy.geometry.point.Point

Examples
========

>>> from sympy import Line, Segment, Point
>>> L = Line(Point(2,3), Point(3,5))
>>> L
Line2D(Point2D(2, 3), Point2D(3, 5))
>>> L.points
(Point2D(2, 3), Point2D(3, 5))
>>> L.equation()
-2*x + y + 1
>>> L.coefficients
(-2, 1, 1)

Instantiate with keyword ``slope``:

>>> Line(Point(0, 0), slope=0)
Line2D(Point2D(0, 0), Point2D(1, 0))

Instantiate with another linear object

>>> s = Segment((0, 0), (0, 1))
>>> Line(s).equation()
x
Nc                 ó  • [        U[        5      (       a1  Ub  [        S5      e[        R                  " UR
                  SS06u  pO
[        USS9nUb  Uc   [        USS9nOZUbL  UcI  [        U5      nUR                  SL a  SnSnOSnUn[        UR                  U-   UR                  U-   SS	9nO[        S
5      e[        R                  " XU40 UD6$ ! [        [        [        4 a    [        [        S5      5      ef = f)Nz,When p1 is a LinearEntity, pt should be Noner�   r&   rŽ   z—
                    The 2nd argument was not a valid Point.
                    If it was a slope, enter it with keyword "slope".
                    Fr   r   )Úevaluatez,A 2nd Point or keyword "slope" must be used.)rP   r)   r.   r   r-   r¾   rt   rQ   r%   r   Ú	is_finiter  r  rh  r1   )r3   r4   rå   r  r6   r5   ÚdxÚdys           r7   r1   ÚLine2D.__new__î  s  € Ü�bœ,×'Ñ'Ø‰~Ü Ð!OÓPÐPÜ×/Ò/°·±Ð@¸aÑ@‰FˆB�ä�r˜qÑ!ˆBØ‰>˜e™mðÜ˜2 1Ñ%‘ð Ñ 2¡:Ü˜E“NˆEØ�‰ %Ò'à�Ø‘ð �Ø�ä�r—t‘t˜b‘y "§$¡$¨¡)°eÑ<‰BäÐKÓLÐLÜ×%Ò% c¨rÑ<°VÑ<Ð<øô' (¬´JÐ?ó Ü ¤ð -ó "ó ð ðús   Á
C Ã*C?c                 óD  • [        U R                  5      [        U R                  5      4nU Vs/ s H)  nSR                  UR                  UR
                  5      PM+     nnSR                  US   SR                  USS 5      5      nSR                  SU-  Xb5      $ s  snf )	r+  r,  r-  r   r.  r   Nz§<path fill-rule="evenodd" fill="{2}" stroke="#555555" stroke-width="{0}" opacity="0.6" d="{1}" marker-start="url(#markerReverseArrow)" marker-end="url(#markerArrow)"/>r/  r0  r2  s          r7   r8  ÚLine2D._svg  sŒ   € ô �4—7‘7“œQ˜tŸw™w›ZÐ(ˆÙ49Ó:²E¨q�'—.‘. §¡ a§c¡cÖ*±EˆÐ:Ø×!Ñ! &¨¡)¨U¯Z©Z¸¸q¸r¸
Ó-CÓDˆðW÷ ‰&��L‘ $Ó
3ð		4ùò ;r:  c                 óî  • U R                   u  pUR                  UR                  :X  a,  [        R                  [        R                  UR                  * 4$ UR
                  UR
                  :X  a,  [        R                  [        R                  UR
                  * 4$ [        U R                  R
                  U R                  R
                  -
  U R                  R                  U R                  R                  -
  U R                  R                  U R                  R
                  -  U R                  R
                  U R                  R                  -  -
  4 Vs/ s H  n[        U5      PM     sn5      $ s  snf )aj  The coefficients (`a`, `b`, `c`) for `ax + by + c = 0`.

See Also
========

sympy.geometry.line.Line2D.equation

Examples
========

>>> from sympy import Point, Line
>>> from sympy.abc import x, y
>>> p1, p2 = Point(0, 0), Point(5, 3)
>>> l = Line(p1, p2)
>>> l.coefficients
(-3, 5, 0)

>>> p3 = Point(x, y)
>>> l2 = Line(p1, p3)
>>> l2.coefficients
(-y, x, 0)

)
rÑ   r  r
   ÚOner±   r  Útupler4   r5   r!   )r=   r4   r5   Úis       r7   ÚcoefficientsÚLine2D.coefficients"  s  € ð2 —‘‰ˆØ�4‰4�2—4‘4‹<Ü—E‘Eœ1Ÿ6™6 B§D¡D 5Ð)Ð)Ø�T‰T�R—T‘T‹\Ü—F‘FœAŸE™E B§D¡D 5Ð)Ð)ÜØ—w‘w—y‘y 4§7¡7§9¡9Ñ,Ø—w‘w—y‘y 4§7¡7§9¡9Ñ,Ø—w‘w—y‘y §¡§¡Ñ*¨T¯W©W¯Y©Y°t·w±w·y±yÑ-@Ñ@ñBóCòBð '(”h˜q–kñBñCó Dð 	Dùò Cs   ÅE2c                 ó  • [        USS9n[        USS9nU R                  u  p4UR                  UR                  :X  a  XR                  -
  $ UR                  UR                  :X  a  X#R                  -
  $ U R                  u  pVnXQ-  Xb-  -   U-   $ )aÕ  The equation of the line: ax + by + c.

Parameters
==========

x : str, optional
    The name to use for the x-axis, default value is 'x'.
y : str, optional
    The name to use for the y-axis, default value is 'y'.

Returns
=======

equation : SymPy expression

See Also
========

sympy.geometry.line.Line2D.coefficients

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(1, 0), Point(5, 3)
>>> l1 = Line(p1, p2)
>>> l1.equation()
-3*x + 4*y + 3

Tr^   )r   rÑ   r  r  r�  )r=   r  r  r4   r5   rÜ   r  r  s           r7   r  ÚLine2D.equationE  s|   € ô> �A˜DÑ!ˆÜ�A˜DÑ!ˆØ—‘‰ˆØ�4‰4�2—4‘4‹<Ø—t‘t‘8ˆOØ�T‰T�R—T‘T‹\Ø—t‘t‘8ˆOà×#Ñ#‰ˆˆaØ‰s�Q‘S‰y˜1‰}Ðr9   rõ   ©NNrI  )r  r  )r/   r÷   rø   rù   rú   r1   r8  rû   r�  r  rý   rõ   r9   r7   rë   rë   Ã  s.   † ñ)ôT=ô>4ð* ñ Dó ð D÷D(r9   rë   c                   óH   • \ rS rSrSrS	S jr\S 5       r\S 5       rS r	Sr
g)
r&  ip  aà  
A Ray is a semi-line in the space with a source point and a direction.

Parameters
==========

p1 : Point
    The source of the Ray
p2 : Point or radian value
    This point determines the direction in which the Ray propagates.
    If given as an angle it is interpreted in radians with the positive
    direction being ccw.

Attributes
==========

source
xdirection
ydirection

See Also
========

sympy.geometry.point.Point, Line

Examples
========

>>> from sympy import Point, pi, Ray
>>> r = Ray(Point(2, 3), Point(3, 5))
>>> r
Ray2D(Point2D(2, 3), Point2D(3, 5))
>>> r.points
(Point2D(2, 3), Point2D(3, 5))
>>> r.source
Point2D(2, 3)
>>> r.xdirection
oo
>>> r.ydirection
oo
>>> r.slope
2
>>> Ray(Point(0, 0), angle=pi/4).slope
1

Nc                 óZ  • [        USS9nUb   Uc   [        USS9nX:X  a  [        S5      eGOºUGb«  UGc§  [        U5      n[        U5      nS nUbÇ  UR                  (       aŸ  UR                  S:X  a@  UR                  S:X  a  U[        SS5      -   nOoUR                  S:X  a  U[        SS5      -   nOOUR                  S:X  a?  UR                  S:X  a  U[        SS5      -   nOUR                  S:X  a  U[        SS5      -   nUc  U[        R                  -  nOUS[        R                  -  -  nU(       d§  SU-  [        R                  -  n[        SU:  US:  5      n[        SU4[        S[        US-  S5      4S	5      S
45      n	[        [        U5      * U4[        S[        US5      4S[        US5      4[        U5      S
45      S
45      n
U[        Xš5      -   nO[        S5      e[         R"                  " XU40 UD6$ ! [        [        [        4 a    [        [	        S5      5      ef = f)Nr&   rŽ   z¬
                    The 2nd argument was not a valid Point; if
                    it was meant to be an angle it should be
                    given with keyword "angle".z#A Ray requires two distinct points.r   r   r
  rC   )r   TTz,A 2nd point or keyword "angle" must be used.)r   rt   rQ   r.   r%   r   r   Úis_RationalÚqr•   r
   ÚPir   r   r	   r   rh  r1   )r3   r4   rå   Úangler6   r5   r  r¤   Úleftr  r  s              r7   r1   ÚRay2D.__new__Ÿ  s  € Ü�2˜1ÑˆØ‰>˜e™mð5Ü˜2 1Ñ%�ð ‹xÜ Ð!FÓGÐGñ àÒ 2¢:ä˜E“NˆEÜ˜%Ó ˆAØˆBØ‰}Ø—=—=Ø—s‘s˜a“xØŸ3™3 !›8Ø!#¤e¨A¨q£kÑ!1™BØŸS™S A›XØ!#¤e¨A¨r£lÑ!2˜BøØŸ™ ›ØŸ3™3 !›8Ø!#¤e¨A¨q£kÑ!1™BØŸS™S A›XØ!#¤e¨B°£lÑ!2˜BØ‘:ØœŸ™‘I�Aøà˜QœqŸt™t™VÑ$�ÞØ�a‘CœŸ™‘H�Ü˜1˜q™5 ! a¡%Ó(�Ü˜r 4˜j¬9°a¼¸AÀ¹EÀ1»Ð5FÈ	Ó+RÐTXÐ*YÓZ�Ü¤ A£˜w¨˜o´	¸1¼bÀÀA»h¸-È"ÌbÐQRÐTUËhÈÔZ]Ð^_ÓZ`ÐbfÐYgÓ0hÐjnÐ/oÓp�Øœ% ›+Ñ%�øäÐKÓLÐLä×%Ò% c¨rÑ<°VÑ<Ð<øôK (¬´JÐ?ó 5Ü ¤ð -3ó "4ó 5ð 5ð5ús   ’
H  È *H*c                 ó  • U R                   R                  U R                  R                  :  a  [        R                  $ U R                   R                  U R                  R                  :X  a  [        R
                  $ [        R                  $ )a˜  The x direction of the ray.

Positive infinity if the ray points in the positive x direction,
negative infinity if the ray points in the negative x direction,
or 0 if the ray is vertical.

See Also
========

ydirection

Examples
========

>>> from sympy import Point, Ray
>>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(0, -1)
>>> r1, r2 = Ray(p1, p2), Ray(p1, p3)
>>> r1.xdirection
oo
>>> r2.xdirection
0

©r4   r  r5   r
   r¹   r±   ÚNegativeInfinityrK   s    r7   Ú
xdirectionÚRay2D.xdirectionË  óS   € ð2 �7‰7�9‰9�t—w‘w—y‘yÓ Ü—:‘:ÐØ�W‰W�Y‰Y˜$Ÿ'™'Ÿ)™)Ó#Ü—6‘6ˆMä×%Ñ%Ð%r9   c                 ó  • U R                   R                  U R                  R                  :  a  [        R                  $ U R                   R                  U R                  R                  :X  a  [        R
                  $ [        R                  $ )a�  The y direction of the ray.

Positive infinity if the ray points in the positive y direction,
negative infinity if the ray points in the negative y direction,
or 0 if the ray is horizontal.

See Also
========

xdirection

Examples
========

>>> from sympy import Point, Ray
>>> p1, p2, p3 = Point(0, 0), Point(-1, -1), Point(-1, 0)
>>> r1, r2 = Ray(p1, p2), Ray(p1, p3)
>>> r1.ydirection
-oo
>>> r2.ydirection
0

©r4   r  r5   r
   r¹   r±   r�  rK   s    r7   Ú
ydirectionÚRay2D.ydirectionë  r“  r9   c                 ó�  • [        S X4 5       5      (       d  [        S5      e[        [        [	        U R
                  R                  5      5      6 n[        [        [	        UR
                  R                  5      5      6 nX#-  S:  a<  US:  a  S[        R                  -  U-   OUnUS:  a  S[        R                  -  U-   OUnX#-
  $ )aæ  Return the angle by which r2 must be rotated so it faces the same
direction as r1.

Parameters
==========

r1 : Ray2D
r2 : Ray2D

Returns
=======

angle : angle in radians (ccw angle is positive)

See Also
========

LinearEntity.angle_between

Examples
========

>>> from sympy import Ray, pi
>>> r1 = Ray((0, 0), (1, 0))
>>> r2 = r1.rotate(-pi/2)
>>> angle = r1.closing_angle(r2); angle
pi/2
>>> r2.rotate(angle).direction.unit == r1.direction.unit
True
>>> r2.closing_angle(r1)
-pi/2
c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fra   )rP   r&  )rc   Úrs     r7   re   Ú&Ray2D.closing_angle.<locals>.<genexpr>,	  s   é € Ð:²¨A”:˜a¤×'Ð'²ùs   ‚z%Both arguments must be Ray2D objects.r   r&   )	ÚallrQ   r   rT  ÚreversedrD   r¾   r
   rŠ  )Úr1Úr2Úa1Úa2s       r7   Úclosing_angleÚRay2D.closing_angle	  s¤   € ôB Ñ:°"±Ó:×:Ñ:ô ÐCÓDÐDä”Dœ "§,¡,×"3Ñ"3Ó4Ó5Ð6ˆÜ”Dœ "§,¡,×"3Ñ"3Ó4Ó5Ð6ˆØ‰5�1‹9Ø " Q£�”1—4‘4‘˜"’¨BˆBØ " Q£�”1—4‘4‘˜"’¨BˆBØ‰wˆr9   rõ   r…  )r/   r÷   rø   rù   rú   r1   rû   r‘  r–  r¢  rý   rõ   r9   r7   r&  r&  p  s;   † ñ-ô\*=ðX ñ&ó ð&ð> ñ&ó ð&õ>,r9   r&  c                   ó(   • \ rS rSrSrS rSS jrSrg)rL  i:	  a0  A line segment in 2D space.

Parameters
==========

p1 : Point
p2 : Point

Attributes
==========

length : number or SymPy expression
midpoint : Point

See Also
========

sympy.geometry.point.Point, Line

Examples
========

>>> from sympy import Point, Segment
>>> Segment((1, 0), (1, 1)) # tuples are interpreted as pts
Segment2D(Point2D(1, 0), Point2D(1, 1))
>>> s = Segment(Point(4, 3), Point(1, 1)); s
Segment2D(Point2D(4, 3), Point2D(1, 1))
>>> s.points
(Point2D(4, 3), Point2D(1, 1))
>>> s.slope
2/3
>>> s.length
sqrt(13)
>>> s.midpoint
Point2D(5/2, 2)

c                 óh   • [        USS9n[        USS9nX:X  a  U$ [        R                  " XU40 UD6$ )Nr&   rŽ   )r   rh  r1   r2   s       r7   r1   ÚSegment2D.__new__`	  ó<   € Ü�2˜1ÑˆÜ�2˜1Ñˆà‹8ØˆIä×%Ò% c¨rÑ<°VÑ<Ð<r9   c                 óD  • [        U R                  5      [        U R                  5      4nU Vs/ s H)  nSR                  UR                  UR
                  5      PM+     nnSR                  US   SR                  USS 5      5      nSR                  SU-  Xb5      $ s  snf )	r+  r,  r-  r   r.  r   Nza<path fill-rule="evenodd" fill="{2}" stroke="#555555" stroke-width="{0}" opacity="0.6" d="{1}" />r/  r0  r2  s          r7   r8  ÚSegment2D._svgi	  s‰   € ô �4—7‘7“œQ˜tŸw™w›ZÐ(ˆÙ49Ó:²E¨q�'—.‘. §¡ a§c¡cÖ*±EˆÐ:Ø×!Ñ! &¨¡)¨U¯Z©Z¸¸q¸r¸
Ó-CÓDˆð:ç
‰&��L‘ $Ó
3ð	4ùò ;r:  rõ   NrI  )r/   r÷   rø   rù   rú   r1   r8  rý   rõ   r9   r7   rL  rL  :	  s   † ñ$òJ=÷4r9   rL  c                   óB   • \ rS rSrSrS rSr\S 5       r\S 5       r	Sr
g)	ÚLinearEntity3Di}	  zðAn base class for all linear entities (line, ray and segment)
in a 3-dimensional Euclidean space.

Attributes
==========

p1
p2
direction_ratio
direction_cosine
points

Notes
=====

This is a base class and is not meant to be instantiated.
c                 ó”   • [        USS9n[        USS9nX:X  a  [        SU R                  -  5      e[        R                  " XU40 UD6$ )Nr
  rŽ   r,   )r   r.   r/   r   r1   r2   s       r7   r1   ÚLinearEntity3D.__new__�	  sT   € Ü�R˜QÑˆÜ�R˜QÑˆØ‹8äØ8¸3¿<¹<ÑGóIð Iô ×%Ò% c¨rÑ<°VÑ<Ð<r9   r
  c                 ó@   • U R                   u  pUR                  U5      $ )a  The direction ratio of a given line in 3D.

See Also
========

sympy.geometry.line.Line3D.equation

Examples
========

>>> from sympy import Point3D, Line3D
>>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1)
>>> l = Line3D(p1, p2)
>>> l.direction_ratio
[5, 3, 1]
)rÑ   Údirection_ratio©r=   r4   r5   s      r7   r¯  ÚLinearEntity3D.direction_ratio›	  s    € ð$ —‘‰ˆØ×!Ñ! "Ó%Ð%r9   c                 ó@   • U R                   u  pUR                  U5      $ )aJ  The normalized direction ratio of a given line in 3D.

See Also
========

sympy.geometry.line.Line3D.equation

Examples
========

>>> from sympy import Point3D, Line3D
>>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1)
>>> l = Line3D(p1, p2)
>>> l.direction_cosine
[sqrt(35)/7, 3*sqrt(35)/35, sqrt(35)/35]
>>> sum(i**2 for i in _)
1
)rÑ   Údirection_cosiner°  s      r7   r³  ÚLinearEntity3D.direction_cosine°	  s    € ð( —‘‰ˆØ×"Ñ" 2Ó&Ð&r9   rõ   N)r/   r÷   rø   rù   rú   r1   rL   rû   r¯  r³  rý   rõ   r9   r7   r«  r«  }	  s:   † ñò"=ð Ðàñ&ó ð&ð( ñ'ó ó'r9   r«  c                   ó@   ^ • \ rS rSrSrSS jrSS jrU 4S jrSrU =r	$ )	r  iÈ	  a  An infinite 3D line in space.

A line is declared with two distinct points or a point and direction_ratio
as defined using keyword `direction_ratio`.

Parameters
==========

p1 : Point3D
pt : Point3D
direction_ratio : list

See Also
========

sympy.geometry.point.Point3D
sympy.geometry.line.Line
sympy.geometry.line.Line2D

Examples
========

>>> from sympy import Line3D, Point3D
>>> L = Line3D(Point3D(2, 3, 4), Point3D(3, 5, 1))
>>> L
Line3D(Point3D(2, 3, 4), Point3D(3, 5, 1))
>>> L.points
(Point3D(2, 3, 4), Point3D(3, 5, 1))
rõ   c                 óš  • [        U[        5      (       a  Ub  [        S5      eUR                  u  pO
[	        USS9nUb  [        U5      S:X  a  [	        USS9nO[[        U5      S:X  aA  Uc>  [        UR                  US   -   UR                  US   -   UR                  US   -   5      nO[        S5      e[        R                  " XU40 UD6$ )Nz)if p1 is a LinearEntity, pt must be None.r
  rŽ   r   r   r&   z6A 2nd Point or keyword "direction_ratio" must be used.)rP   r«  r.   r¾   r   r0   r   r  r  Úzr1   ©r3   r4   rå   r¯  r6   s        r7   r1   ÚLine3D.__new__æ	  sÐ   € Ü�bœ.×)Ñ)Ø‰~Ü Ð!LÓMÐMØ—W‘W‰FˆB�ä�r˜qÑ!ˆBØ‰>œc /Ó2°aÓ7Ü�r˜qÑ!‰BÜ�Ó! QÓ&¨2©:Ü˜Ÿ™ °Ñ 2Ñ2°B·D±D¸?È1Ñ;MÑ4MØŸ™ °Ñ 2Ñ2ó4‰Bô ð (ó )ð )ô ×%Ò% c¨rÑ<°VÑ<Ð<r9   c           	      óô  • XUS4 Vs/ s H  n[        USS9PM     snu  pp5U R                  u  pgUR                  U5      u  p‰n
Uu  p¼nU* U-  U-   U-
  U	* U-  U-   U-
  U
* U-  U-   U-
  /n[        U5       H<  u  pOUR	                  U5      (       d  M  [        Xõ5      S   nUR                  U5          O   [        U Vs/ s H%  oDR                  UW5      R                  5       S   PM'     sn6 $ s  snf s  snf )a~  Return the equations that define the line in 3D.

Parameters
==========

x : str, optional
    The name to use for the x-axis, default value is 'x'.
y : str, optional
    The name to use for the y-axis, default value is 'y'.
z : str, optional
    The name to use for the z-axis, default value is 'z'.

Returns
=======

equation : Tuple of simultaneous equations

Examples
========

>>> from sympy import Point3D, Line3D, solve
>>> from sympy.abc import x, y, z
>>> p1, p2 = Point3D(1, 0, 0), Point3D(5, 3, 0)
>>> l1 = Line3D(p1, p2)
>>> eq = l1.equation(x, y, z); eq
(-3*x + 4*y + 3, z)
>>> solve(eq.subs(z, 0), (x, y, z))
{x: 4*y/3 + 1}
ÚkTr^   r   )
r   rÑ   r¯  Ú	enumerateÚhasr"   r  r   râ   Úas_numer_denom)r=   r  r  r·  r€  r»  r4   r5   rï   rð   Úd3Úx1Úy1Úz1ÚeqsÚeÚkks                    r7   r  ÚLine3D.equationø	  sý   € ð< 78¸A¸s±^ÓD²^°”g˜a dÔ+±^ÑD‰
ˆˆaØ—‘‰ˆØ×'Ñ'¨Ó+‰
ˆ�Ø‰
ˆ�Øˆs�1‰u�q‰y˜2‰~ ˜s 1™u q™y¨2™~°¨s°1©u°q©y¸2©~Ð>ˆä˜c–N‰DˆAØ�u‰u�Q�x‹xÜ˜1“[ ‘^�Ø—‘˜”
Ùñ	 #ô
 Á#ÓFÂ#¸Q—v‘v˜a “}×3Ñ3Ó5°aÔ8Á#ÑFÐGÐGùò Eùò Gs   ˆC0Ã ,C5c                 óÂ  >• SSK Jn  [        U[        [        45      (       a   [        U5      n[        U[
        5      (       a  [        TU ]!  U5      $ [        U[        5      (       a«  X:X  a  [        R                  $ U R                  U5      (       a  [        TU ]!  UR                  5      $ [        U R                  5      n[        UR                  5      nUR!                  U5      nU" U R                  US9nUR                  R                  U5      $ [        X5      (       a  UR                  U 5      $ U S[#        U5       S3n[%        U5      e! [         a     GN.f = f)a  
Finds the shortest distance between a line and another object.

Parameters
==========

Point3D, Line3D, Plane, tuple, list

Returns
=======

distance

Notes
=====

This method accepts only 3D entities as it's parameter

Tuples and lists are converted to Point3D and therefore must be of
length 3, 2 or 1.

NotImplementedError is raised if `other` is not an instance of one
of the specified classes: Point3D, Line3D, or Plane.

Examples
========

>>> from sympy.geometry import Line3D
>>> l1 = Line3D((0, 0, 0), (0, 0, 1))
>>> l2 = Line3D((0, 1, 0), (1, 1, 1))
>>> l1.distance(l2)
1

The computed distance may be symbolic, too:

>>> from sympy.abc import x, y
>>> l1 = Line3D((0, 0, 0), (0, 0, 1))
>>> l2 = Line3D((0, x, 0), (y, x, 1))
>>> l1.distance(l2)
Abs(x*y)/Abs(sqrt(y**2))

r   )ÚPlane)r4   Únormal_vectorz
 has type z, which is unsupported)ÚplanerÈ  rP   r  rT  r   r.   Úsuperr  r  r
   r±   r®   r4   r   r¯  ÚcrossÚtypert   )	r=   r>   rÈ  Úself_directionÚother_directionÚnormalÚplane_through_selfÚmsgrØ   s	           €r7   r  ÚLine3D.distance#
  s0  ø€ õX 	!ä�eœe¤T˜]×+Ñ+ðÜ ›�ô �eœW×%Ñ%Ü‘7Ñ# EÓ*Ð*ä�eœV×$Ñ$Ø‹}Ü—v‘v�Ø×Ñ ×&Ñ&Ü‘wÑ'¨¯©Ó1Ð1ô $ D×$8Ñ$8Ó9ˆNÜ$ U×%:Ñ%:Ó;ˆOØ#×)Ñ)¨/Ó:ˆFÙ!&¨$¯'©'ÀÑ!HÐØ—8‘8×$Ñ$Ð%7Ó8Ð8ä�e×#Ñ#Ø—>‘> $Ó'Ð'à��z¤$ u£+ Ð.DÐEˆÜ! #Ó&Ð&øô/ ó Úðús   ¤E Å
EÅE©Nrõ   )r  r  r·  )
r/   r÷   rø   rù   rú   r1   r  r  rý   Ú__classcell__)rØ   s   @r7   r  r  È	  s    ø† ñô:=ô$)H÷VH'ó H'r9   r  c                   óR   • \ rS rSrSrS	S jr\S 5       r\S 5       r\S 5       r	Sr
g)
r'  in
  aŸ  
A Ray is a semi-line in the space with a source point and a direction.

Parameters
==========

p1 : Point3D
    The source of the Ray
p2 : Point or a direction vector
direction_ratio: Determines the direction in which the Ray propagates.


Attributes
==========

source
xdirection
ydirection
zdirection

See Also
========

sympy.geometry.point.Point3D, Line3D


Examples
========

>>> from sympy import Point3D, Ray3D
>>> r = Ray3D(Point3D(2, 3, 4), Point3D(3, 5, 0))
>>> r
Ray3D(Point3D(2, 3, 4), Point3D(3, 5, 0))
>>> r.points
(Point3D(2, 3, 4), Point3D(3, 5, 0))
>>> r.source
Point3D(2, 3, 4)
>>> r.xdirection
oo
>>> r.ydirection
oo
>>> r.direction_ratio
[1, 2, -4]

Nrõ   c                 ó¬  • [        U[        5      (       a  Ub  [        S5      eUR                  u  pO
[	        USS9nUb  [        U5      S:X  a  [	        USS9nOd[        U5      S:X  aA  Uc>  [        UR                  US   -   UR                  US   -   UR                  US   -   5      nO[        [        S5      5      e[        R                  " XU40 UD6$ )Nz(If p1 is a LinearEntity, pt must be Noner
  rŽ   r   r   r&   zT
                A 2nd Point or keyword "direction_ratio" must be used.
            )rP   r«  r.   r¾   r   r0   r   r  r  r·  r%   r1   r¸  s        r7   r1   ÚRay3D.__new__œ
  s×   € Ü�bœ.×)Ñ)Ø‰~Ü Ð!KÓLÐLØ—W‘W‰FˆB�ä�r˜qÑ!ˆBØ‰>œc /Ó2°aÓ7Ü�r˜qÑ!‰BÜ�Ó! QÓ&¨2©:Ü˜Ÿ™ °Ñ 2Ñ2°B·D±D¸?È1Ñ;MÑ4MØŸ™ °Ñ 2Ñ2ó4‰Bô œZð )ó ó ð ô ×%Ò% c¨rÑ<°VÑ<Ð<r9   c                 ó  • U R                   R                  U R                  R                  :  a  [        R                  $ U R                   R                  U R                  R                  :X  a  [        R
                  $ [        R                  $ )a¯  The x direction of the ray.

Positive infinity if the ray points in the positive x direction,
negative infinity if the ray points in the negative x direction,
or 0 if the ray is vertical.

See Also
========

ydirection

Examples
========

>>> from sympy import Point3D, Ray3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(0, -1, 0)
>>> r1, r2 = Ray3D(p1, p2), Ray3D(p1, p3)
>>> r1.xdirection
oo
>>> r2.xdirection
0

r�  rK   s    r7   r‘  ÚRay3D.xdirection¯
  r“  r9   c                 ó  • U R                   R                  U R                  R                  :  a  [        R                  $ U R                   R                  U R                  R                  :X  a  [        R
                  $ [        R                  $ )aµ  The y direction of the ray.

Positive infinity if the ray points in the positive y direction,
negative infinity if the ray points in the negative y direction,
or 0 if the ray is horizontal.

See Also
========

xdirection

Examples
========

>>> from sympy import Point3D, Ray3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(-1, -1, -1), Point3D(-1, 0, 0)
>>> r1, r2 = Ray3D(p1, p2), Ray3D(p1, p3)
>>> r1.ydirection
-oo
>>> r2.ydirection
0

r•  rK   s    r7   r–  ÚRay3D.ydirectionÏ
  r“  r9   c                 ó  • U R                   R                  U R                  R                  :  a  [        R                  $ U R                   R                  U R                  R                  :X  a  [        R
                  $ [        R                  $ )aÉ  The z direction of the ray.

Positive infinity if the ray points in the positive z direction,
negative infinity if the ray points in the negative z direction,
or 0 if the ray is horizontal.

See Also
========

xdirection

Examples
========

>>> from sympy import Point3D, Ray3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(-1, -1, -1), Point3D(-1, 0, 0)
>>> r1, r2 = Ray3D(p1, p2), Ray3D(p1, p3)
>>> r1.ydirection
-oo
>>> r2.ydirection
0
>>> r2.zdirection
0

)r4   r·  r5   r
   r¹   r±   r�  rK   s    r7   Ú
zdirectionÚRay3D.zdirectionï
  sS   € ð6 �7‰7�9‰9�t—w‘w—y‘yÓ Ü—:‘:ÐØ�W‰W�Y‰Y˜$Ÿ'™'Ÿ)™)Ó#Ü—6‘6ˆMä×%Ñ%Ð%r9   rÔ  )r/   r÷   rø   rù   rú   r1   rû   r‘  r–  rÞ  rý   rõ   r9   r7   r'  r'  n
  sI   † ñ,ôZ=ð& ñ&ó ð&ð> ñ&ó ð&ð> ñ&ó ó&r9   r'  c                   ó   • \ rS rSrSrS rSrg)rM  i  aY  A line segment in a 3D space.

Parameters
==========

p1 : Point3D
p2 : Point3D

Attributes
==========

length : number or SymPy expression
midpoint : Point3D

See Also
========

sympy.geometry.point.Point3D, Line3D

Examples
========

>>> from sympy import Point3D, Segment3D
>>> Segment3D((1, 0, 0), (1, 1, 1)) # tuples are interpreted as pts
Segment3D(Point3D(1, 0, 0), Point3D(1, 1, 1))
>>> s = Segment3D(Point3D(4, 3, 9), Point3D(1, 1, 7)); s
Segment3D(Point3D(4, 3, 9), Point3D(1, 1, 7))
>>> s.points
(Point3D(4, 3, 9), Point3D(1, 1, 7))
>>> s.length
sqrt(17)
>>> s.midpoint
Point3D(5/2, 2, 8)

c                 óh   • [        USS9n[        USS9nX:X  a  U$ [        R                  " XU40 UD6$ )Nr
  rŽ   )r   r«  r1   r2   s       r7   r1   ÚSegment3D.__new__6  r§  r9   rõ   N)r/   r÷   rø   rù   rú   r1   rý   rõ   r9   r7   rM  rM    s   † ñ"õF=r9   rM  )Hrú   Úsympy.core.containersr   Úsympy.core.evalfr   Úsympy.core.exprr   Úsympy.core.numbersr   r   r   Úsympy.core.relationalr	   Úsympy.core.singletonr
   Úsympy.core.sortingr   Úsympy.core.symbolr   r   r   Úsympy.core.sympifyr   Ú$sympy.functions.elementary.piecewiser   Ú(sympy.functions.elementary.trigonometricr   r   r   r   Úentityr   r   Ú
exceptionsr   rî   r   r   Úutilr   r   Úsympy.logic.boolalgr   Úsympy.matricesr   Úsympy.sets.setsr   Úsympy.simplify.simplifyr!   Úsympy.solvers.solversr"   Úsympy.solvers.solvesetr#   Úsympy.utilities.miscr$   r%   rß   Úrangerj   r¡   r)   r’   r“   r|   rh  rë   r&  rL  r«  r  r'  rM  )r€  s   0r7   Ú<module>rù     sC  ðñõ& (Ý Ý  ß 2Ñ 2Ý $Ý "Ý &ß CÑ CÝ &Ý :ß RÓ Rß /Ý %ß !ß $Ý #Ý !Ý (Ý ,Ý 'Ý 0ß 8ó ñ &+¨1¤XÓ.¢X ‰ˆlÖ¡XÑ.�€€1ô`�;ô `ôF!gˆ<ô gôThˆ,ô hôVcˆlô côL	p�\ô pôfjˆ^˜Tô jôZGˆN˜Cô GôT@4� ô @4ôFH'�\ô H'ôVc'ˆ^˜Tô c'ôLa&ˆN˜Cô a&ôH+=� õ +=ùòGW /s   Â+E