ó
¡¼™\c           @   sŠ   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 d  d l m Z d e f d	 „  ƒ  YZ d
 S(   iÿÿÿÿ(   t   range(   t   Basic(   t   Vector(   t
   CoordSys3D(   t   _path(   t   Symbol(   t   cacheitt   Pointc           B   sY   e  Z d  Z e j d d „ Z e d „  ƒ Z d „  Z	 d „  Z
 d d „ Z e Z e Z RS(   s*   
    Represents a point in 3-D space.
    c         C   s  t  | ƒ } t | t ƒ s4 t d t | ƒ ƒ ‚ n  t | t ƒ ri | d  k	 ri t d t | ƒ ƒ ‚ n  | d  k rœ t t |  ƒ j |  t	 | ƒ | ƒ } n' t t |  ƒ j |  t	 | ƒ | | ƒ } | | _
 | | _ | d  k rö d  | _ | | _ n | | _ | j | _ | S(   Ns0   position should be an instance of Vector, not %ss3   parent_point should be an instance of Point, not %s(   t   strt
   isinstanceR   t	   TypeErrort   typeR   t   Nonet   supert   __new__R   t   _namet   _post   _parentt   _root(   t   clst   namet   positiont   parent_pointt   obj(    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyR      s,    '				c         C   s%  t  | t ƒ r9 t  | t ƒ r9 t t | ƒ d ƒ ‚ n  t  | t ƒ rT | j } n  | |  k rg t j S| |  j k r} |  j	 S| j |  k r— d | j	 St
 |  | ƒ \ } } t j } d } x% t | ƒ D] } | | | j	 7} qÈ W| d 7} x1 | t | ƒ k  r | | | j	 8} | d 7} qð W| S(   sS  
        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 Point, CoordSys3D
        >>> N = CoordSys3D('N')
        >>> p1 = N.origin.locate_new('p1', 10 * N.i)
        >>> N.origin.position_wrt(p1)
        (-10)*N.i

        s   is not a Point or CoordSys3Diÿÿÿÿi   i   (   R	   R   R   R
   R   t   originR   t   zeroR   R   R   R    t   len(   t   selft   othert	   rootindext   patht   resultt   i(    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyt   position_wrt-   s,    	
c         C   s   t  | | |  ƒ S(   sp  
        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 Point, 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   (    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyt
   locate_new_   s    c         C   s%   |  j  | j ƒ } t | j | ƒ ƒ S(   sH  
        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 Point, 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   t   tuplet	   to_matrix(   R   t   coordinate_systemt   pos_vect(    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyt   express_coordinates{   s    c         C   s   |  j  S(   N(   R   (   R   t   printer(    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyt   __str__˜   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R!   R"   R'   R)   t   __repr__t	   _sympystr(    (    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyR   
   s   2		N(   t   sympy.core.compatibilityR    t   sympy.core.basicR   t   sympy.vector.vectorR   t   sympy.vector.coordsysrectR   t   sympy.vector.functionsR   t   sympyR   t   sympy.core.cacheR   R   (    (    (    s1   lib/python2.7/site-packages/sympy/vector/point.pyt   <module>   s   