
    \h5                     .   S r SSK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  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JrJr  SSKJr  SSKJr  SSKJrJ r   SSK!J"r"J#r#J$r$  SSK%J&r&  SSK'J(r(   " S S\&5      r) " S S\)5      r* " S S\)5      r+g)aD  Geometrical Points.

Contains
========
Point
Point2D
Point3D

When methods of Point require 1 or more points as arguments, they
can be passed as a sequence of coordinates or Points:

>>> from sympy import Point
>>> Point(1, 1).is_collinear((2, 2), (3, 4))
False
>>> Point(1, 1).is_collinear(Point(2, 2), Point(3, 4))
False

    N)SsympifyExpr)Add)Tuple)Float)global_parameters)	nsimplifysimplify)GeometryError)sqrt)im)cossin)Matrix)	Transpose)uniqis_sequence)
filldedent	func_nameUndecidable   )GeometryEntity)prec_to_dpsc                   f   \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS r\S 5       r\S 5       r\S 5       r\S 5       rS rS rS rS*S jrS rS r S r!\S 5       r"S r#\S 5       r$\S  5       r%S! r&\S" 5       r'\S# 5       r(\S$ 5       r)S% r*S& r+\S' 5       r,S(r-g))+Point*   a  A point in a n-dimensional Euclidean space.

Parameters
==========

coords : sequence of n-coordinate values. In the special
    case where n=2 or 3, a Point2D or Point3D will be created
    as appropriate.
evaluate : if `True` (default), all floats are turn into
    exact types.
dim : number of coordinates the point should have.  If coordinates
    are unspecified, they are padded with zeros.
on_morph : indicates what should happen when the number of
    coordinates of a point need to be changed by adding or
    removing zeros.  Possible values are `'warn'`, `'error'`, or
    `ignore` (default).  No warning or error is given when `*args`
    is empty and `dim` is given. An error is always raised when
    trying to remove nonzero coordinates.


Attributes
==========

length
origin: A `Point` representing the origin of the
    appropriately-dimensioned space.

Raises
======

TypeError : When instantiating with anything but a Point or sequence
ValueError : when instantiating with a sequence with length < 2 or
    when trying to reduce dimensions if keyword `on_morph='error'` is
    set.

See Also
========

sympy.geometry.line.Segment : Connects two Points

Examples
========

>>> from sympy import Point
>>> from sympy.abc import x
>>> Point(1, 2, 3)
Point3D(1, 2, 3)
>>> Point([1, 2])
Point2D(1, 2)
>>> Point(0, x)
Point2D(0, x)
>>> Point(dim=4)
Point(0, 0, 0, 0)

Floats are automatically converted to Rational unless the
evaluate flag is False:

>>> Point(0.5, 0.25)
Point2D(1/2, 1/4)
>>> Point(0.5, 0.25, evaluate=False)
Point2D(0.5, 0.25)

Tc                    UR                  S[        R                  5      nUR                  SS5      n[        U5      S:X  a  US   OUn[	        U[
        5      (       a,  Sn[        U5      UR                  S[        U5      5      :X  a  U$ [        U5      (       d,  [        [        SR                  [        U5      5      5      5      e[        U5      S:X  a:  UR                  SS 5      (       a#  [        R                  4UR                  S5      -  n[        U6 nUR                  S[        U5      5      n[        U5      S	:  a  [        [        S
5      5      e[        U5      U:w  ad  SR                  U[        U5      U5      nUS:X  a  OAUS:X  a  [        U5      eUS:X  a  [        R                   " US	S9  O[        [        S5      5      e[#        XVS  5      (       a  [        S5      e[#        S U 5       5      (       a  [        S5      e[%        S U 5       5      (       d  [        S5      eUS U [        R                  4U[        U5      -
  -  -   nU(       aG  UR'                  UR)                  [*        5       Vs0 s H  nU[-        [/        USS95      _M     sn5      n[        U5      S	:X  a  SUS'   [1        U0 UD6$ [        U5      S:X  a  SUS'   [3        U0 UD6$ [4        R6                  " U /UQ76 $ s  snf )Nevaluateon_morphignorer   r   Fdimz<
                Expecting sequence of coordinates, not `{}`   z[
                Point requires 2 or more coordinates or
                keyword `dim` > 1.z2Dimension of {} needs to be changed from {} to {}.errorwarn)
stacklevelzf
                        on_morph value should be 'error',
                        'warn' or 'ignore'.z&Nonzero coordinates cannot be removed.c              3   t   #    U  H.  oR                   =(       a    [        U5      R                  S L v   M0     g7f)FN)	is_numberr   is_zero.0as     L/var/www/auris/envauris/lib/python3.13/site-packages/sympy/geometry/point.py	<genexpr> Point.__new__.<locals>.<genexpr>   s'     Fv!{{5r!u}}55vs   68z(Imaginary coordinates are not permitted.c              3   B   #    U  H  n[        U[        5      v   M     g 7fN)
isinstancer   r*   s     r-   r.   r/      s     71:a&&s   z,Coordinates must be valid SymPy expressions.T)rational_nocheck   )getr	   r   lenr2   r   r   	TypeErrorr   formatr   r   Zeror   
ValueErrorwarningsr%   anyallxreplaceatomsr   r   r
   Point2DPoint3Dr   __new__)	clsargskwargsr   r    coordsr"   messagefs	            r-   rC   Point.__new__m   s   ::j*;*D*DE::j(3  INa fe$$ H6{fjjF<<6""J (?(.y/@(AC D D
 v;!

5$ 7 7ffYvzz%00FjjF,v;?Z )& ' ( ( v;#()/FS)I 8#W$ ))V#g!4  -/ "0 1 1 vd|EFFFvFFFGHH7777JKK 	3V+< == __ ,,u-&/-Q 8Ia$788-&/ 0F
 v;!!%F:F-f--[A!%F:F-f-- %%c3F33&/s   8K2c                 \    [        S/[        U 5      -  5      n[         R                  X5      $ )z7Returns the distance between this point and the origin.r   )r   r7   distance)selforigins     r-   __abs__Point.__abs__   s%    s3t9}%~~f++    c                     [         R                  U [        USS95      u  p#[        X#5       VVs/ s H  u  pE[        XE-   5      PM     nnn[        USS9$ ! [         a    [        SR	                  U5      5      ef = fs  snnf )a  Add other to self by incrementing self's coordinates by
those of other.

Notes
=====

>>> from sympy import Point

When sequences of coordinates are passed to Point methods, they
are converted to a Point internally. This __add__ method does
not do that so if floating point values are used, a floating
point result (in terms of SymPy Floats) will be returned.

>>> Point(1, 2) + (.1, .2)
Point2D(1.1, 2.2)

If this is not desired, the `translate` method can be used or
another Point can be added:

>>> Point(1, 2).translate(.1, .2)
Point2D(11/10, 11/5)
>>> Point(1, 2) + Point(.1, .2)
Point2D(11/10, 11/5)

See Also
========

sympy.geometry.point.Point.translate

Fr   z+Don't know how to add {} and a Point object)r   _normalize_dimensionr8   r   r9   zipr   )rM   othersor,   brG   s          r-   __add__Point.__add__   s    >	]--dE%%4PQDA /2!i8ida(15/i8Ve,,	  	] M T TUZ [\\	] 9s    A A>%A;c                     XR                   ;   $ r1   rE   rM   items     r-   __contains__Point.__contains__   s    yy  rQ   c                     [        U5      nU R                   Vs/ s H  n[        X!-  5      PM     nn[        USS9$ s  snf )z'Divide point's coordinates by a factor.FrS   r   rE   r   r   )rM   divisorxrG   s       r-   __truediv__Point.__truediv__   s=    '"/3yy9y!(19%y9Ve,, :   =c                     [        U[        5      (       a,  [        U R                  5      [        UR                  5      :w  a  gU R                  UR                  :H  $ )NF)r2   r   r7   rE   rM   rV   s     r-   __eq__Point.__eq__   s<    %''3tyy>S_+LyyEJJ&&rQ   c                      U R                   U   $ r1   r]   )rM   keys     r-   __getitem__Point.__getitem__   s    yy~rQ   c                 ,    [        U R                  5      $ r1   )hashrE   rM   s    r-   __hash__Point.__hash__   s    DIIrQ   c                 6    U R                   R                  5       $ r1   )rE   __iter__rs   s    r-   rw   Point.__iter__   s    yy!!##rQ   c                 ,    [        U R                  5      $ r1   )r7   rE   rs   s    r-   __len__Point.__len__   s    499~rQ   c                     [        U5      nU R                   Vs/ s H  n[        X!-  5      PM     nn[        USS9$ s  snf )a  Multiply point's coordinates by a factor.

Notes
=====

>>> from sympy import Point

When multiplying a Point by a floating point number,
the coordinates of the Point will be changed to Floats:

>>> Point(1, 2)*0.1
Point2D(0.1, 0.2)

If this is not desired, the `scale` method can be used or
else only multiply or divide by integers:

>>> Point(1, 2).scale(1.1, 1.1)
Point2D(11/10, 11/5)
>>> Point(1, 2)*11/10
Point2D(11/10, 11/5)

See Also
========

sympy.geometry.point.Point.scale
FrS   rc   )rM   factorre   rG   s       r-   __mul__Point.__mul__   s>    6 .2ii8i(18$i8Ve,, 9rh   c                 $    U R                  U5      $ )z)Multiply a factor by point's coordinates.)r~   )rM   r}   s     r-   __rmul__Point.__rmul__  s    ||F##rQ   c                 X    U R                    Vs/ s H  o* PM     nn[        USS9$ s  snf )zNegate the point.FrS   )rE   r   )rM   re   rG   s      r-   __neg__Point.__neg__  s,    "ii(i"i(Ve,, )s   'c                 6    X Vs/ s H  o"* PM     sn-   $ s  snf )zHSubtract two points, or subtract a factor from this point's
coordinates. )rM   rV   re   s      r-   __sub__Point.__sub__#  s!     5)5ar5))))s   c                 .  ^ [        U SS5      mUR                  ST5      mTc  [        S U 5       5      m[        U4S jU 5       5      (       a  [	        U5      $ TUS'   UR                  SS5      US'   U Vs/ s H  n[        U40 UD6PM     sn$ s  snf )znEnsure that points have the same dimension.
By default `on_morph='warn'` is passed to the
`Point` constructor._ambient_dimensionNr"   c              3   8   #    U  H  oR                   v   M     g 7fr1   ambient_dimensionr+   is     r-   r.   -Point._normalize_dimension.<locals>.<genexpr>3  s     :6a))6s   c              3   @   >#    U  H  oR                   T:H  v   M     g 7fr1   r   )r+   r   r"   s     r-   r.   r   4  s     :6a""c)6s   r    r%   )getattrr6   maxr>   listr   )rD   pointsrF   r   r"   s       @r-   rT   Point._normalize_dimension(  s     c/6jj$;:6::C:6:::<u#ZZ
F;z,23Fqa"6"F333s   9Bc                  <   [        U 5      S:X  a  g[        R                  " U  Vs/ s H  n[        U5      PM     sn6 nUS   nUSS  Vs/ s H  oU-
  PM	     nn[        U Vs/ s H  oR                  PM     sn5      nUR                  S S9$ s  snf s  snf s  snf )a?  The affine rank of a set of points is the dimension
of the smallest affine space containing all the points.
For example, if the points lie on a line (and are not all
the same) their affine rank is 1.  If the points lie on a plane
but not a line, their affine rank is 2.  By convention, the empty
set has affine rank -1.r   r   Nc                 v    U R                   (       a  [        U R                  S5      5      S:  $ U R                  $ )Nr#   g-q=)r(   absnr)   )re   s    r-   <lambda>#Point.affine_rank.<locals>.<lambda>M  s(    #$;;CAK%=AII=rQ   )
iszerofunc)r7   r   rT   r   rE   rank)rE   r   r   rN   ms        r-   affine_rankPoint.affine_rank:  s     t9> ++-E1eAh-EF&,QRj1jf*j1F+FqFFF+,vv $>v ? 	? .F1+s   B
B#Bc                 .    [        U S[        U 5      5      $ )z$Number of components this point has.r   )r   r7   rs   s    r-   r   Point.ambient_dimensionP  s     t13t9==rQ   c                     [        U5      S::  a  gU R                  " U Vs/ s H  n[        U5      PM     sn6 nUS   R                  S:X  a  g[	        [        U5      5      n[        R                  " U6 S:*  $ s  snf )a1  Return True if there exists a plane in which all the points
lie.  A trivial True value is returned if `len(points) < 3` or
all Points are 2-dimensional.

Parameters
==========

A set of points

Raises
======

ValueError : if less than 3 unique points are given

Returns
=======

boolean

Examples
========

>>> from sympy import Point3D
>>> p1 = Point3D(1, 2, 2)
>>> p2 = Point3D(2, 7, 2)
>>> p3 = Point3D(0, 0, 2)
>>> p4 = Point3D(1, 1, 2)
>>> Point3D.are_coplanar(p1, p2, p3, p4)
True
>>> p5 = Point3D(0, 1, 3)
>>> Point3D.are_coplanar(p1, p2, p3, p5)
False

r   Tr   r#   )r7   rT   r   r   r   r   r   )rD   r   r   s      r-   are_coplanarPoint.are_coplanarU  sv    H v;!))f+EfE!Hf+EF!9&&!+d6l#  &)Q.. ,Fs   A8c           	         [        U[        5      (       d   [        XR                  S9n[        U[        5      (       aB  [        R                  U [        U5      5      u  p#[        [        S [        X#5       5       6 5      $ [        USS5      nUc  [	        S[        U5      -  5      eU" U 5      $ ! [         a    [	        S[        U5      -  5      ef = f)a  The Euclidean distance between self and another GeometricEntity.

Returns
=======

distance : number or symbolic expression.

Raises
======

TypeError : if other is not recognized as a GeometricEntity or is a
            GeometricEntity for which distance is not defined.

See Also
========

sympy.geometry.line.Segment.length
sympy.geometry.point.Point.taxicab_distance

Examples
========

>>> from sympy import Point, Line
>>> p1, p2 = Point(1, 1), Point(4, 5)
>>> l = Line((3, 1), (2, 2))
>>> p1.distance(p2)
5
>>> p1.distance(l)
sqrt(2)

The computed distance may be symbolic, too:

>>> from sympy.abc import x, y
>>> p3 = Point(x, y)
>>> p3.distance((0, 0))
sqrt(x**2 + y**2)

r"   z'not recognized as a GeometricEntity: %sc              3   4   #    U  H  u  pX-
  S -  v   M     g7fr#   Nr   r+   r,   rY   s      r-   r.   !Point.distance.<locals>.<genexpr>  s     ?YTQquqjYs   rL   Nz,distance between Point and %s is not defined)r2   r   r   r   r8   typerT   r   r   rU   r   )rM   rV   rW   prL   s        r-   rL   Point.distance  s    N %00Ye)?)?@ eU##--dE%LADA?SY?@AA5*d3JTRW[XYY~  Y IDQVK WXXYs   B0 0"Cc                 h    [        U5      (       d  [        U5      n[        S [        X5       5       6 $ )z.Return dot product of self with another Point.c              3   .   #    U  H  u  pX-  v   M     g 7fr1   r   r   s      r-   r.   Point.dot.<locals>.<genexpr>  s     2\TQQS\s   )r   r   r   rU   )rM   r   s     r-   dot	Point.dot  s)    1~~aA2S\233rQ   c                     [        U[        5      (       a  [        U 5      [        U5      :w  a  g[        S [	        X5       5       5      $ )z8Returns whether the coordinates of self and other agree.Fc              3   H   #    U  H  u  pUR                  U5      v   M     g 7fr1   )equalsr   s      r-   r.   Point.equals.<locals>.<genexpr>  s     <+;41188A;;+;s    ")r2   r   r7   r>   rU   rj   s     r-   r   Point.equals  s9     %''3t9E
+B<3t+;<<<rQ   c                     [        U5      nU R                   Vs/ s H  oDR                  " SSU0UD6PM     nn[        USS06$ s  snf )a  Evaluate the coordinates of the point.

This method will, where possible, create and return a new Point
where the coordinates are evaluated as floating point numbers to
the precision indicated (default=15).

Parameters
==========

prec : int

Returns
=======

point : Point

Examples
========

>>> from sympy import Point, Rational
>>> p1 = Point(Rational(1, 2), Rational(3, 2))
>>> p1
Point2D(1/2, 3/2)
>>> p1.evalf()
Point2D(0.5, 1.5)

r   r   Fr   )r   rE   evalfr   )rM   precoptionsdpsre   rG   s         r-   _eval_evalfPoint._eval_evalf  sK    8 $59YY?Y''+C+7+Y?f-u-- @s   Ac                     [        U[        5      (       d  [        U5      n[        U[        5      (       a.  X:X  a  U /$ [        R                  X5      u  p#X :X  a  X#:X  a  U /$ / $ UR	                  U 5      $ )a  The intersection between this point and another GeometryEntity.

Parameters
==========

other : GeometryEntity or sequence of coordinates

Returns
=======

intersection : list of Points

Notes
=====

The return value will either be an empty list if there is no
intersection, otherwise it will contain this point.

Examples
========

>>> from sympy import Point
>>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(0, 0)
>>> p1.intersection(p2)
[]
>>> p1.intersection(p3)
[Point2D(0, 0)]

)r2   r   r   rT   intersection)rM   rV   p1p2s       r-   r   Point.intersection  sk    < %00%LEeU##}v//<FBzbhvI!!$''rQ   c                     U 4U-   n[         R                  " U Vs/ s H  n[        U5      PM     sn6 n[        [        U5      5      n[         R                  " U6 S:*  $ s  snf )a+  Returns `True` if there exists a line
that contains `self` and `points`.  Returns `False` otherwise.
A trivially True value is returned if no points are given.

Parameters
==========

args : sequence of Points

Returns
=======

is_collinear : boolean

See Also
========

sympy.geometry.line.Line

Examples
========

>>> from sympy import Point
>>> from sympy.abc import x
>>> p1, p2 = Point(0, 0), Point(1, 1)
>>> p3, p4, p5 = Point(2, 2), Point(x, x), Point(1, 2)
>>> Point.is_collinear(p1, p2, p3, p4)
True
>>> Point.is_collinear(p1, p2, p3, p5)
False

r   )r   rT   r   r   r   )rM   rE   r   r   s       r-   is_collinearPoint.is_collinear  s]    B 4++-G1eAh-GHd6l#  &)Q.. .Hs   Ac           	         U 4U-   n[         R                  " U Vs/ s H  n[        U5      PM     sn6 n[        [        U5      5      n[         R                  " U6 S::  d  gUS   nU Vs/ s H  oUU-
  PM	     nn[        U Vs/ s H!  n[        U5      UR                  U5      /-   PM#     sn5      nUR                  5       u  px[        U5      U;  a  ggs  snf s  snf s  snf )ag  Do `self` and the given sequence of points lie in a circle?

Returns True if the set of points are concyclic and
False otherwise. A trivial value of True is returned
if there are fewer than 2 other points.

Parameters
==========

args : sequence of Points

Returns
=======

is_concyclic : boolean


Examples
========

>>> from sympy import Point

Define 4 points that are on the unit circle:

>>> p1, p2, p3, p4 = Point(1, 0), (0, 1), (-1, 0), (0, -1)

>>> p1.is_concyclic() == p1.is_concyclic(p2, p3, p4) == True
True

Define a point not on that circle:

>>> p = Point(1, 1)

>>> p.is_concyclic(p1, p2, p3)
False

r#   Fr   T)	r   rT   r   r   r   r   r   rrefr7   )	rM   rE   r   r   rN   r   matr   pivotss	            r-   is_concyclicPoint.is_concyclic3  s    L 4++-G1eAh-GHd6l#  &)Q.&,-ff*f- F;Fqd1gq
*F;<xxzv;f$ .H
 . <s   C)C(Cc                 0    U R                   nUc  gU(       + $ )zjTrue if any coordinate is nonzero, False if every coordinate is zero,
and None if it cannot be determined.N)r)   )rM   r)   s     r-   
is_nonzeroPoint.is_nonzerok  s     ,,?{rQ   c                 t   [         R                  U [        U5      5      u  p#UR                  S:X  aT  UR                  UR                  su  pEu  pgXG-  Xe-  -
  R	                  S5      nUc  [        [        SU< SU< 35      5      e[        UR                  UR                  /5      n	U	R                  5       S:  $ )zkReturns whether each coordinate of `self` is a scalar
multiple of the corresponding coordinate in point p.
r#   r   zCannot determine if z- is a scalar multiple of
                    )	r   rT   r   rE   r   r   r   r   r   )
rM   r   rW   rX   x1y1x2y2rvr   s
             r-   is_scalar_multiplePoint.is_scalar_multiplet  s     ))$a9!#!"HRhr%"%-''*Bz!*##$ % % AFFAFF#$vvx!|rQ   c                     U R                    Vs/ s H  oR                  PM     nn[        U5      (       a  g[        S U 5       5      (       a  ggs  snf )zkTrue if every coordinate is zero, False if any coordinate is not zero,
and None if it cannot be determined.Fc              3   (   #    U  H  oS L v   M
     g 7fr1   r   )r+   re   s     r-   r.    Point.is_zero.<locals>.<genexpr>  s     *'QDy's   NT)rE   r   r=   )rM   re   nonzeros      r-   r)   Point.is_zero  sF     *.3A<<3w<<*'*** 4s   Ac                 "    [         R                  $ )z
Treating a Point as a Line, this returns 0 for the length of a Point.

Examples
========

>>> from sympy import Point
>>> p = Point(0, 1)
>>> p.length
0
)r   r:   rs   s    r-   lengthPoint.length  s     vvrQ   c           
          [         R                  U [        U5      5      u  p![        [        X!5       VVs/ s H#  u  p4[        X4-   [        R
                  -  5      PM%     snn5      $ s  snnf )a  The midpoint between self and point p.

Parameters
==========

p : Point

Returns
=======

midpoint : Point

See Also
========

sympy.geometry.line.Segment.midpoint

Examples
========

>>> from sympy import Point
>>> p1, p2 = Point(1, 1), Point(13, 5)
>>> p1.midpoint(p2)
Point2D(7, 3)

)r   rT   rU   r   r   Half)rM   r   rW   r,   rY   s        r-   midpointPoint.midpoint  sN    6 ))$a93q9E941hqvv~.9EFFEs   *A'
c                 0    [        S/[        U 5      -  SS9$ )zGA point of all zeros of the same ambient dimension
as the current pointr   FrS   )r   r7   rs   s    r-   rN   Point.origin  s     aST]U33rQ   c                     U R                   nU S   R                  (       a  [        S/US-
  S/-  -   5      $ U S   R                  (       a  [        SS/US-
  S/-  -   5      $ [        U S   * U S   /US-
  S/-  -   5      $ )a  Returns a non-zero point that is orthogonal to the
line containing `self` and the origin.

Examples
========

>>> from sympy import Line, Point
>>> a = Point(1, 2, 3)
>>> a.orthogonal_direction
Point3D(-2, 1, 0)
>>> b = _
>>> Line(b, b.origin).is_perpendicular(Line(a, a.origin))
True
r   r   r#   )r   r)   r   )rM   r"   s     r-   orthogonal_directionPoint.orthogonal_direction  s      $$7??!a!},--7??!A#'A3.// tAwhQ(C!GaS=899rQ   c                     [         R                  [        U 5      [        U5      5      u  pUR                  (       a  [        S5      eXR	                  U5      UR	                  U5      -  -  $ )a  Project the point `a` onto the line between the origin
and point `b` along the normal direction.

Parameters
==========

a : Point
b : Point

Returns
=======

p : Point

See Also
========

sympy.geometry.line.LinearEntity.projection

Examples
========

>>> from sympy import Line, Point
>>> a = Point(1, 2)
>>> b = Point(2, 5)
>>> z = a.origin
>>> p = Point.project(a, b)
>>> Line(p, a).is_perpendicular(Line(p, b))
True
>>> Point.is_collinear(z, p, b)
True
"Cannot project to the zero vector.)r   rT   r)   r;   r   )r,   rY   s     r-   projectPoint.project  sR    D ))%(E!H=99ABB%%(QUU1X%&&rQ   c                 t    [         R                  U [        U5      5      u  p![        S [        X!5       5       6 $ )a  The Taxicab Distance from self to point p.

Returns the sum of the horizontal and vertical distances to point p.

Parameters
==========

p : Point

Returns
=======

taxicab_distance : The sum of the horizontal
and vertical distances to point p.

See Also
========

sympy.geometry.point.Point.distance

Examples
========

>>> from sympy import Point
>>> p1, p2 = Point(1, 1), Point(4, 5)
>>> p1.taxicab_distance(p2)
7

c              3   @   #    U  H  u  p[        X-
  5      v   M     g 7fr1   r   r   s      r-   r.   )Point.taxicab_distance.<locals>.<genexpr>%  s     6IDASZZIs   )r   rT   r   rU   rM   r   rW   s      r-   taxicab_distancePoint.taxicab_distance  s1    < ))$a96CI677rQ   c                     [         R                  U [        U5      5      u  p!U R                  (       a  UR                  (       a  [        S5      e[	        S [        X!5       5       6 $ )am  The Canberra Distance from self to point p.

Returns the weighted sum of horizontal and vertical distances to
point p.

Parameters
==========

p : Point

Returns
=======

canberra_distance : The weighted sum of horizontal and vertical
distances to point p. The weight used is the sum of absolute values
of the coordinates.

Examples
========

>>> from sympy import Point
>>> p1, p2 = Point(1, 1), Point(3, 3)
>>> p1.canberra_distance(p2)
1
>>> p1, p2 = Point(0, 0), Point(3, 3)
>>> p1.canberra_distance(p2)
2

Raises
======

ValueError when both vectors are zero.

See Also
========

sympy.geometry.point.Point.distance

r   c              3   p   #    U  H,  u  p[        X-
  5      [        U5      [        U5      -   -  v   M.     g 7fr1   r   r   s      r-   r.   *Point.canberra_distance.<locals>.<genexpr>S  s)     J	c!%j#a&3q6/2	s   46)r   rT   r)   r;   r   rU   r   s      r-   canberra_distancePoint.canberra_distance'  sK    R ))$a9<<AIIABBJA	JKKrQ   c                     U [        U 5      -  $ )z\Return the Point that is in the same direction as `self`
and a distance of 1 from the originr   rs   s    r-   unit
Point.unitU  s     c$irQ   r   N)   ).__name__
__module____qualname____firstlineno____doc__is_PointrC   rO   rZ   r`   rf   rk   ro   rt   rw   rz   r~   r   r   r   classmethodrT   staticmethodr   propertyr   r   rL   r   r   r   r   r   r   r   r   r)   r   r   rN   r   r   r   r   r   __static_attributes__r   rQ   r-   r   r   *   sv   >@ HF4P,
%-N!-'
$->$-
*
 4 4" ? ?* > > +/ +/Z2h4=.@'(R$/L6p  &    G< 4 4
 : :2 $' $'L8B,L\    rQ   r   c                       \ rS rSrSrSrSS.S jrS r\S 5       r	SS
 jr
SS jrS rSS jr\S 5       r\S 5       r\S 5       rSrg	)rA   i\  a%  A point in a 2-dimensional Euclidean space.

Parameters
==========

coords
    A sequence of 2 coordinate values.

Attributes
==========

x
y
length

Raises
======

TypeError
    When trying to add or subtract points with different dimensions.
    When trying to create a point with more than two dimensions.
    When `intersection` is called with object other than a Point.

See Also
========

sympy.geometry.line.Segment : Connects two Points

Examples
========

>>> from sympy import Point2D
>>> from sympy.abc import x
>>> Point2D(1, 2)
Point2D(1, 2)
>>> Point2D([1, 2])
Point2D(1, 2)
>>> Point2D(0, x)
Point2D(0, x)

Floats are automatically converted to Rational unless the
evaluate flag is False:

>>> Point2D(0.5, 0.25)
Point2D(1/2, 1/4)
>>> Point2D(0.5, 0.25, evaluate=False)
Point2D(0.5, 0.25)

r#   Fr4   c                ^    U(       d  SUS'   [        U0 UD6n[        R                  " U /UQ76 $ )Nr#   r"   r   r   rC   rD   r4   rE   rF   s       r-   rC   Point2D.__new__  3    F5M$)&)D%%c1D11rQ   c                 
    X:H  $ r1   r   r^   s     r-   r`   Point2D.__contains__  
    |rQ   c                 ^    U R                   U R                  U R                   U R                  4$ )zgReturn a tuple (xmin, ymin, xmax, ymax) representing the bounding
rectangle for the geometric figure.

)re   yrs   s    r-   boundsPoint2D.bounds  s#     //rQ   Nc                     [        U5      n[        U5      nU nUb  [        USS9nXR-  nUR                  u  pg[        X6-  XG-  -
  XF-  X7-  -   5      nUb  XR-  nU$ )zRotate ``angle`` radians counterclockwise about Point ``pt``.

See Also
========

translate, scale

Examples
========

>>> from sympy import Point2D, pi
>>> t = Point2D(1, 0)
>>> t.rotate(pi/2)
Point2D(0, 1)
>>> t.rotate(pi/2, (2, 0))
Point2D(2, -1)

r#   r   )r   r   r   rE   )rM   angleptcrW   r   re   r  s           r-   rotatePoint2D.rotate  sk    & JJ>rq!BHBww139acACi(>HB	rQ   c                     U(       aJ  [        USS9nU R                  " U* R                  6 R                  X5      R                  " UR                  6 $ [        U R                  U-  U R
                  U-  5      $ )a}  Scale the coordinates of the Point by multiplying by
``x`` and ``y`` after subtracting ``pt`` -- default is (0, 0) --
and then adding ``pt`` back again (i.e. ``pt`` is the point of
reference for the scaling).

See Also
========

rotate, translate

Examples
========

>>> from sympy import Point2D
>>> t = Point2D(1, 1)
>>> t.scale(2)
Point2D(2, 1)
>>> t.scale(2, 2)
Point2D(2, 2)

r#   r   )r   	translaterE   scalere   r  )rM   re   r  r  s       r-   r!  Point2D.scale  s_    , rq!B>>RC::.44Q:DDbggNNTVVAXtvvax((rQ   c           	          UR                   (       a  UR                  S:X  d  [        S5      eU R                  u  p#[	        [        SSX#S/5      U-  R                  5       S   SS 6 $ )zReturn the point after applying the transformation described
by the 3x3 Matrix, ``matrix``.

See Also
========
sympy.geometry.point.Point2D.rotate
sympy.geometry.point.Point2D.scale
sympy.geometry.point.Point2D.translate
)r5   r5   zmatrix must be a 3x3 matrixr   r5   r   Nr#   )	is_Matrixshaper;   rE   r   r   tolist)rM   matrixre   r  s       r-   	transformPoint2D.transform  sa       V\\V%;:;;yyvaQ1I.v5==?B2AFGGrQ   c                 N    [        U R                  U-   U R                  U-   5      $ )a4  Shift the Point by adding x and y to the coordinates of the Point.

See Also
========

sympy.geometry.point.Point2D.rotate, scale

Examples
========

>>> from sympy import Point2D
>>> t = Point2D(0, 1)
>>> t.translate(2)
Point2D(2, 1)
>>> t.translate(2, 2)
Point2D(2, 3)
>>> t + Point2D(2, 2)
Point2D(2, 3)

)r   re   r  )rM   re   r  s      r-   r   Point2D.translate  s!    * TVVaZ!,,rQ   c                     U R                   $ )z
Returns the two coordinates of the Point.

Examples
========

>>> from sympy import Point2D
>>> p = Point2D(0, 1)
>>> p.coordinates
(0, 1)
r]   rs   s    r-   coordinatesPoint2D.coordinates       yyrQ   c                      U R                   S   $ )zz
Returns the X coordinate of the Point.

Examples
========

>>> from sympy import Point2D
>>> p = Point2D(0, 1)
>>> p.x
0
r   r]   rs   s    r-   re   	Point2D.x       yy|rQ   c                      U R                   S   $ )zz
Returns the Y coordinate of the Point.

Examples
========

>>> from sympy import Point2D
>>> p = Point2D(0, 1)
>>> p.y
1
r   r]   rs   s    r-   r  	Point2D.y"  r2  rQ   r   r1   )r   r   N)r   r   )r  r  r  r  r  r   rC   r`   r	  r  r  r!  r(  r   r-  re   r  r
  r   rQ   r-   rA   rA   \  s    0d %* 2 0 0@)6H-.      rQ   rA   c                       \ rS rSrSrSrSS.S jrS r\S 5       r	S	 r
S
 rS rSS jrS rSS jr\S 5       r\S 5       r\S 5       r\S 5       rSrg)rB   i1  a  A point in a 3-dimensional Euclidean space.

Parameters
==========

coords
    A sequence of 3 coordinate values.

Attributes
==========

x
y
z
length

Raises
======

TypeError
    When trying to add or subtract points with different dimensions.
    When `intersection` is called with object other than a Point.

Examples
========

>>> from sympy import Point3D
>>> from sympy.abc import x
>>> Point3D(1, 2, 3)
Point3D(1, 2, 3)
>>> Point3D([1, 2, 3])
Point3D(1, 2, 3)
>>> Point3D(0, x, 3)
Point3D(0, x, 3)

Floats are automatically converted to Rational unless the
evaluate flag is False:

>>> Point3D(0.5, 0.25, 2)
Point3D(1/2, 1/4, 2)
>>> Point3D(0.5, 0.25, 3, evaluate=False)
Point3D(0.5, 0.25, 3)

r5   Fr  c                ^    U(       d  SUS'   [        U0 UD6n[        R                  " U /UQ76 $ )Nr5   r"   r  r  s       r-   rC   Point3D.__new__a  r  rQ   c                 
    X:H  $ r1   r   r^   s     r-   r`   Point3D.__contains__g  r  rQ   c                  (    [         R                  " U 6 $ )aK  Is a sequence of points collinear?

Test whether or not a set of points are collinear. Returns True if
the set of points are collinear, or False otherwise.

Parameters
==========

points : sequence of Point

Returns
=======

are_collinear : boolean

See Also
========

sympy.geometry.line.Line3D

Examples
========

>>> from sympy import Point3D
>>> from sympy.abc import x
>>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 1)
>>> p3, p4, p5 = Point3D(2, 2, 2), Point3D(x, x, x), Point3D(1, 2, 6)
>>> Point3D.are_collinear(p1, p2, p3, p4)
True
>>> Point3D.are_collinear(p1, p2, p3, p5)
False
)r   r   )r   s    r-   are_collinearPoint3D.are_collinearj  s    D !!6**rQ   c                     U R                  U5      n[        [        S U 5       6 5      nUR                  U R                  -
  U-  UR                  U R                  -
  U-  UR
                  U R
                  -
  U-  /$ )a   
Gives the direction cosine between 2 points

Parameters
==========

p : Point3D

Returns
=======

list

Examples
========

>>> from sympy import Point3D
>>> p1 = Point3D(1, 2, 3)
>>> p1.direction_cosine(Point3D(2, 3, 5))
[sqrt(6)/6, sqrt(6)/6, sqrt(6)/3]
c              3   *   #    U  H	  oS -  v   M     g7fr   r   r   s     r-   r.   +Point3D.direction_cosine.<locals>.<genexpr>  s     'Q!tQs   )direction_ratior   r   re   r  z)rM   pointr,   rY   s       r-   direction_cosinePoint3D.direction_cosine  sq    ,   ''Q'()466!Q&$&&(8A'=466!Q&( 	(rQ   c                     UR                   U R                   -
  UR                  U R                  -
  UR                  U R                  -
  /$ )z
Gives the direction ratio between 2 points

Parameters
==========

p : Point3D

Returns
=======

list

Examples
========

>>> from sympy import Point3D
>>> p1 = Point3D(1, 2, 3)
>>> p1.direction_ratio(Point3D(2, 3, 5))
[1, 1, 2]
)re   r  rA  )rM   rB  s     r-   r@  Point3D.direction_ratio  s8    , 466!EGGdff$4uww7GIIrQ   c                     [        U[        5      (       d
  [        USS9n[        U[        5      (       a
  X:X  a  U /$ / $ UR	                  U 5      $ )a  The intersection between this point and another GeometryEntity.

Parameters
==========

other : GeometryEntity or sequence of coordinates

Returns
=======

intersection : list of Points

Notes
=====

The return value will either be an empty list if there is no
intersection, otherwise it will contain this point.

Examples
========

>>> from sympy import Point3D
>>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(0, 0, 0)
>>> p1.intersection(p2)
[]
>>> p1.intersection(p3)
[Point3D(0, 0, 0)]

r5   r   )r2   r   r   rB   r   rj   s     r-   r   Point3D.intersection  sL    < %00%Q'EeW%%}vI!!$''rQ   Nc                    U(       aL  [        U5      nU R                  " U* R                  6 R                  XU5      R                  " UR                  6 $ [        U R                  U-  U R
                  U-  U R                  U-  5      $ )a~  Scale the coordinates of the Point by multiplying by
``x`` and ``y`` after subtracting ``pt`` -- default is (0, 0) --
and then adding ``pt`` back again (i.e. ``pt`` is the point of
reference for the scaling).

See Also
========

translate

Examples
========

>>> from sympy import Point3D
>>> t = Point3D(1, 1, 1)
>>> t.scale(2)
Point3D(2, 1, 1)
>>> t.scale(2, 2)
Point3D(2, 2, 1)

)rB   r   rE   r!  re   r  rA  )rM   re   r  rA  r  s        r-   r!  Point3D.scale  sh    , B>>RC::.44Q1=GGQQtvvax466!844rQ   c           
          UR                   (       a  UR                  S:X  d  [        S5      eU R                  u  p#n[	        U5      n[        [        SSX#US/5      U-  R                  5       S   SS 6 $ )zReturn the point after applying the transformation described
by the 4x4 Matrix, ``matrix``.

See Also
========
sympy.geometry.point.Point3D.scale
sympy.geometry.point.Point3D.translate
)   rL  zmatrix must be a 4x4 matrixr   rL  r   Nr5   )r$  r%  r;   rE   r   rB   r   r&  )rM   r'  re   r  rA  r   s         r-   r(  Point3D.transform  so       V\\V%;:;;))af1qQl3A5==?B2AFGGrQ   c                 j    [        U R                  U-   U R                  U-   U R                  U-   5      $ )a  Shift the Point by adding x and y to the coordinates of the Point.

See Also
========

scale

Examples
========

>>> from sympy import Point3D
>>> t = Point3D(0, 1, 1)
>>> t.translate(2)
Point3D(2, 1, 1)
>>> t.translate(2, 2)
Point3D(2, 3, 1)
>>> t + Point3D(2, 2, 2)
Point3D(2, 3, 3)

)rB   re   r  rA  )rM   re   r  rA  s       r-   r   Point3D.translate  s+    * tvvz466A:tvvz::rQ   c                     U R                   $ )z
Returns the three coordinates of the Point.

Examples
========

>>> from sympy import Point3D
>>> p = Point3D(0, 1, 2)
>>> p.coordinates
(0, 1, 2)
r]   rs   s    r-   r-  Point3D.coordinates(  r/  rQ   c                      U R                   S   $ )z}
Returns the X coordinate of the Point.

Examples
========

>>> from sympy import Point3D
>>> p = Point3D(0, 1, 3)
>>> p.x
0
r   r]   rs   s    r-   re   	Point3D.x7  r2  rQ   c                      U R                   S   $ )z}
Returns the Y coordinate of the Point.

Examples
========

>>> from sympy import Point3D
>>> p = Point3D(0, 1, 2)
>>> p.y
1
r   r]   rs   s    r-   r  	Point3D.yF  r2  rQ   c                      U R                   S   $ )z}
Returns the Z coordinate of the Point.

Examples
========

>>> from sympy import Point3D
>>> p = Point3D(0, 1, 1)
>>> p.z
1
r#   r]   rs   s    r-   rA  	Point3D.zU  r2  rQ   r   )r   r   r   N)r   r   r   )r  r  r  r  r  r   rC   r`   r  r;  rC  r@  r   r!  r(  r   r	  r-  re   r  rA  r
  r   rQ   r-   rB   rB   1  s    +Z %* 2 !+ !+F(6J0$(L56H;.        rQ   rB   ),r  r<   
sympy.corer   r   r   sympy.core.addr   sympy.core.containersr   sympy.core.numbersr   sympy.core.parametersr	   sympy.simplify.simplifyr
   r   sympy.geometry.exceptionsr   (sympy.functions.elementary.miscellaneousr   $sympy.functions.elementary.complexesr   (sympy.functions.elementary.trigonometricr   r   sympy.matricesr   sympy.matrices.expressionsr   sympy.utilities.iterablesr   r   sympy.utilities.miscr   r   r   entityr   mpmath.libmp.libmpfr   r   rA   rB   r   rQ   r-   <module>rh     sq   &  ' '  ' $ 3 7 3 9 3 = ! 0 7 C C " +o N o dSe Sjqe qrQ   