
    g              
           d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	 g dZ
 G d de eddd	g                    Z G d
 de          Z G d de          Zd Zd ZdS )    )ABC)
namedtuple)BodyBase)VectorReferenceFramePoint)LoadBaseForceTorquec                   &    e Zd ZdZd Zd ZeZeZdS )r	   z2Abstract base class for the various loading types.c                 V    t          d| j        j         d|j        j         d          )Nz$unsupported operand type(s) for +: '' and ''	TypeError	__class____name__selfothers     Y/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/physics/mechanics/loads.py__add__zLoadBase.__add__   B     8 N38 8!O48 8 8 9 9 	9    c                 V    t          d| j        j         d|j        j         d          )Nz$unsupported operand type(s) for *: 'r   r   r   r   s     r   __mul__zLoadBase.__mul__   r   r   N)r   
__module____qualname____doc__r   r   __radd____rmul__ r   r   r	   r	   	   s>        <<9 9 9
9 9 9
 HHHHr   r	   locationvectorc                   T     e Zd ZdZ fdZd Zed             Zed             Z xZ	S )r
   a+  Force acting upon a point.

    Explanation
    ===========

    A force is a vector that is bound to a line of action. This class stores
    both a point, which lies on the line of action, and the vector. A tuple can
    also be used, with the location as the first entry and the vector as second
    entry.

    Examples
    ========

    A force of magnitude 2 along N.x acting on a point Po can be created as
    follows:

    >>> from sympy.physics.mechanics import Point, ReferenceFrame, Force
    >>> N = ReferenceFrame('N')
    >>> Po = Point('Po')
    >>> Force(Po, 2 * N.x)
    (Po, 2*N.x)

    If a body is supplied, then the center of mass of that body is used.

    >>> from sympy.physics.mechanics import Particle
    >>> P = Particle('P', point=Po)
    >>> Force(P, 2 * N.x)
    (Po, 2*N.x)

    c                    t          |t                    r|j        }t          |t                    st	          d          t          |t
                    st	          d          t                                          | ||          S )Nz!Force location should be a Point.z Force vector should be a Vector.)
isinstancer   
masscenterr   r   r   super__new__)clspointforcer   s      r   r*   zForce.__new__:   s{    eX&& 	%$E%'' 	A?@@@%(( 	@>???wwsE5111r   c                 @    | j         j         d| j         d| j         dS )Nz(point=z, force=))r   r   r,   r-   r   s    r   __repr__zForce.__repr__C   s;    >* ' '4: ' '' ' ' 	(r   c                     | j         S Nr#   r0   s    r   r,   zForce.pointG   
    }r   c                     | j         S r3   r$   r0   s    r   r-   zForce.forceK   
    {r   )
r   r   r   r   r*   r1   propertyr,   r-   __classcell__r   s   @r   r
   r
      s         >2 2 2 2 2( ( (   X   X    r   r
   c                   T     e Zd ZdZ fdZd Zed             Zed             Z xZ	S )r   a  Torque acting upon a frame.

    Explanation
    ===========

    A torque is a free vector that is acting on a reference frame, which is
    associated with a rigid body. This class stores both the frame and the
    vector. A tuple can also be used, with the location as the first item and
    the vector as second item.

    Examples
    ========

    A torque of magnitude 2 about N.x acting on a frame N can be created as
    follows:

    >>> from sympy.physics.mechanics import ReferenceFrame, Torque
    >>> N = ReferenceFrame('N')
    >>> Torque(N, 2 * N.x)
    (N, 2*N.x)

    If a body is supplied, then the frame fixed to that body is used.

    >>> from sympy.physics.mechanics import RigidBody
    >>> rb = RigidBody('rb', frame=N)
    >>> Torque(rb, 2 * N.x)
    (N, 2*N.x)

    c                    t          |t                    r|j        }t          |t                    st	          d          t          |t
                    st	          d          t                                          | ||          S )Nz+Torque location should be a ReferenceFrame.z!Torque vector should be a Vector.)r'   r   framer   r   r   r)   r*   )r+   r>   torquer   s      r   r*   zTorque.__new__o   sz    eX&& 	 KE%00 	KIJJJ&&)) 	A?@@@wwsE6222r   c                 @    | j         j         d| j         d| j         dS )Nz(frame=z	, torque=r/   )r   r   r>   r?   r0   s    r   r1   zTorque.__repr__x   s;    >* ) )4: ) )+) ) ) 	*r   c                     | j         S r3   r4   r0   s    r   r>   zTorque.frame|   r5   r   c                     | j         S r3   r7   r0   s    r   r?   zTorque.torque   r8   r   )
r   r   r   r   r*   r1   r9   r>   r?   r:   r;   s   @r   r   r   P   s         <3 3 3 3 3* * *   X   X    r   r   c                     g }|D ]f}t          |t                    st          t          |           d          |                    t          |j        |j        | z                       g|S )a  
    Returns a list of gravity forces given the acceleration
    due to gravity and any number of particles or rigidbodies.

    Example
    =======

    >>> from sympy.physics.mechanics import ReferenceFrame, Particle, RigidBody
    >>> from sympy.physics.mechanics.loads import gravity
    >>> from sympy import symbols
    >>> N = ReferenceFrame('N')
    >>> g = symbols('g')
    >>> P = Particle('P')
    >>> B = RigidBody('B')
    >>> gravity(g*N.y, P, B)
    [(P_masscenter, P_mass*g*N.y),
     (B_masscenter, B_mass*g*N.y)]

    z is not a body type)r'   r   r   typeappendr
   r(   mass)accelerationbodiesgravity_forcebodys       r   gravityrK      sz    * M O O$)) 	@tDzz>>>???U4?DI4LMMNNNNr   c                    t          | t                    r| S t          | t                    rt          |           dk    rt	          d|  d          t          | d         t
                    rt          | d         | d                   S t          | d         t                    rt          | d         | d                   S t	          d| d          d          t          dt          |            d	          )
zBHelper function to parse loads and convert tuples to load objects.   zLoad z should have a length of 2.r      z'Load not recognized. The load location z. should either be a Point or a ReferenceFrame.z
Load type zA not recognized as a load. It should be a Force, Torque or tuple.)r'   r	   tuplelen
ValueErrorr   r
   r   r   r   rD   )loads    r   _parse_loadrS      s   $!! P	D%	 	  	Pt99>>FTFFFGGGd1gu%% 	Pa$q'***Q00 	P$q'47+++ OtAw O O O P P P
 ;d ; ; ; < < <r   N)abcr   collectionsr   !sympy.physics.mechanics.body_baser   sympy.physics.vectorr   r   r   __all__r	   r
   r   rK   rS   r"   r   r   <module>rY      s         " " " " " " 6 6 6 6 6 6 > > > > > > > > > >
)
)
)    sJJzJ+ABB   "3 3 3 3 3H 3 3 3l2 2 2 2 2X 2 2 2j  :< < < < <r   