U
    Ē-e<  ć                   @   sģ   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZmZmZmZmZmZmZmZmZmZ d dlmZmZmZmZm Z  d dl!m"Z" d d	l#m$Z$ d
d Z%dd Z&dd Z'dd Z(dd Z)dd Z*dS )é    )Ś
DerivativeŚFunction)ŚS)ŚSymbol)ŚexpŚcosŚsinŚtanŚcoshŚsinh)Śsqrt)
ŚPointŚPoint2DŚLineŚPolygonŚSegmentŚconvex_hullŚintersectionŚcentroidŚPoint3DŚLine3D)ŚidiffŚclosest_pointsŚfarthest_pointsŚ_ordered_pointsŚare_coplanar)Śsolve)Śraisesc                     s*  t dddt ddd} t ddd}td}td}d | d  d	 }d
 d | d  d  | d  }|t|| dkstt|| d|t|| gdksØtt|| d|ks¾td td  d	 d   | | t|| d ”  ”sütd fddt|| D ks tt| |  | |gt| d ksNtt|t	| t	  |d t	 t	|  |d  ksŖtt|| t	  || g| t|  t	 ksźtt|| t	  | |g|  t|t	   ks2tt|| ||gt|ksjt| dt
 d  d  td  dtd    }t|| dt
 t dtd   dt  td d  dt   dt
 d   dd   ks&td S )NŚxT)ŚrealŚyŚtŚfŚgé   é   éż’’’é   é   é   é   r   c                    s   g | ]}|  d ”  ”qS )r(   )ŚdiffŚequals)Ś.0Zsol©Śexplicitr   © ś_/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/sympy/geometry/tests/test_util.pyŚ
<listcomp>   s     ztest_idiff.<locals>.<listcomp>iö’’’é
   iģ’’’é   )r   r   r   ŚAssertionErrorr   Śsubsr   r,   r   r   r   r	   r
   r   r   )r    r!   r"   r#   ŚcircŚansZfxyr0   r.   r1   Ś
test_idiff   s<    $$ $.\@H8:,
’’’’
’r9   c                   C   są   t tddg kstttdd  t tddtddtddd	d
tddtddgks^tt tddtddtddd	d
tddtddgkstt tddtddtddtdddd	d
tddtddgksÜtd S )Nr   c                   S   s   t tdddS ©Nr   r(   )r   r   r0   r0   r0   r1   Ś<lambda>)   ó    z#test_intersection.<locals>.<lambda>©r   r   ©r$   r   )é’’’’r   )r'   r   )r   r'   T)Śpairwiser'   )Zslope)r   r   r5   r   Ś	TypeErrorr   r   r0   r0   r0   r1   Śtest_intersection'   sB     ż ’ż ż ’ż
 ü ’ürB   c                  C   sj   t tdd  dddddg} t| dd	itd
dtddtddtddgtd
dtddgfksftd S )Nc                   S   s   t tdddS r:   )r   r   r0   r0   r0   r1   r;   =   r<   z"test_convex_hull.<locals>.<lambda>©r'   r?   ©r'   éž’’’©r(   r?   ©éū’’’rE   ©é   éü’’’ZpolygonFrH   rE   r'   r?   r(   rJ   rK   )r   rA   r   r   r5   )Śpointsr0   r0   r1   Śtest_convex_hull<   s    "žrM   c                  C   sĘ   t ddd} |  dd”}t| |tddd ks4ttdd} tdd	}t| |td
td d ksjtttddtddtddd kstttddtddtddtddd ksĀtd S )Nr=   )r3   r   )r3   r3   r   r4   é(   r(   r>   )r$   r$   r'   r$   )r   Ś	translater   r   r5   r   r   )ŚpŚqr0   r0   r1   Śtest_centroidD   s    

"(rR   c                     sB  ddl m}  ddlm} ttfD ]}|tkr4t nt tt	 fdd t
ddt
ddt
ddg}t
ddt
ddt
ddg}t
ddt
ddt
dd	g}t
ddt
ddt
d
dg}t
ddt
ddt
ddg}t
ddt
ddt
ddt
ddg}tddd}	dd |	df|	d df|	d dffD }
|||||||
fD ]`}|dd |t|dD }t | d  }\}}| |”|kst|t|ks@tq@t }t|dkrÖ| t
| dd| dd” qØt|}|dd ||dD }t | d  }\}}| |”|ks"t|t|ks tq t
ddt
ddt
tjtdd   }}}dd ||||fdD }t||||kstt||||ks¦tdddddg}t| t
ddt
dd
fhksŲtdd d!d"d#g}t| t
dd$t
dd%fhks
ttdd&t
ddt
ddfhks0ttt	d'd  d S )(Nr   )Śrandint)Śsubsetsc                      s    t ddt ddS )Nr   ©r   r0   ©Śfuncr0   r1   r;   Y   r<   z5test_farthest_points_closest_points.<locals>.<lambda>r(   r'   r$   r3   r%   r?   r   T)Zpositivec                 S   s   g | ]}t |qS r0   rU   )r-   Śar0   r0   r1   r2   i   s     z7test_farthest_points_closest_points.<locals>.<listcomp>c                 s   s   | ]\}}|  |”V  qd S ©N©Śdistance©r-   ŚiŚjr0   r0   r1   Ś	<genexpr>l   s     z6test_farthest_points_closest_points.<locals>.<genexpr>é   éd   c                 s   s   | ]\}}|  |”V  qd S rY   rZ   r\   r0   r0   r1   r_   w   s     c                 S   s   h | ]\}}t ||fqS r0   )r   r\   r0   r0   r1   Ś	<setcomp>   s   ’z6test_farthest_points_closest_points.<locals>.<setcomp>©r'   r'   )r'   r$   )r(   r'   )rH   r$   )rJ   r%   rH   rJ   rC   rD   rF   rG   rI   rE   rK   r=   c                   S   s   t dS )Nrc   )r   r0   r0   r0   r1   r;      r<   )Zsympy.core.randomrS   Zsympy.utilities.iterablesrT   ŚminŚmaxr   r   r   Ś
ValueErrorr   r   ŚsetŚlistr[   r5   r   ŚlenŚaddr   ZHalfr   )rS   rT   ŚhowŚp1Śp2Zp3Zp4Zp5Śdupr   ŚsrL   Śdr8   rX   ŚbŚcr0   rV   r1   Ś#test_farthest_points_closest_pointsO   sb    $(   ’
’’’’rs   c                  C   s   t tdddtddd} t tdddtddd}t tdddtddd}ttddtdd}t| ||dksxtt| |dkstd S )	Nr*   r   r'   r?   rE   r(   é	   F)r   r   r   r   r   r5   )rX   rq   rr   rp   r0   r0   r1   Śtest_are_coplanar   s    ru   N)+Zsympy.core.functionr   r   Zsympy.core.singletonr   Zsympy.core.symbolr   Zsympy.functionsr   r   r   r	   r
   r   Z(sympy.functions.elementary.miscellaneousr   Zsympy.geometryr   r   r   r   r   r   r   r   r   r   Zsympy.geometry.utilr   r   r   r   r   Zsympy.solvers.solversr   Zsympy.testing.pytestr   r9   rB   rM   rR   rs   ru   r0   r0   r0   r1   Ś<module>   s    0A