
    Ed                     j    d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ  G d de          Zd	S )
    )Basic)Str)Vector)
CoordSys3D)_path)cacheitc                   Z     e Zd ZdZej        df fd	Zed             Zd Z	d Z
d Z xZS )Pointz*
    Represents a point in 3-D space.
    Nc                 &   t          |          }t          |t                    st          dt	          |          z            t          |t
                    s!|t          dt	          |          z            |1t                                          | t          |          |          }n1t                                          | t          |          ||          }||_	        ||_
        |d |_        ||_        n||_        |j        |_        |S )Nz0position should be an instance of Vector, not %sz3parent_point should be an instance of Point, not %s)str
isinstancer   	TypeErrortyper
   super__new__r   _name_pos_parent_root)clsnamepositionparent_pointobj	__class__s        2lib/python3.11/site-packages/sympy/vector/point.pyr   zPoint.__new__   s   4yy(F++ 	BTF F    <// 	#	#E I" I" "# # #  	J''//#s4yy(;;CC''//#s4yy(LIIC	 	+CKCII&CK$*CI
    c                 H   t          |t                    s4t          |t                    st          t	          |          dz             t          |t                    r|j        }|| k    rt          j        S || j        k    r| j	        S |j        | k    r
d|j	        z  S t          | |          \  }}t          j        }d}t          |          D ]}|||         j	        z  }|dz  }|t          |          k     r(|||         j	        z  }|dz  }|t          |          k     (|S )aL  
        Returns the position vector of this Point with respect to
        another Point/CoordSys3D.

        Parameters
        ==========

        other : Point/CoordSys3D
            If other is a Point, the position of this Point wrt it is
            returned. If its an instance of CoordSyRect, the position
            wrt its origin is returned.

        Examples
        ========

        >>> from sympy.vector import CoordSys3D
        >>> N = CoordSys3D('N')
        >>> p1 = N.origin.locate_new('p1', 10 * N.i)
        >>> N.origin.position_wrt(p1)
        (-10)*N.i

        zis not a Point or CoordSys3D      )r   r
   r   r   r   originr   zeror   r   r   rangelen)selfother	rootindexpathresultis         r   position_wrtzPoint.position_wrt+   s@   2 5%(( 	<uj11	<CJJ:; < < <eZ(( 	!LED= 	#;dl" 	#9]d" 	#
?"e,,	4y!! 	# 	#Ad1gl"FF	Q#d))m 	d1gl"FFA #d))m 	 r   c                 $    t          |||           S )ai  
        Returns a new Point located at the given position wrt this
        Point.
        Thus, the position vector of the new Point wrt this one will
        be equal to the given 'position' parameter.

        Parameters
        ==========

        name : str
            Name of the new point

        position : Vector
            The position vector of the new Point wrt this one

        Examples
        ========

        >>> from sympy.vector import CoordSys3D
        >>> N = CoordSys3D('N')
        >>> p1 = N.origin.locate_new('p1', 10 * N.i)
        >>> p1.position_wrt(N.origin)
        10*N.i

        )r
   )r&   r   r   s      r   
locate_newzPoint.locate_new]   s    4 T8T***r   c                 z    |                      |j                  }t          |                    |                    S )aA  
        Returns the Cartesian/rectangular coordinates of this point
        wrt the origin of the given CoordSys3D instance.

        Parameters
        ==========

        coordinate_system : CoordSys3D
            The coordinate system to express the coordinates of this
            Point in.

        Examples
        ========

        >>> from sympy.vector import CoordSys3D
        >>> N = CoordSys3D('N')
        >>> p1 = N.origin.locate_new('p1', 10 * N.i)
        >>> p2 = p1.locate_new('p2', 5 * N.j)
        >>> p2.express_coordinates(N)
        (10, 5, 0)

        )r,   r"   tuple	to_matrix)r&   coordinate_systempos_vects      r   express_coordinateszPoint.express_coordinatesy   s8    2 $$%6%=>>X''(9::;;;r   c                     | j         S )N)r   )r&   printers     r   	_sympystrzPoint._sympystr   s
    zr   )__name__
__module____qualname____doc__r   r#   r   r   r,   r.   r4   r7   __classcell__)r   s   @r   r
   r
   	   s          %+Kd      : / / W/b+ + +8< < <:      r   r
   N)sympy.core.basicr   sympy.core.symbolr   sympy.vector.vectorr   sympy.vector.coordsysrectr   sympy.vector.functionsr   sympy.core.cacher   r
    r   r   <module>rD      s    " " " " " " ! ! ! ! ! ! & & & & & & 0 0 0 0 0 0 ( ( ( ( ( ( $ $ $ $ $ $N N N N NE N N N N Nr   