
    XhK                         d Z ddlmZ ddlmZmZ ddlmZmZm	Z	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mZ dd	lmZ dd
lmZ ddlmZ  edddgi          Z G d d          ZdS )zJ
This module can be used to solve probelsm related to 2D parabolic arches
    )sympify)Symbolsymbols)diffsqrtcossinatanradMin)Eq)solve)	Piecewise)plot)limit)doctest_depends_on)import_modulenumpyfromlistarange)import_kwargsc                   (   e Zd ZdZd Zed             Zed             Zed             Zed             Z	ed             Z
ed             Zdd
Zd ZddZddZddZd ZddZddZddZd Z ed          d             Zd Zd Zd Zd Zd	S )Archa  
    This class is used to solve problems related to a three hinged arch(determinate) structure.

    An arch is a curved vertical structure spanning an open space underneath it.

    Arches can be used to reduce the bending moments in long-span structures.


    Arches are used in structural engineering(over windows, door and even bridges)

    because they can support a very large mass placed on top of them.

    Example
    ========
    >>> from sympy.physics.continuum_mechanics.arch import Arch
    >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5)
    >>> a.get_shape_eqn
    5 - (x - 5)**2/5

    >>> from sympy.physics.continuum_mechanics.arch import Arch
    >>> a = Arch((0,0),(10,1),crown_x=6)
    >>> a.get_shape_eqn
    9/5 - (x - 6)**2/20
    c           	         d | _         t          |d                   t          |d                   f| _        t          |d                   t          |d                   f| _        d | _        d | _        d|v rt          |d                   | _        d|v rt          |d                   | _        | j        | _         i | _        i | _        | j        | j        d| _	        i | _
        ddd| _        d | _        d | _        t          d          dt          d	          dt          d
          dt          d          di| _        t!                      | _        t!                      | _        i | _        i | _        i | _        i | _        t/          d          | _        t/          d          | _        t/          d          | _        t/          d          | _        d | _        d | _        d | _        d S )Nr      crown_xcrown_y)concentrateddistributedhinge)leftrightR_A_xR_A_yR_B_xR_B_yr   T)
_shape_eqnr   _left_support_right_support_crown_x_crown_yget_shape_eqn_conc_loads_distributed_loads_loads_loads_applied	_supports_member_member_forcer   _reaction_forceset_points_disc_x_points_disc_y	_moment_x	_moment_y_load_x_load_yr   _moment_x_func_moment_y_func_load_x_func_load_y_func_bending_moment_shear_force_axial_force)selfleft_supportright_supportkwargss       x/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/sympy/physics/continuum_mechanics/arch.py__init__zArch.__init__&   s   &|A77Q8P8PQ 'a(8 9 9'-PQBR:S:ST#F9$566DM#F9$566DM,"$'+'7tG^__ !('::! &w6'??1fWooVWY_`gYhYhijk!ee!ee'11'11%h//%h//#      c                    | j         r| j         S t          d          \  }}}t          dd          }| j        r| j        r| j        }| j        }|||z
  dz  z  |z   |z
  }|                    || j        d         || j        d         i          }t          ||          }	|	d         ||z
  dz  z  |z   }|                    || j        d         i          | j        d         k    rt          d          n| j        r| j        }|||z
  dz  z  |z   |z
  }|                    || j        d         || j        d         i          }|                    || j        d         || j        d         i          }
t          ||
f||f          }	t          |	          dk     s|	|         dk    rt          d	          |	|         ||z
  dz  z  |	|         z   }|	|         | _        nt          d
          |S )z3returns the equation of the shape of arch developedzx y caF)positive   r   r   zQprovided coordinates of crown and supports are not consistent with parabolic archzYparabolic arch cannot be constructed with the provided coordinates, try providing crown_yz(please provide crown_x to construct arch)r(   r   r   r+   r,   subsr)   r   r*   
ValueErrorlenKeyError)rD   xycrL   x0y0parabola_eqneq1solutioneq2s              rH   r-   zArch.get_shape_eqnH   s$    ? 	#?"  !A3&&&= 	GT] 	G-BBadQY;+a/L##Qt'9!'<a@RST@U$VWWCcA''H#A;"qy025L  !D$7$:!;<<@STU@VVV !tuuu W ] 	G-BadQY;?Q.L##Qt'9!'<a@RST@U$VWWC##Qt':1'=qATUVAW$XYYCc#Y!u--H8}}a8A;!#3#3 !|}}}#A;"qy0(1+=L$QKDMM EFFFrJ   c                     | j         S )z\
        return the position of the applied load and angle (for concentrated loads)
        )r0   rD   s    rH   	get_loadszArch.get_loadsj   s    
 {rJ   c                     | j         S )z-
        Returns the type of support
        )r2   r]   s    rH   supportszArch.supportsq   s    
 ~rJ   c                     | j         S )z;
        Returns the position of the left support.
        )r)   r]   s    rH   rE   zArch.left_supportx   s    
 !!rJ   c                     | j         S )z<
        Returns the position of the right support.
        )r*   r]   s    rH   rF   zArch.right_support   s    
 ""rJ   c                     | j         S )z6
        return the reaction forces generated
        )r5   r]   s    rH   reaction_forcezArch.reaction_force   s    
 ##rJ   Nc           
      n   t          d          }t          d          }t          d          }	t          |          }t          |          }t          |          }|| j        v rt          d          |dv rt          d          |dk    r|||k     rt	          d	          |||d
| j        |<   | j                            |           || j        v rm| j        |xx         |t          ||          |z
  z  |	|t          ||          z   dz  z
  z  z  cc<   | j
        |xx         |t          ||          |z
  z  z  cc<   nW| t          ||          |z
  z  |	|t          ||          z   dz  z
  z  | j        |<   |t          ||          |z
  z  | j
        |<   d| j        |<   |dk    r|t          d          | j                            d|i          }
||
|t          t          |                    z  |t!          t          |                    z  ||d| j        |<   | j                            |           | j                            |           || j        v rd| j        |xx         | j        |         d         || j        |         d         z
  z  z  cc<   | j        |xx         | j        |         d         z  cc<   nM| j        |         d         || j        |         d         z
  z  | j        |<   | j        |         d         | j        |<   || j        v rS| j        |xx         | j        |         d         |	|z
  z  z  cc<   | j
        |xx         | j        |         d         z  cc<   n=| j        |         d          |	|z
  z  | j        |<   | j        |         d         | j
        |<   d| j        |<   dS dS )aN  
        This method adds load to the Arch.

        Parameters
        ==========

            order : Integer
                Order of the applied load.

                    - For point/concentrated loads, order = -1
                    - For distributed load, order = 0

            label : String or Symbol
                The label of the load
                - should not use 'A' or 'B' as it is used for supports.

            start : Float

                    - For concentrated/point loads, start is the x coordinate
                    - For distributed loads, start is the starting position of distributed load

            mag : Sympifyable
                Magnitude of the applied load. Must be positive

            end : Float
                Required for distributed loads

                    - For concentrated/point load , end is None(may not be given)
                    - For distributed loads, end is the end position of distributed load

            angle: Sympifyable
                The angle in degrees, the load vector makes with the horizontal
                in the counter-clockwise direction.

        Examples
        ========
        For applying distributed load

        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5)
        >>> a.apply_load(0,'C',start=3,end=5,mag=-10)

        For applying point/concentrated_loads

        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5)
        >>> a.apply_load(-1,'C',start=2,mag=15,angle=45)

        rT   rS   rV   z(load with the given label already exists)ABz1cannot use the given label, reserved for supportsr   Nzprovide end greater than start)startendf_yrN   r   z!please provide direction of force)rS   rT   f_xrj   maganglerl   rj   r   )r   r   r1   rP   rR   r/   r8   addr:   r   r<   	TypeErrorr(   rO   r   r   r	   r.   r7   r9   r;   )rD   orderlabelrh   rm   ri   rn   rT   rS   rV   heights              rH   
apply_loadzArch.apply_load   s   d 3KK3KKD\\u~~cllD'''GHHHIPQQQA::{c%ii?@@@6;3s-S-SD#E*##E***&&u%%%c!Cjj.>)?UCPQRUJJEWYZDZAZ)[[%%%U###sCAJJu,<'==####),c!Cjj.>(?UCPQRUJJEWYZDZAZ([u%&)3s1::e+;&<U#)6D&B;;} CDDD_))3u+66F+0fCCPUJJDW`cdghklqhrhrdsds`s{~  IN  'O  'ODU###E***##E***&&u%%%)9%)@)G4K[\aKbcfKgIg)hh%%%U###t'7'>u'EE####(,(8(?(F$JZ[`JabeJfHf(gu%&*&6u&=e&DU#&&u%%%)9%)@)GE)RR%%%U###t'7'>u'EE####)-)9%)@)G(GE(Ru%&*&6u&=e&DU#)7D&&&1 ;rJ   c           
      D   t          d          }t          d          }t          d          }|| j        v r
| j                            |           | j        |         d         }| j        |         d         }| j        |         d         }| j                            |           | j        |xx         |t          ||          |z
  z  z  cc<   | j        |xx         |t          ||          |z
  z  ||t          ||          z   dz  z
  z  z  cc<   | j                            |          }t          d| d	|            dS || j
        v rG| j                            |           | j
        |         d         }| j                            |           | j                            |           | j        |xx         | j
        |         d         ||z
  z  z  cc<   | j        |xx         | j
        |         d
         || j
        |         d         z
  z  z  cc<   | j        |xx         | j
        |         d
         z  cc<   | j        |xx         | j
        |         d         z  cc<   | j
                            |          }t          d| d	|            dS t          d          )a  
        This methods removes the load applied to the arch

        Parameters
        ==========

        label : String or Symbol
            The label of the applied load

        Examples
        ========

        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5)
        >>> a.apply_load(0,'C',start=3,end=5,mag=-10)
        >>> a.remove_load('C')
        removed load C: {'start': 3, 'end': 5, 'f_y': -10}
        rT   rS   rV   rh   ri   rj   rN   zremoved load : rl   zlabel not foundN)r   r/   r1   popr8   remover<   r   r:   printr.   r7   r9   r;   rP   )	rD   rr   rT   rS   rV   rh   ri   rm   vals	            rH   remove_loadzArch.remove_load   s   & 3KK3KKD\\D+++##E***+E27;E)%07C*51%8C&&u---L3Ac

5(8#99N5!!!S#a**U*:%;RAc

ASUV@V=V%WW!!!)--e44C0%0030011111d&&&##E***$U+C0E&&u---&&u---N5!!!T%5e%<U%CRX%NN!!!N5!!!T%5e%<U%CQtGWX]G^_bGcEc%dd!!!L4#3E#:5#AAL4#3E#:5#AA"&&u--C0%0030011111 .///rJ   c                     ||d         |d         f| _         ||d         |d         f| _        d| _        | j        | _        dS )a.  
        Change position of supports.
        If not provided , defaults to the old value.
        Parameters
        ==========

            left_support: tuple (x, y)
                x: float
                    x-coordinate value of the left_support

                y: float
                    y-coordinate value of the left_support

            right_support: tuple (x, y)
                x: float
                    x-coordinate value of the right_support

                y: float
                    y-coordinate value of the right_support
        Nr   r   )r)   r*   r(   r-   )rD   rE   rF   s      rH   change_support_positionzArch.change_support_position+  sQ    * #".q/,q/!BD$#0#3M!4D"ED,rJ   c                 H    || _         || _        d| _        | j        | _        dS )a  
        Change the position of the crown/hinge of the arch

        Parameters
        ==========

            crown_x: Float
                The x coordinate of the position of the hinge
                - if not provided, defaults to old value

            crown_y: Float
                The y coordinate of the position of the hinge
                - if not provided defaults to None
        N)r+   r,   r(   r-   )rD   r   r   s      rH   change_crown_positionzArch.change_crown_positionI  s'      ,rJ   c                     ddg}|r||vrt          d          || j        d<   |r||vrt          d          || j        d<   dS dS )a  
        Add the type for support at each end.
        Can use roller or hinge support at each end.

        Parameters
        ==========

            left_support, right_support : string
                Type of support at respective end

                    - For roller support , left_support/right_support = "roller"
                    - For hinged support, left_support/right_support = "hinge"
                    - defaults to hinge if value not provided

        Examples
        ========

        For applying roller support at right end

        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5)
        >>> a.change_support_type(right_support="roller")

        rollerr    z%supports must only be roller or hinger!   r"   N)rP   r2   )rD   rE   rF   support_typess       rH   change_support_typezArch.change_support_type]  sz    2 "'* 	2=00 !HIII%1DN6" 	4M11 !HIII&3DN7###		4 	4rJ   c                    || j         k    s*|t          | j        d         | j        d                   k     r>t	          dt          | j        d         | j        d                    d| j                    t          d          }t          | j        |                              || j	        dz             dz  }t          || j         z
  |z            }| j	        |z   }| j	        |z
  }|||f| _        dS )z
        This method adds a member/rod at a particular height y.
        A rod is used for stability of the structure in case of a roller support.
        r   z&position of support must be between y=z and y=rS   rN   N)r,   minr)   r*   rP   r   r   r(   rO   r+   r   r3   )rD   rT   rS   rL   x_diffx1x2s          rH   
add_memberzArch.add_member  s   
 T]??aD$6q$9D<OPQ<R S SSS  Rc$J\]^J_bfbuvwbxFyFy  R  R  CG  CP  R  R  S  S  S3KK##((4=?;;A=q4=(!+,,]V#]V#2ayrJ   c                     || j         S t          d          }d|v r |d         }t          | j         |||          S | j                             ||          S )zl
        return the shear at some x-coordinates
        if no x value provided, returns the formula
        NrS   dirr   )rB   r   r   rO   rD   posrG   rS   r   s        rH   shear_force_atzArch.shear_force_at  b    
 ;$$sAUmT.q====$))!C000rJ   c                     || j         S t          d          }d|v r |d         }t          | j         |||          S | j                             ||          S )zu
        return the bending moment at some x-coordinates
        if no x value provided, returns the formula
        NrV   r   r   )rA   r   r   rO   )rD   r   rG   rV   r   s        rH   bending_moment_atzArch.bending_moment_at  sb    
 ;''BUmT1"SSAAAA',,R444rJ   c                     || j         S t          d          }d|v r |d         }t          | j         |||          S | j                             ||          S )z
        return the axial/normal force generated at some x-coordinate
        if no x value provided, returns the formula
        NrS   r   r   )rC   r   r   rO   r   s        rH   axial_force_atzArch.axial_force_at  r   rJ   c                    t          d          }t          d          }t          d          }t          | j                  }t          | j                  }t	          d          | _        t	          d          | _        t	          d          | _        t	          d          | _        d}d}d}d}	|D ]d}
||
k    }|| j	        |
         z  }|| j
        |
         z  }t	          ||f| j        df          | _        t	          ||f| j        df          | _        e|D ]d}
||
k    }|| j        |
         z  }|	| j        |
         z  }	t	          |	|f| j        df          | _        t	          ||f| j        df          | _        e| j                            || j        d                                       || j        d                   | j                            || j        d                                       || j        d                   z   }| j                            || j                                      || j                  | j                            || j                                      || j                  z   }| j                            || j        d                                       || j                  | j                            || j                                      || j                  z
  | j                            || j        d                                       || j                  z   | j                            || j                                      || j                  z
  }| j                            || j        d                   }| j                            || j        d                   }| j        d         d	k    s| j        d
         d	k    r| j        st)          d           dS t+          d          \  }}}}}| j        d         d	k    r| j        d
         d	k    r| j        d         t-          | j        d         | j        d                   k    r|dk    rt/          d          t1          |d          }t1          |d          }t1          ||z   |z   d          }t1          || j        d         | j        d         z
  z  || j        d         | j        d         z
  z  z
  |z   d          }t1          ||| j        d         | j        z
  z  z   || j        d         | j        z
  z  z   d          }t3          |||||f|||||f          }n| j        d         | j        d         k    rt1          |d          }t1          |d          }t1          ||z   |z   d          }t1          || j        d         | j        d         z
  z  || j        d         | j        d         z
  z  z
  |z   d          }t1          ||z   d          }t3          |||||f|||||f          }n| j        d         | j        d         k    rt1          |d          }t1          |d          }t1          ||z   |z   d          }t1          || j        d         | j        d         z
  z  || j        d         | j        d         z
  z  z   |z   d          }t1          ||z
  d          }t3          |||||f|||||f          }n(| j        d         d	k    rH| j        d         t-          | j        d         | j        d                   k    rt1          |d          }t1          ||z   d          }t1          ||z   |z   d          }t1          || j        d         | j        d         z
  z  || j        d         | j        d         z
  z  z
  |z   d          }t1          ||| j        d         | j        z
  z  z   || j        d         | j        z
  z  z
  d          }t3          |||||f|||||f          }n| j        d         | j        d         k    rt1          |d          }t1          ||z   |z   d          }t1          ||z   |z   d          }t1          || j        d         | j        d         z
  z  || j        d         | j        d         z
  z  z
  || j        d         | j        d         z
  z  z
  |z   d          }t1          ||| j        d         | j        z
  z  z   || j        d         | j        z
  z  z
  d          }t3          |||||f|||||f          }n| j        d         | j        d         k    rt1          |d          }t1          ||z
  |z   d          }t1          ||z   |z   d          }t1          ||| j        d         | j        z
  z  z   d          }t1          ||| j        d         | j        d         z
  z  z   || j        d         | j        d         z
  z  z
  || j        d         | j        d         z
  z  z   d          }t3          |||||f|||||f          }n| j        d
         d	k    r| j        d         t-          | j        d         | j        d                   k    rt1          |d          }t1          ||z   d          }t1          ||z   |z   d          }t1          ||| j        d         | j        z
  z  z   || j        d         | j        z
  z  z   d          }t1          ||| j        d         | j        d         z
  z  z   d          }t3          |||||f|||||f          }n| j        d         | j        d         k    rt1          |d          }t1          ||z   |z   d          }t1          ||z   |z   d          }t1          ||| j        d         | j        z
  z  z   d          }t1          ||| j        d         | j        d         z
  z  z
  || j        d         | j        d         z
  z  z   d          }t3          |||||f|||||f          }n| j        d         | j        d         k    rt1          |d          }t1          ||z
  |z   d          }t1          ||z   |z   d          }t1          ||| j        d         | j        z
  z  z   || j        d         | j        z
  z  z   d          }t1          ||| j        d         | j        d         z
  z  z   || j        d         | j        d         z
  z  z             }t3          |||||f|||||f          }nt1          ||z   |z   d          }t1          ||z   |z   d          }t1          || j        d         | j        d         z
  z  || j        d         | j        d         z
  z  z
  |z   d          }t1          ||| j        d         | j        z
  z  z   || j        d         | j        z
  z  z
  d          }t3          ||||f||||f          }| j        D ]}||         | j        |<   | j                            ||          | j                            ||          z   ||         || j        d         z
  z  z
  ||         | j                            ||i          | j        d         z
  z  z    | _        t;          t=          | j        |                    }| j        ||         z   }| j        ||         z   }|t?          |          z  |tA          |          z  z   } | tA          |          z  |t?          |          z  z   }!| | _!        |!| _"        dS )a  
        This method solves for the reaction forces generated at the supports,

        and bending moment and generated in the arch and tension produced in the member if used.

        Examples
        ========

        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5)
        >>> a.apply_load(0,'C',start=3,end=5,mag=-10)
        >>> a.solve()
        >>> a.reaction_force
        {R_A_x: 8, R_A_y: 12, R_B_x: -8, R_B_y: 8}

        >>> from sympy import Symbol
        >>> t = Symbol('t')
        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(16,0),crown_x=8,crown_y=5)
        >>> a.apply_load(0,'C',start=3,end=5,mag=t)
        >>> a.solve()
        >>> a.reaction_force
        {R_A_x: -4*t/5, R_A_y: -3*t/2, R_B_x: 4*t/5, R_B_y: -t/2}

        >>> a.bending_moment_at(4)
        -5*t/2
        rT   rS   rV   r'   r   Tr   r!   r   r"   z5member must be added if any of the supports is rollerNzR_A_x R_A_y R_B_x R_B_y TrN   zDnet force in x direction not possible under the specified conditions)#r   sortedr7   r8   r   r=   r>   r?   r@   r;   r9   r:   r<   rO   r*   r)   r+   r,   r2   r3   ry   r   maxrP   r   r   r5   r(   rA   r
   r   r   r	   rC   rB   )"rD   rT   rS   rV   discontinuity_points_xdiscontinuity_points_yaccumulated_x_momentaccumulated_y_momentaccumulated_x_loadaccumulated_y_loadpointcondmoment_Amoment_hinge_leftmoment_hinge_rightnet_xnet_yr#   r$   r%   r&   TrY   r[   eq3eq4eq5rZ   symbrn   fxfyaxial_forceshear_forces"                                     rH   r   z
Arch.solve  s   6 3KK3KKD\\!'(;!<!<!'(;!<!<'11'11%h//%h//  + 	d 	dEJD$,u"55 DN5$99  )+=d*CTEVW[D\ ] ]D"+-A$,GI\]aHb"c"cD+ 	d 	dEJD DN5$99 $,u"55 )+=d*CTEVW[D\ ] ]D"+-A$,GI\]aHb"c"cD&++Ad.A!.DEEJJ2dN`abNcdd&++Ad.A!.DEEJJ1TM_`aMbccd !/44Qt}EEJJ2dm\\ /44Qt}EEJJ1T][[\ "055a8KA8NOOTTUWX\Xeff!055aFFKKBt}]]^!055a8KA8NOOTTUVW[Wdeef "055aFFKKAdm\\]
 !&&q)<Q)?@@!&&q)<Q)?@@N6"H,,w0G0Q0Q[_[g0QIJJJF(/0K(L(L%ueUA>&!X--$.2IX2U2U|AD$6q$9$:Ma:P Q QQQ!88$%klll UA,,CUA,,CUU]U2155CUD$7$:4;Ma;P$PQ"D$7$:4;Ma;P$PQRRZ[[\^ ^C /%9LQ9OPTP]9]2^^Q =>??@B BC$c#c#c%:E%eTU;VWWHHa$"4Q"777llll.q11 3A 6t7I!7L LMDLOD,>q,AABCCKLLMO O5mm #c#c#!6eE%PQ7RSSa$"5a"888llll.q11 3A 6t7I!7L LMDLOD,>q,AABCCKLLMO O5mm #c#c#!6eE%PQ7RSS^F#x//|AD$6q$94;Nq;Q R RRRlluQ''.q11 3A 6t7I!7L LM 3A 6t7I!7L LMNNVWWXZ Z*UD4Fq4I$-4W-XXDLODM9:;;<> > #c#c#!6eE%PQ7RSSa$"4Q"777ll5++.q11 3A 6t7I!7L LM 3A 6t7I!7L LMNDLOD,>q,AABCCKLLMO O *UD4Fq4I$-4W-XXDLODM9:;;<> > #c#c#!6eE%PQ7RSSa$"5a"888qkk5++.q11*5$2DQ2G2U+VVWXYY%)<Q)?@RST@U)U"VV 3A 6t7I!7L LMNDLOD,>q,AABCCDF F !#c#c#!6eE%PQ7RSS^G$00|AD$6q$94;Nq;Q R RRRqkkuQ''uU*1--+E43Fq3I$-3W,XXDLODM9:;;<> >%)<Q)?@RST@U)U"VVWXYY #c#c#!6eE%PQ7RSSa$"4Q"777qkkqq))uU*1--+E43Fq3I$-3W,XXYZ[[!T\!_T5G5J%J"KK 3A 6t7I!7L LMNNOQ Q #c#c#!6eE%PQ7RSSa$"5a"888qkkqq))uU*1--+E43Fq3I$-3W,XXDLODM9:;;<> >!T\!_T5G5J%J"KK 3A 6t7I!7L LMN O O #c#c#!6eE%PQ7RSSUU]U*1--CUU]U*1--CUD/243Ea3HHID/243Ea3HHIJJRSSTV VC'%1DQ1G1U*VVD/24=@ABBCE ECc#c#.eE%/HIIH( 	8 	8D)1$D &&"&"5":":1R"@"@4CVC[C[\]^`CaCa"a"*5/2d6H6K3K"L#M"*5/4?3G3G23O3OPTPbcdPe3e"f#g  h d4?1--..//UmbUm3c#e**nr#e**}4''rJ   )r   )modulesc                    t          d          }g }|                                 }g }|                                 }||z  }| j        d         }| j        d         }t          | j        d         | j        d                   }| j        }	t          |dz  |dz  z
  dz   |	dz  |dz  z
  dz             }
|                                 }| 	                                }||z  }| j
        | j
        d         | j        d         k    r;|                    | j
        d         d|
z  z   g| j
        d         ggd	d
ddd           | j
        d         | j        d         k    r;|                    | j
        d         d|
z  z
  g| j
        d         ggd	d
ddd           |                    | j        g| j        d|
z  z
  ggd	dddd           |
|dz  |dz  z
  dz   k    rZt          | j        d|
z  z
  | j        || j        d         | j        d         f|d|||d|
z  z
  |dz  f|d|
z  z
  |dz  fdd          }nYt          | j        d|
z  z
  | j        || j        d         | j        d         f|d|||d|
z  z
  |	dz  f|d|
z  z
  |	dz  fdd          }|S )a7  
        This method returns a plot object containing the diagram of the specified arch along with the supports
        and forces applied to the structure.

        Examples
        ========

        >>> from sympy import Symbol
        >>> t = Symbol('t')
        >>> from sympy.physics.continuum_mechanics.arch import Arch
        >>> a = Arch((0,0),(40,0),crown_x=20,crown_y=12)
        >>> a.apply_load(-1,'C',8,150,angle=270)
        >>> a.apply_load(0,'D',start=20,end=40,mag=-4)
        >>> a.apply_load(-1,'E',10,t,angle=300)
        >>> p = a.draw()
        >>> p # doctest: +ELLIPSIS
        Plot object containing:
        [0]: cartesian line: 11.325 - 3*(x - 20)**2/100 for x over (0.0, 40.0)
        [1]: cartesian line: 12 - 3*(x - 20)**2/100 for x over (0.0, 40.0)
        ...
        >>> p.show()

        rS   r   r   皙?皙?NrN   {Gzt?o   whitenoneargsmarker
markersizecolormarkerfacecolor   Q?F皙?brown)markersshowannotations
rectanglesxlimylimaxis
line_color)r   _draw_loads_draw_supportsr*   r)   r   r,   r   _draw_rectangles_draw_fillerr3   appendr+   r   r(   )rD   rS   r   r   r   r`   xmaxxminyminymaxlimfiller	sing_plots                rH   drawz	Arch.draw  s%   2 3KK&&((
&&(("1%!!$4%a()<Q)?@@}$s(48#A%tCxS'8':;;**,,
""$$F
<#|A 3A 666!%as!: ;T\!_<MN!$&'!(*0    |A 21 555!%as!: ;T\!_<MN!$&'!(*0    	]OT]59%<$=>$
 
 	 	 	 Sc!!###T_U3Y6!_!3A!68KA8NO%,"')4*4#'S=$s(";#'S=$s(";"'(/
1 
1 
1II T_U3Y6!_!3A!68KA8NO%,"')4*4#'S=$s(";#'S=$s(";"'(/
1 
1 
1I rJ   c                 6   g }| j         d         }| j        d         }t          | j        d         | j         d                   }| j        }t	          d|z  d|z  z
            t	          d|z  d|z  z
            k    rd|z  d|z  z
  }nd|z  d|z  z
  }| j        d         dk    r<|                    | j        d         g| j        d         d|z  z
  ggdd	d
dd           n;|                    | j        d         g| j        d         d|z  z
  ggddd
dd           | j        d         dk    r<|                    | j         d         g| j         d         d|z  z
  ggdd	d
dd           n;|                    | j         d         g| j         d         d|z  z
  ggddd
dd           |                    | j         d         g| j         d         d|z  z
  ggddd
dd           |                    | j        d         g| j        d         d|z  z
  ggddd
dd           |S )Nr   r   r   r   r!   r   g{Gz?r      blackr   r   gy&1|?      r"   g;On?_)r*   r)   r   r,   absr2   r   )rD   support_markersr   r   r   r   max_diffs          rH   r   zArch._draw_supports  s
   "1%!!$4%a()<Q)?@@}s4xD !!#c$hs4x&7"8"8884xD(HH4xD(H>&!8++"" +A./+A.tH}<= !!##&,	 	    "" +A./+A.uX~=> !##&,	 	   >'"H,,"" ,Q/0,Q/X=> !!##&,	 	    "" ,Q/0,Q/h>? !##&,	 	   	 (+,(+E(N:; "(	 		
 	
 	
 	 '*+'*5>9: "(	 		
 	
 	
 rJ   c                    g }| j         d         }| j        d         }t          | j        d         | j         d                   }| j        }t	          d|z  d|z  z
            t	          d|z  d|z  z
            k    rd|z  d|z  z
  }nd|z  d|z  z
  }| j        _| j        d         t          | j        d         | j         d                   k    rV|                    | j        d         | j        d         d|z  z
  f| j        d         | j        d         z
  d|z  ddd	           n| j        d         | j        d         k    rV|                    | j        d         | j        d         d|z  z
  f| j         d         | j        d         z
  d|z  ddd	           nb|                    | j        d         | j        d         d|z  z
  ft	          | j        d         | j        d         z
            d|z  d
dd	           | j        r]| j        D ]U}| j        |         d         }| j        |         d         }	|                    || j        |dz  z   f|	|z
  |dz  dd           V|S )Nr   r   r   r   rN   r   g{Gz?r   )xywidthrs   rn   r      rh   ri   333333?oranger   r   rs   r   )	r*   r)   r   r,   r   r3   r   r   r/   )
rD   memberr   r   r   r   r   loadsrh   ri   s
             rH   r   zArch._draw_rectanglesR  s   "1%!!$4%a()<Q)?@@}s4xD !!#c$hs4x&7"8"8884xD(HH4xD(H<#|AT%7%:4;Nq;Q!R!RRR"l1odl1oeHn.LM $QQ ?"&x-!" '     a$"4Q"777"l1odl1oeHn.LM $ 3A 6t|A F"&x-!" '     "l1odl1oeHn.LM #D$6q$9$,q/$I J J"&x-!$ '    " 	0  /6w?-e4U;#DM(4-$?@"%e)"*4-!)	     rJ   c                    g }| j         d         }| j        d         }t          | j        d         | j         d                   }| j        }t	          d|z  d|z  z
            t	          d|z  d|z  z
            k    rd|z  d|z  z
  }nd|z  d|z  z
  }| j        D ]#}| j        |         d         }| j        |         d         }	| j        |         d         }
| j        |         d         }|                    d	|t          t          |
                    |z  d
z  z   |	t          t          |
                    |z  d
z  z   f||	fddddddddd           |                    | d| ddd|t          t          |
                    |z  dz  z   |	t          t          |
                    |z  dz  z   fd           %| j
        D ]}| j
        |         d         }| j
        |         d         }| j
        |         d         }t                              ||||z
  |dz  z            }t                              ||          }|D ]}}|dk     r;|                    d	|| j        |dz  z   f|| j        |dz  z   fddddddd           C|                    d	|| j        |dz  z   f|| j        |dz  z   fddddddd           ~|dk     rB|                    | dt	          |           ddd||z   d z  | j        |d!z  z   fd           D|                    | dt	          |           ddd||z   d z  | j        |d"z  z   fd           |S )#Nr   r   r   r   rS   rT   rn   rm    g{Gz?
   boldg      ?r   blue)r   
headlength	headwidth	facecolor	edgecolor)textr   xytextfontsize
fontweight
arrowpropsrv   z NgQ?)r   r   r   r   rh   ri   rj   g      ?r   r   r   )r   r   r   r   g?z N/mrN   gffffff?g      ?)r*   r)   r   r,   r   r.   r   r   r   r	   r/   r   r   )rD   load_annotationsr   r   r   r   r   loadrS   rT   rn   rm   rh   ri   x_pointsr   s                   rH   r   zArch._draw_loads  sM   "1%!!$4%a()<Q)?@@}s4xD !!#c$hs4x&7"8"8884xD(HH4xD(H$ 	 	D &s+A &s+A$T*73E"4(/C###c%jj//(2477#c%jj//(2477  U!"(*-A1Z`ms!t!t
 
   ##"--c---!"(SU__X5d::1SU__X=UVZ=Z;Z[	     + *	 *	D+D1':E)$/6C)$/6C||E#s5y8D=.IJJH||HS11H!  q55$++#%"'htm(C!D',T]8D=-H&I25ASTbjw  *A  *A	     %++#%"'hsl(B!C',T]8D=-H&I25ASTbjw  *A  *A	     1uu ''"&88#c((888#%&,$Sy!mDM(5.,HI	     !''"&88#c((888#%&,$Sy!mDM(5.,HI	      rJ   c                    t          d          }g }| j        d         }| j        d         }t          | j        d         | j        d                   }| j        }t          d|z  d|z  z
            t          d|z  d|z  z
            k    rd|z  d|z  z
  }nd|z  d|z  z
  }t                              | j        d         | j        d         | j        d         | j        d         z
  ||z  z            }|D ]_}	|                    |	| j	        
                    ||	          |dz  z
  f| j        d         | j        d         z
  ||z  z  |dz  dd           `|S )	NrS   r   r   r   r   r   r   r   )r   r*   r)   r   r,   r   r   r   r   r(   rO   )
rD   rS   r   r   r   r   r   r   r   r   s
             rH   r   zArch._draw_filler  s   3KK"1%!!$4%a()<Q)?@@}s4xD !!#c$hs4x&7"8"8884xD(HH4xD(H<< 21 5d6I!6LdNabcNdeiewxyezNz  ~F  GO  ~O  NP  Q  Q 	 	EMM#DO$8$85$A$A(5.$PQ"&"5a"89KA9N"NQYZbQb!c"*5.!(	     rJ   )NN)N)__name__
__module____qualname____doc__rI   propertyr-   r^   r`   rE   rF   rd   rt   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r    rJ   rH   r   r      s        (! ! !D   XB   X   X " " X" # # X# $ $ X$h8 h8 h8 h8V10 10 10f- - - -<- - - -($4 $4 $4 $4L! ! !1 1 1 15 5 5 51 1 1 1J( J( J(X 
+++g g ,+gT] ] ]~? ? ?BS  S  S j    rJ   r   N)r   sympy.core.sympifyr   sympy.core.symbolr   r   sympyr   r   r   r	   r
   r   r   sympy.core.relationalr   sympy.solvers.solversr   sympy.functionsr   sympy.plottingr   r   sympy.utilities.decoratorr   sympy.external.importtoolsr   r   r   r   rJ   rH   <module>r	     sF    ' & & & & & , , , , , , , , 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 $ $ $ $ $ $ ' ' ' ' ' ' % % % % % %             8 8 8 8 8 8 4 4 4 4 4 4gj(-DEEEp p p p p p p p p prJ   