§
    ø(g  ã                   ó.   — d Z d„ Zddœd„Zd„ Zddœd„ZdS ))Úregion_2d_to_vector_3dÚregion_2d_to_origin_3dÚregion_2d_to_location_3dÚlocation_3d_to_region_2dc                 ó¾  — ddl m} |j                             ¦   «         }|j        r�|j                             ¦   «         } |d|d         z  | j        z  dz
  d|d         z  | j        z  dz
  df¦  «        }|                     |d         j	        ¦  «        |d         d         z   }||z  |z  |j
        z
  }n|j        d         j	         }|                     ¦   «          |S )	a-  
    Return a direction vector from the viewport at the specific 2d region
    coordinate.

    :arg region: region of the 3D viewport, typically bpy.context.region.
    :type region: :class:`bpy.types.Region`
    :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
    :type rv3d: :class:`bpy.types.RegionView3D`
    :arg coord: 2d coordinates relative to the region:
       (event.mouse_region_x, event.mouse_region_y) for example.
    :type coord: 2d vector
    :return: normalized 3d vector.
    :rtype: :class:`mathutils.Vector`
    é    ©ÚVectorç       @ç      ð?é   g      à¿é   é   )Ú	mathutilsr	   Úview_matrixÚinvertedÚis_perspectiveÚperspective_matrixÚwidthÚheightÚdotÚxyzÚtranslationÚcolÚ	normalize)	ÚregionÚrv3dÚcoordr	   ÚviewinvÚpersinvÚoutÚwÚview_vectors	            ú]/home/blender/git/blender-v430/install_release/4.3/scripts/modules/bpy_extras/view3d_utils.pyr   r      s÷   € ð !Ð Ð Ð Ð Ð àÔ×'Ò'Ñ)Ô)€GØÔð *ØÔ)×2Ò2Ñ4Ô4ˆàˆfØ�5˜”8‰^˜fœlÑ*¨cÑ1Ø�5˜”8‰^˜fœmÑ+¨sÑ2Øð
ñ ô ˆð �GŠG�G˜A”J”NÑ#Ô# g¨a¤j°¤mÑ3ˆà #™¨Ñ*¨gÔ.AÑAˆˆà”{ 1”~Ô)Ð)ˆà×ÒÑÔÐàÐó    N)Úclampc                óD  — |j                              ¦   «         }|j        r|j                             ¦   «         }nå|j                             ¦   «         }d|d         z  | j        z  dz
  }d|d         z  | j        z  dz
  }|                     ¦   «         }	|	j        d         j	        |z  |	j        d         j	        |z  z   |	j        z   }|dk    rS|j
        dk    rH|	j        d         j	        }
|�/|dk     r|
                     ¦   «          | }|
j        |k    r||
_        ||
z  }|S )aH  
    Return the 3d view origin from the region relative 2d coords.

    .. note::

       Orthographic views have a less obvious origin,
       the far clip is used to define the viewport near/far extents.
       Since far clip can be a very large value,
       the result may give with numeric precision issues.

       To avoid this problem, you can optionally clamp the far clip to a
       smaller value based on the data you're operating on.

    :arg region: region of the 3D viewport, typically bpy.context.region.
    :type region: :class:`bpy.types.Region`
    :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
    :type rv3d: :class:`bpy.types.RegionView3D`
    :arg coord: 2D coordinates relative to the region;
       (event.mouse_region_x, event.mouse_region_y) for example.
    :type coord: Sequence[float]
    :arg clamp: Clamp the maximum far-clip value used.
       (negative value will move the offset away from the view_location)
    :type clamp: float | None
    :return: The origin of the viewpoint in 3d space.
    :rtype: :class:`mathutils.Vector`
    r
   r   r   r   ç        ÚCAMERAr   )r   r   r   r   Úcopyr   r   r   r   r   Úview_perspectiveÚnegateÚlength)r   r   r   r%   r   Úorigin_startÚpersmatÚdxÚdyr   Úorigin_offsets              r#   r   r   3   s<  € ð6 Ô×'Ò'Ñ)Ô)€GàÔð .ØÔ*×/Ò/Ñ1Ô1ˆˆàÔ)×.Ò.Ñ0Ô0ˆØ�E˜!”H‰n˜vœ|Ñ+¨sÑ2ˆØ�E˜!”H‰n˜vœ}Ñ,°Ñ3ˆØ×"Ò"Ñ$Ô$ˆàŒ[˜Œ^Ô "Ñ$ØŒ[˜Œ^Ô "Ñ$ñ&àÔñ ð 	ð �CŠ<ˆ<ØÔ$¨Ò0Ð0à '¤¨A¤Ô 2�ØÐ$Ø˜s’{�{Ø%×,Ò,Ñ.Ô.Ð.Ø!& ˜Ø$Ô+¨eÒ3Ð3Ø/4˜Ô,à Ñ-�àÐr$   c                 óL  — ddl m} t          | ||¦  «        } ||¦  «        }t          | ||¦  «        }||z   }|j        rMddlm} |j                             ¦   «         }	|	j	        d          
                    ¦   «         }
 |||||
d¦  «        S ddlm}  ||||¦  «        d         S )aß  
    Return a 3d location from the region relative 2d coords, aligned with
    *depth_location*.

    :arg region: region of the 3D viewport, typically bpy.context.region.
    :type region: :class:`bpy.types.Region`
    :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
    :type rv3d: :class:`bpy.types.RegionView3D`
    :arg coord: 2d coordinates relative to the region;
       (event.mouse_region_x, event.mouse_region_y) for example.
    :type coord: 2d vector
    :arg depth_location: the returned vectors depth is aligned with this since
       there is no defined depth with a 2d region input.
    :type depth_location: 3d vector
    :return: normalized 3d vector.
    :rtype: :class:`mathutils.Vector`
    r   r   )Úintersect_line_planer   r   )Úintersect_point_line)r   r	   r   r   r   Úmathutils.geometryr3   r   r   r   r)   r4   )r   r   r   Údepth_locationr	   Ú	coord_vecr-   Ú
origin_endr3   r   Úview_vecr4   s               r#   r   r   m   sø   € ð$ !Ð Ð Ð Ð Ð å& v¨t°UÑ;Ô;€IØ�V˜NÑ+Ô+€Nå)¨&°$¸Ñ>Ô>€LØ 	Ñ)€JàÔð Ø;Ð;Ð;Ð;Ð;Ð;ØÔ"×+Ò+Ñ-Ô-ˆØ”;˜q”>×&Ò&Ñ(Ô(ˆØ#Ð#ØØØØ�añ	
ô 
ð 	
ð 	<Ð;Ð;Ð;Ð;Ð;Ø#Ð#ØØØñ
ô 
ð ô	ð 	r$   )Údefaultc                ó  — ddl m} |j         ||d         |d         |d         df¦  «        z  }|j        dk    rG| j        dz  }| j        dz  } ||||j        |j        z  z  z   |||j        |j        z  z  z   f¦  «        S |S )a#  
    Return the *region* relative 2d location of a 3d position.

    :arg region: region of the 3D viewport, typically bpy.context.region.
    :type region: :class:`bpy.types.Region`
    :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
    :type rv3d: :class:`bpy.types.RegionView3D`
    :arg coord: 3d world-space location.
    :type coord: 3d vector
    :arg default: Return this value if ``coord``
       is behind the origin of a perspective view.
    :return: 2d location
    :rtype: :class:`mathutils.Vector` | Any
    r   r   r   r   r   r'   r
   )r   r	   r   r!   r   r   ÚxÚy)r   r   r   r:   r	   ÚprjÚ
width_halfÚheight_halfs           r#   r   r   š   s¯   € ð !Ð Ð Ð Ð Ð à
Ô
! F F¨E°!¬H°e¸A´hÀÀaÄÈ#Ð+NÑ$OÔ$OÑ
O€CØ
„uˆs‚{€{Ø”\ CÑ'ˆ
Ø”m cÑ)ˆàˆvØ˜ s¤u¨s¬u¡}Ñ5Ñ5Ø˜+¨¬°´©Ñ7Ñ7ð
ñ ô ð 	ð
 ˆr$   )Ú__all__r   r   r   r   © r$   r#   ú<module>rC      st   ðð
€ð#ð #ð #ðL :>ð 7ð 7ð 7ð 7ð 7ðt*ð *ð *ðZ >Bð ð ð ð ð ð ð r$   