§
    PŠtj.  ã                   ó   — d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	m
Z
mZ d dlmZ d dlmZ d dlmZ d dlZ G d	„ d
e¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zd„ ZdS )é    )ÚBasic)Úsympify)ÚcosÚsin)ÚeyeÚ	rot_axis1Ú	rot_axis2Ú	rot_axis3)ÚImmutableDenseMatrix)Úcacheit)ÚStrNc                   ó   — e Zd ZdZd„ ZdS )ÚOrienterz/
    Super-class for all orienter classes.
    c                 ó   — | j         S )zV
        The rotation matrix corresponding to this orienter
        instance.
        )Ú_parent_orient©Úselfs    úT/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/vector/orienters.pyÚrotation_matrixzOrienter.rotation_matrix   s   € ð
 Ô"Ð"ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r   r      s-   € € € € € ðð ð#ð #ð #ð #ð #r   r   c                   ój   ‡ — e Zd ZdZˆ fd„Zd„ Zed„ ¦   «         Zed„ ¦   «         Z	ed„ ¦   «         Z
ˆ xZS )ÚAxisOrienterz+
    Class to denote an axis orienter.
    c                 óä   •— t          |t          j        j        ¦  «        st	          d¦  «        ‚t          |¦  «        }t          ¦   «                              | ||¦  «        }||_        ||_	        |S )Nzaxis should be a Vector)
Ú
isinstanceÚsympyÚvectorÚVectorÚ	TypeErrorr   ÚsuperÚ__new__Ú_angleÚ_axis)ÚclsÚangleÚaxisÚobjÚ	__class__s       €r   r%   zAxisOrienter.__new__   s`   ø€ Ý˜$¥¤Ô 3Ñ4Ô4ð 	7ÝÐ5Ñ6Ô6Ð6Ý˜‘”ˆå‰gŒg�oŠo˜c 5¨$Ñ/Ô/ˆØˆŒ
ØˆŒ	àˆ
r   c                 ó   — dS )aá  
        Axis rotation is a rotation about an arbitrary axis by
        some angle. The angle is supplied as a SymPy expr scalar, and
        the axis is supplied as a Vector.

        Parameters
        ==========

        angle : Expr
            The angle by which the new system is to be rotated

        axis : Vector
            The axis around which the rotation has to be performed

        Examples
        ========

        >>> from sympy.vector import CoordSys3D
        >>> from sympy import symbols
        >>> q1 = symbols('q1')
        >>> N = CoordSys3D('N')
        >>> from sympy.vector import AxisOrienter
        >>> orienter = AxisOrienter(q1, N.i + 2 * N.j)
        >>> B = N.orient_new('B', (orienter, ))

        Nr   )r   r)   r*   s      r   Ú__init__zAxisOrienter.__init__(   s	   € ð8 	ˆr   c                 óÊ  — t           j                             | j        |¦  «                             ¦   «         }|                     |¦  «        }| j        }t          d¦  «        ||j        z  z
  t          |¦  «        z  t          d|d          |d         g|d         d|d          g|d          |d         dgg¦  «        t          |¦  «        z  z   ||j        z  z   }|j        }|S )zø
        The rotation matrix corresponding to this orienter
        instance.

        Parameters
        ==========

        system : CoordSys3D
            The coordinate system wrt which the rotation matrix
            is to be computed
        é   r   é   é   )r    r!   Úexpressr*   Ú	normalizeÚ	to_matrixr)   r   ÚTr   ÚMatrixr   )r   Úsystemr*   ÚthetaÚparent_orients        r   r   zAxisOrienter.rotation_matrixF   sã   € õ Œ|×#Ò# D¤I¨vÑ6Ô6×@Ò@ÑBÔBˆØ�~Š~˜fÑ%Ô%ˆØ”
ˆÝ˜a™&œ& 4¨$¬&¡=Ñ0µC¸±J´JÑ>Ý ! d¨1¤g X¨t°A¬wÐ!7Ø"& q¤'¨1¨t°A¬w¨hÐ!7Ø#'¨¤7 (¨D°¬G°QÐ!7ð!9ñ :ô :å<?À¹J¼JñGñGð  ¤™ñ	'ˆð
 &œˆØÐr   c                 ó   — | j         S ©N)r&   r   s    r   r)   zAxisOrienter.angle_   s
   € àŒ{Ðr   c                 ó   — | j         S r<   )r'   r   s    r   r*   zAxisOrienter.axisc   s
   € àŒzÐr   )r   r   r   r   r%   r.   r   r   Úpropertyr)   r*   Ú__classcell__©r,   s   @r   r   r      s¢   ø€ € € € € ðð ð	ð 	ð 	ð 	ð 	ðð ð ð< ðð ñ „Wðð0 ðð ñ „Xðð ðð ñ „Xðð ð ð ð r   r   c                   óz   ‡ — e Zd ZdZˆ fd„Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	ˆ xZ
S )ÚThreeAngleOrienterz3
    Super-class for Body and Space orienters.
    c           	      óÎ  •— t          |t          ¦  «        r|j        }d}|}t          |¦  «                             ¦   «         }t          |¦  «        dk    st          d¦  «        ‚d„ |D ¦   «         }d„ |D ¦   «         }d„ |D ¦   «         }d                     |¦  «        }||vrt          d¦  «        ‚t          |d	         ¦  «        }t          |d
         ¦  «        }t          |d         ¦  «        }	t          |¦  «        }t          |¦  «        }t          |¦  «        }| j
        r3t          ||¦  «        t          ||¦  «        z  t          |	|¦  «        z  }
n2t          |	|¦  «        t          ||¦  «        z  t          ||¦  «        z  }
|
j        }
t          ¦   «                              | |||t          |¦  «        ¦  «        }||_        ||_        ||_        ||_        |
|_        |S )N)Ú123Ú231Ú312Ú132Ú213Ú321Ú121Ú131Ú212Ú232Ú313Ú323Ú r0   z%rot_order should be a str of length 3c                 ó:   — g | ]}|                      d d¦  «        ‘ŒS )ÚXÚ1©Úreplace©Ú.0Úis     r   ú
<listcomp>z.ThreeAngleOrienter.__new__.<locals>.<listcomp>x   ó&   € Ð<Ð<Ð<¨Q�Q—Y’Y˜s CÑ(Ô(Ð<Ð<Ð<r   c                 ó:   — g | ]}|                      d d¦  «        ‘ŒS )ÚYÚ2rT   rV   s     r   rY   z.ThreeAngleOrienter.__new__.<locals>.<listcomp>y   rZ   r   c                 ó:   — g | ]}|                      d d¦  «        ‘ŒS )ÚZÚ3rT   rV   s     r   rY   z.ThreeAngleOrienter.__new__.<locals>.<listcomp>z   rZ   r   rP   zInvalid rot_type parameterr   r2   r1   )r   r   ÚnameÚstrÚupperÚlenr#   ÚjoinÚintr   Ú	_in_orderÚ_rotr6   r$   r%   Ú_angle1Ú_angle2Ú_angle3Ú
_rot_orderr   )r(   Úangle1Úangle2Úangle3Ú	rot_orderÚapproved_ordersÚoriginal_rot_orderÚa1Úa2Úa3r:   r+   r,   s               €r   r%   zThreeAngleOrienter.__new__m   sè  ø€ Ý�i¥Ñ%Ô%ð 	'Ø!œˆIð-ˆð 'ÐÝ˜	‘N”N×(Ò(Ñ*Ô*ˆ	Ý�I‘” !Ò#Ð#ÝÐCÑDÔDÐDØ<Ð<°)Ð<Ñ<Ô<ˆ	Ø<Ð<°)Ð<Ñ<Ô<ˆ	Ø<Ð<°)Ð<Ñ<Ô<ˆ	Ø—G’G˜IÑ&Ô&ˆ	Ø˜OÐ+Ð+ÝÐ8Ñ9Ô9Ð9Ý�˜1”ÑÔˆÝ�˜1”ÑÔˆÝ�˜1”ÑÔˆÝ˜‘”ˆÝ˜‘”ˆÝ˜‘”ˆØŒ=ð 	/Ý! " fÑ-Ô-Ý! " fÑ-Ô-ñ.å! " fÑ-Ô-ñ.ˆMˆMõ " " fÑ-Ô-Ý! " fÑ-Ô-ñ.å! " fÑ-Ô-ñ.ˆMð &œˆå‰gŒg�oŠoØ�˜ ­¨Y©¬ñ9ô 9ˆàˆŒØˆŒØˆŒØ+ˆŒØ*ˆÔàˆ
r   c                 ó   — | j         S r<   )ri   r   s    r   rm   zThreeAngleOrienter.angle1˜   ó
   € àŒ|Ðr   c                 ó   — | j         S r<   )rj   r   s    r   rn   zThreeAngleOrienter.angle2œ   rw   r   c                 ó   — | j         S r<   )rk   r   s    r   ro   zThreeAngleOrienter.angle3    rw   r   c                 ó   — | j         S r<   )rl   r   s    r   rp   zThreeAngleOrienter.rot_order¤   s
   € àŒÐr   )r   r   r   r   r%   r>   rm   rn   ro   rp   r?   r@   s   @r   rB   rB   h   s¯   ø€ € € € € ðð ð)ð )ð )ð )ð )ðV ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ð ð ð r   rB   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )ÚBodyOrienterz*
    Class to denote a body-orienter.
    Tc                 óB   — t                                | ||||¦  «        }|S r<   ©rB   r%   ©r(   rm   rn   ro   rp   r+   s         r   r%   zBodyOrienter.__new__°   ó'   € Ý ×(Ò(¨¨f°f¸fØ)2ñ4ô 4ˆàˆ
r   c                 ó   — dS )a’  
        Body orientation takes this coordinate system through three
        successive simple rotations.

        Body fixed rotations include both Euler Angles and
        Tait-Bryan Angles, see https://en.wikipedia.org/wiki/Euler_angles.

        Parameters
        ==========

        angle1, angle2, angle3 : Expr
            Three successive angles to rotate the coordinate system by

        rotation_order : string
            String defining the order of axes for rotation

        Examples
        ========

        >>> from sympy.vector import CoordSys3D, BodyOrienter
        >>> from sympy import symbols
        >>> q1, q2, q3 = symbols('q1 q2 q3')
        >>> N = CoordSys3D('N')

        A 'Body' fixed rotation is described by three angles and
        three body-fixed rotation axes. To orient a coordinate system D
        with respect to N, each sequential rotation is always about
        the orthogonal unit vectors fixed to D. For example, a '123'
        rotation will specify rotations about N.i, then D.j, then
        D.k. (Initially, D.i is same as N.i)
        Therefore,

        >>> body_orienter = BodyOrienter(q1, q2, q3, '123')
        >>> D = N.orient_new('D', (body_orienter, ))

        is same as

        >>> from sympy.vector import AxisOrienter
        >>> axis_orienter1 = AxisOrienter(q1, N.i)
        >>> D = N.orient_new('D', (axis_orienter1, ))
        >>> axis_orienter2 = AxisOrienter(q2, D.j)
        >>> D = D.orient_new('D', (axis_orienter2, ))
        >>> axis_orienter3 = AxisOrienter(q3, D.k)
        >>> D = D.orient_new('D', (axis_orienter3, ))

        Acceptable rotation orders are of length 3, expressed in XYZ or
        123, and cannot have a rotation about about an axis twice in a row.

        >>> body_orienter1 = BodyOrienter(q1, q2, q3, '123')
        >>> body_orienter2 = BodyOrienter(q1, q2, 0, 'ZXZ')
        >>> body_orienter3 = BodyOrienter(0, 0, 0, 'XYX')

        Nr   ©r   rm   rn   ro   rp   s        r   r.   zBodyOrienter.__init__µ   s
   € ðn 	ˆr   N©r   r   r   r   rg   r%   r.   r   r   r   r|   r|   ©   sC   € € € € € ðð ð €Iðð ð ð
7ð 7ð 7ð 7ð 7r   r|   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )ÚSpaceOrienterz+
    Class to denote a space-orienter.
    Fc                 óB   — t                                | ||||¦  «        }|S r<   r~   r   s         r   r%   zSpaceOrienter.__new__ö   r€   r   c                 ó   — dS )a¢  
        Space rotation is similar to Body rotation, but the rotations
        are applied in the opposite order.

        Parameters
        ==========

        angle1, angle2, angle3 : Expr
            Three successive angles to rotate the coordinate system by

        rotation_order : string
            String defining the order of axes for rotation

        See Also
        ========

        BodyOrienter : Orienter to orient systems wrt Euler angles.

        Examples
        ========

        >>> from sympy.vector import CoordSys3D, SpaceOrienter
        >>> from sympy import symbols
        >>> q1, q2, q3 = symbols('q1 q2 q3')
        >>> N = CoordSys3D('N')

        To orient a coordinate system D with respect to N, each
        sequential rotation is always about N's orthogonal unit vectors.
        For example, a '123' rotation will specify rotations about
        N.i, then N.j, then N.k.
        Therefore,

        >>> space_orienter = SpaceOrienter(q1, q2, q3, '312')
        >>> D = N.orient_new('D', (space_orienter, ))

        is same as

        >>> from sympy.vector import AxisOrienter
        >>> axis_orienter1 = AxisOrienter(q1, N.i)
        >>> B = N.orient_new('B', (axis_orienter1, ))
        >>> axis_orienter2 = AxisOrienter(q2, N.j)
        >>> C = B.orient_new('C', (axis_orienter2, ))
        >>> axis_orienter3 = AxisOrienter(q3, N.k)
        >>> D = C.orient_new('C', (axis_orienter3, ))

        Nr   r‚   s        r   r.   zSpaceOrienter.__init__û   s
   € ð` 	ˆr   Nrƒ   r   r   r   r…   r…   ï   sC   € € € € € ðð ð €Iðð ð ð
0ð 0ð 0ð 0ð 0r   r…   c                   ó€   ‡ — e Zd ZdZˆ fd„Zd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	ed„ ¦   «         Z
ˆ xZS )ÚQuaternionOrienterz0
    Class to denote a quaternion-orienter.
    c           	      ób  •— t          |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }t          |dz  |dz  z   |dz  z
  |dz  z
  d||z  ||z  z
  z  d||z  ||z  z   z  gd||z  ||z  z   z  |dz  |dz  z
  |dz  z   |dz  z
  d||z  ||z  z
  z  gd||z  ||z  z
  z  d||z  ||z  z   z  |dz  |dz  z
  |dz  z
  |dz  z   gg¦  «        }|j        }t          ¦   «                              | ||||¦  «        }||_        ||_        ||_        ||_        ||_	        |S )Nr1   )
r   r7   r6   r$   r%   Ú_q0Ú_q1Ú_q2Ú_q3r   )r(   Úq0Úq1Úq2Úq3r:   r+   r,   s          €r   r%   zQuaternionOrienter.__new__3  s—  ø€ Ý�R‰[Œ[ˆÝ�R‰[Œ[ˆÝ�R‰[Œ[ˆÝ�R‰[Œ[ˆÝ "¨¡'¨B°!©GÑ"3°b¸A±gÑ"=Ø"$¨¡'ñ#*à"# r¨B¡w°°b±Ñ'8Ñ"9Ø"# r¨B¡w°°b±Ñ'8Ñ"9ð";ð #$ r¨B¡w°°b±Ñ'8Ñ"9Ø"$¨¡'¨B°!©GÑ"3Ø"$¨¡'ñ#*Ø,.°!©Gñ#4à"# r¨B¡w°°b±Ñ'8Ñ"9ð";ð #$ r¨B¡w°°b±Ñ'8Ñ"9Ø"# r¨B¡w°°b±Ñ'8Ñ"9Ø"$¨¡'¨B°!©GÑ"3Ø"$¨¡'ñ#*Ø,.°!©Gñ#4ð"5ð!6ñ 7ô 7ˆð &œˆå‰gŒg�oŠo˜c 2 r¨2¨rÑ2Ô2ˆØˆŒØˆŒØˆŒØˆŒØ*ˆÔàˆ
r   c                 ó   — dS )a¨  
        Quaternion orientation orients the new CoordSys3D with
        Quaternions, defined as a finite rotation about lambda, a unit
        vector, by some amount theta.

        This orientation is described by four parameters:

        q0 = cos(theta/2)

        q1 = lambda_x sin(theta/2)

        q2 = lambda_y sin(theta/2)

        q3 = lambda_z sin(theta/2)

        Quaternion does not take in a rotation order.

        Parameters
        ==========

        q0, q1, q2, q3 : Expr
            The quaternions to rotate the coordinate system by

        Examples
        ========

        >>> from sympy.vector import CoordSys3D
        >>> from sympy import symbols
        >>> q0, q1, q2, q3 = symbols('q0 q1 q2 q3')
        >>> N = CoordSys3D('N')
        >>> from sympy.vector import QuaternionOrienter
        >>> q_orienter = QuaternionOrienter(q0, q1, q2, q3)
        >>> B = N.orient_new('B', (q_orienter, ))

        Nr   r‚   s        r   r.   zQuaternionOrienter.__init__O  s
   € ðJ 	ˆr   c                 ó   — | j         S r<   )r‹   r   s    r   r�   zQuaternionOrienter.q0v  ó	   € àŒxˆr   c                 ó   — | j         S r<   )rŒ   r   s    r   r�   zQuaternionOrienter.q1z  r•   r   c                 ó   — | j         S r<   )r�   r   s    r   r‘   zQuaternionOrienter.q2~  r•   r   c                 ó   — | j         S r<   )rŽ   r   s    r   r’   zQuaternionOrienter.q3‚  r•   r   )r   r   r   r   r%   r.   r>   r�   r�   r‘   r’   r?   r@   s   @r   r‰   r‰   .  s¾   ø€ € € € € ðð ðð ð ð ð ð8%ð %ð %ðN ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ð ð ð r   r‰   c                 óð   — | dk    r!t          t          |¦  «        j        ¦  «        S | dk    r!t          t          |¦  «        j        ¦  «        S | dk    r!t          t	          |¦  «        j        ¦  «        S dS )z)DCM for simple axis 1, 2 or 3 rotations. r2   r1   r0   N)r7   r   r6   r	   r
   )r*   r)   s     r   rh   rh   ‡  so   € àˆq‚y€yÝ•i Ñ&Ô&Ô(Ñ)Ô)Ð)Ø	�ŠˆÝ•i Ñ&Ô&Ô(Ñ)Ô)Ð)Ø	�ŠˆÝ•i Ñ&Ô&Ô(Ñ)Ô)Ð)ð 
ˆr   )Úsympy.core.basicr   Úsympy.core.sympifyr   Ú(sympy.functions.elementary.trigonometricr   r   Úsympy.matrices.denser   r   r	   r
   Úsympy.matrices.immutabler   r7   Úsympy.core.cacher   Úsympy.core.symbolr   Úsympy.vectorr    r   r   rB   r|   r…   r‰   rh   r   r   r   ú<module>r¢      sÛ  ðØ "Ð "Ð "Ð "Ð "Ð "Ø &Ð &Ð &Ð &Ð &Ð &Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ CÐ CÐ CÐ CÐ CÐ CØ $Ð $Ð $Ð $Ð $Ð $Ø !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð ð
#ð 
#ð 
#ð 
#ð 
#ˆuñ 
#ô 
#ð 
#ðMð Mð Mð Mð M�8ñ Mô Mð Mð`>ð >ð >ð >ð >˜ñ >ô >ð >ðBCð Cð Cð Cð CÐ%ñ Cô Cð CðL<ð <ð <ð <ð <Ð&ñ <ô <ð <ð~Vð Vð Vð Vð V˜ñ Vô Vð Vðr*ð *ð *ð *ð *r   