Ë
    7^(h.  ã                   óú   — 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y)é    )ÚBasic)Úsympify)ÚcosÚsin)ÚeyeÚ	rot_axis1Ú	rot_axis2Ú	rot_axis3)ÚImmutableDenseMatrix)Úcacheit)ÚStrNc                   ó   — e Zd ZdZd„ Zy)Ú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/skyplay_api_hub/venv/lib/python3.12/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                   óX   ‡ — 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__   sQ   ø€ Ü˜$¤§¡× 3Ñ 3Ô4ÜÐ5Ó6Ð6Ü˜“ˆä‰g‰o˜c 5¨$Ó/ˆØˆŒ
ØˆŒ	àˆ
r   c                  ó   — y)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                  |«      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¡I¨vÓ6×@Ñ@ÓBˆØ�~‰~˜fÓ%ˆØ—
‘
ˆÜ˜a›& 4¨$¯&©&¡=Ñ0´C¸³JÑ>Ü ! d¨1¡g X¨t°A©wÐ!7Ø"& q¡'¨1¨t°A©w¨hÐ!7Ø#'¨¡7 (¨D°©G°QÐ!7ð!9ó :ä<?À»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‰zÐr   )r   r   r   r   r%   r.   r   r   Úpropertyr)   r*   Ú__classcell__©r,   s   @r   r   r      sN   ø„ ñô	òð< ñó ðð0 ñó ðð ñó ôr   r   c                   ób   ‡ — 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        |«      j	                  «       }t        |«      dk(  st        d«      ‚|D �cg c]  }|j                  dd«      ‘Œ }}|D �cg c]  }|j                  dd«      ‘Œ }}|D �cg c]  }|j                  dd	«      ‘Œ }}d
j                  |«      }||vrt        d«      ‚t        |d   «      }t        |d   «      }	t        |d   «      }
t        |«      }t        |«      }t        |«      }| j                  r't        ||«      t        |	|«      z  t        |
|«      z  }n&t        |
|«      t        |	|«      z  t        ||«      z  }|j                  }t        ‰| �=  | |||t        |«      «      }||_        ||_        ||_        ||_        ||_        |S c c}w c c}w c c}w )N)Ú123Ú231Ú312Ú132Ú213Ú321Ú121Ú131Ú212Ú232Ú313Ú323Ú r0   z%rot_order should be a str of length 3ÚXÚ1ÚYÚ2ÚZÚ3rP   zInvalid rot_type parameterr   r2   r1   )r   r   ÚnameÚstrÚupperÚlenr#   ÚreplaceÚjoinÚintr   Ú	_in_orderÚ_rotr6   r$   r%   Ú_angle1Ú_angle2Ú_angle3Ú
_rot_orderr   )r(   Úangle1Úangle2Úangle3Ú	rot_orderÚapproved_ordersÚoriginal_rot_orderÚiÚa1Úa2Úa3r:   r+   r,   s                €r   r%   zThreeAngleOrienter.__new__m   sÉ  ø€ Ü�i¤Ô%Ø!Ÿ™ˆIð-ˆð 'ÐÜ˜	“N×(Ñ(Ó*ˆ	Ü�I“ !Ò#ÜÐCÓDÐDØ2;Ö<¨Q�Q—Y‘Y˜s CÕ(Ð<ˆ	Ð<Ø2;Ö<¨Q�Q—Y‘Y˜s CÕ(Ð<ˆ	Ð<Ø2;Ö<¨Q�Q—Y‘Y˜s CÕ(Ð<ˆ	Ð<Ø—G‘G˜IÓ&ˆ	Ø˜OÑ+ÜÐ8Ó9Ð9Ü�˜1‘ÓˆÜ�˜1‘ÓˆÜ�˜1‘ÓˆÜ˜“ˆÜ˜“ˆÜ˜“ˆØ�=Š=Ü! " fÓ-Ü! " fÓ-ñ.ä! " fÓ-ñ.‰Mô " " fÓ-Ü! " fÓ-ñ.ä! " fÓ-ñ.ˆMð &Ÿ™ˆä‰g‰oØ�˜ ¬¨Y«ó9ˆàˆŒØˆŒØˆŒØ+ˆŒØ*ˆÔàˆ
ùò= =ùÚ<ùÚ<s   ÁGÁ7GÂGc                 ó   — | j                   S r<   )r`   r   s    r   rd   zThreeAngleOrienter.angle1˜   ó   € à�|‰|Ðr   c                 ó   — | j                   S r<   )ra   r   s    r   re   zThreeAngleOrienter.angle2œ   ro   r   c                 ó   — | j                   S r<   )rb   r   s    r   rf   zThreeAngleOrienter.angle3    ro   r   c                 ó   — | j                   S r<   )rc   r   s    r   rg   zThreeAngleOrienter.rot_order¤   s   € à�‰Ðr   )r   r   r   r   r%   r>   rd   re   rf   rg   r?   r@   s   @r   rB   rB   h   s^   ø„ ñô)ðV ñó ðð ñó ðð ñó ðð ñó ôr   rB   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)ÚBodyOrienterz*
    Class to denote a body-orienter.
    Tc                 ó8   — t         j                  | ||||«      }|S r<   ©rB   r%   ©r(   rd   re   rf   rg   r+   s         r   r%   zBodyOrienter.__new__°   ó"   € Ü ×(Ñ(¨¨f°f¸fØ)2ó4ˆàˆ
r   c                  ó   — y)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   rd   re   rf   rg   s        r   r.   zBodyOrienter.__init__µ   s   € ðn 	r   N©r   r   r   r   r^   r%   r.   r   r   r   rt   rt   ©   s   „ ñð €Iòó
7r   rt   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)ÚSpaceOrienterz+
    Class to denote a space-orienter.
    Fc                 ó8   — t         j                  | ||||«      }|S r<   rv   rw   s         r   r%   zSpaceOrienter.__new__ö   rx   r   c                  ó   — y)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   rz   s        r   r.   zSpaceOrienter.__init__û   s   € ð` 	r   Nr{   r   r   r   r}   r}   ï   s   „ ñð €Iòó
0r   r}   c                   óh   ‡ — 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           	      ó   •— 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ˆð &Ÿ™ˆä‰g‰o˜c 2 r¨2¨rÓ2ˆØˆŒØˆŒØˆŒØˆŒØ*ˆÔàˆ
r   c                  ó   — y)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   rz   s        r   r.   zQuaternionOrienter.__init__O  s   € ðJ 	r   c                 ó   — | j                   S r<   )rƒ   r   s    r   r‡   zQuaternionOrienter.q0v  ó   € à�x‰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�   .  sc   ø„ ñôò8%ðN ñó ðð ñó ðð ñó ðð ñó ôr   r�   c                 óÖ   — | dk(  rt        t        |«      j                  «      S | dk(  rt        t        |«      j                  «      S | dk(  rt        t	        |«      j                  «      S y)z)DCM for simple axis 1, 2 or 3 rotations. r2   r1   r0   N)r7   r   r6   r	   r
   )r*   r)   s     r   r_   r_   ‡  s^   € àˆq‚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   rt   r}   r�   r_   r   r   r   ú<module>rš      sz   ðÝ "Ý &ß ?ß GÓ GÝ CÝ $Ý !Û ô
#ˆuô 
#ôM�8ô Mô`>˜ô >ôBCÐ%ô CôL<Ð&ô <ô~V˜ô Vór*r   