o
    oh                     @   sx   zd dl mZ W n	 ey   Y nw d dlmZ d dlmZm	Z
 dd Zdd Zdd	 Zd
d Zdd ZdZdd ZdS )    )c_floatN)sqrtacosc                 C   s^   | d |d  | d |d   | d |d  | d |d   | d |d  | d |d   fS )N      r    abr   r   {/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/plotting/pygletplot/plot_rotation.pycross
   s   r   c                 C   s0   | d |d  | d |d   | d |d   S Nr   r   r   r   r   r   r   r   dot   s   0r   c                 C   s(   t | d d | d d  | d d  S )Nr   r   r   )_sqrt)r	   r   r   r   mag   s   (r   c                 C   s*   t | }| d | | d | | d | fS r   )r   )r	   mr   r   r   norm   s   "r   c                 C   s   t t| dg|g} t t|dg|g}t|d d |d d  }| |d  | }||d  | }d|d  |d  }|dkrIt|}|||fS d}t|||fS )Nr   r         ?g        )minmaxr   r   )xywidthheightsrsxsyszr   r   r   get_sphere_mapping   s   
r   gFa~ܥL@c                 C   s   t | d | d ||}t |d |d ||}ttt||dgd}t|d dk r,d S tt||}|t t| }	t	
  t	  t	j|	g|R   td  }
t	t	j|
 t	  |
S )Nr   r   r   gư>   )r   r   r   r   absr   r   rad2deg_acospglglPushMatrixglLoadIdentity	glRotatefr   glGetFloatvGL_MODELVIEW_MATRIXglPopMatrix)p1p2r   r   theta_multiplierv1v2draxisrthetamatr   r   r   get_spherical_rotatation1   s   
r4   )ctypesr   ImportError	pyglet.glglr$   mathr   r   r   r#   r   r   r   r   r   r"   r4   r   r   r   r   <module>   s    