
    gL                        d dl mZ d dlmZmZ d dlmZmZ d dl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mZmZ d dlmZ d d	lmZ eeefZ G d
 d      Z G d dee      Z G d de      Z  G d d      Z! G d d      Z" G d de"e      Z# G d de      Z$ G d de      Z% G d de      Z& G d de      Z' G d de      Z( G d  d!e      Z) G d" d#e      Z* G d$ d%e"e       Z+ G d& d'e"e       Z, G d( d)e       Z- G d* d+e"e       Z. G d, d-      Z/ G d. d/e/e"e      Z0 G d0 d1e       Z1 G d2 d3e       Z2 G d4 d5e      Z3 G d6 d7e3      Z4 G d8 d9e      Z5 G d: d;e      Z6 G d< d=e"e       Z7ejp                   G d> d?ee             Z9ejp                   G d@ dAe"ee             Z: G dB dCe/e"e      Z; G dD dEe      Z< G dF dGe       Z= G dH dIe      Z> G dJ dKe      Z? G dL dMe      Z@ G dN dOe/e"e      ZA G dP dQe"e       ZB G dR dSe      ZC G dT dUe!e       ZD G dV dWe!e       ZE G dX dYe"e       ZF G dZ d[e       Z G d\ d]eD      ZG G d^ d_e"e       ZHy`)a    )Decimal)BaseSpatialFieldGeometryField)	AreaFieldDistanceField)GEOSGeometry)
FieldError)NotSupportedError)BinaryFieldBooleanField
FloatFieldFuncIntegerField	TextField	TransformValue)Cast)cached_propertyc                   d     e Zd ZdZdZ fdZed        Zed        Z	d	 fd	Z
 fdZd
dZ xZS )GeoFuncMixinNr   c                    t        |   |i | | j                  D ]  }| j                  |   }t	        |t
              s#	 |j                  }|j                  }t	        |t              r|r-t	        |t              st        d| j                  |dz   fz        |j                  s|st        d      |rt        |t        |j                              | j                  |<    y # t        $ r d }Y w xY w)Nz9%s function requires a geometric argument in position %d.   z$SRID is required for all geometries.srid)output_field)super__init__geom_param_possource_expressions
isinstancer   r   r	   valuer   r   	TypeErrornamer   
ValueError)selfexpressionsextraposexprr   geom	__class__s          ~/var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/contrib/gis/db/models/functions.pyr   zGeoFuncMixin.__init__   s    +// &&C**3/DdE*$#00 ::Dt\2"<?Oyy#'*+  99\ !GHH/4}$))'D0'',+ '  $#$s   C%%C32C3c                 .    | j                   j                  S N)r,   __name__r&   s    r-   r$   zGeoFuncMixin.name9   s    ~~&&&    c                 N    | j                   | j                  d      j                  S Nr   )r    r   fieldr1   s    r-   	geo_fieldzGeoFuncMixin.geo_field=   s$    &&t':':1'=>DDDr2   c                     | j                   '|%|j                  j                  | j                        }t	        |   ||fd|i|S )Nfunction)r8   opsspatial_function_namer$   r   as_sql)r&   compiler
connectionr8   extra_contextr,   s        r-   r;   zGeoFuncMixin.as_sqlA   sE    == X%5!~~;;DIIFHw~h
WXWWWr2   c           
         t        
|   |i |}| j                  s|S |j                         }| j                  D ]K  }||   }t	        |t
              rt        | j                  d|dz   dt        |      j                  d       |j                  j                  }| j                  dd  D ]V  }|j                  |   }|j                  j                  }	|	|k7  s. t        ||      j                  |i ||j                  |<   X |S )Nz/ function requires a GeometryField in position r   z, got .)r   resolve_expressionr   get_source_fieldsr!   r   r#   r$   typer0   r6   r   r    r   r   )r&   argskwargsressource_fieldsr)   r5   	base_sridr*   	expr_sridr,   s             r-   rA   zGeoFuncMixin.resolve_expressionF   s   g($9&9""J --/&&C!#&Ee]3 		aU,,	  ' MM&&	&&qr*C))#.D))..II%/%i)/$$d/6.4/6&&s+ + 
r2   c                 ^    t        |d      s |rt        ||      st        d|d|d      |S )NrA   zThe z) parameter has the wrong type: should be r@   )hasattrr!   r#   )r&   r"   
param_namecheck_typess       r-   _handle_paramzGeoFuncMixin._handle_paramd   s7    u23:e[#A!;0  r2   r/    N)r0   
__module____qualname__r8   r   r   propertyr$   r   r6   r;   rA   rN   __classcell__r,   s   @r-   r   r      sL    HN: ' ' E EX
<r2   r   c                       e Zd Zy)GeoFuncNr0   rQ   rR    r2   r-   rW   rW   n       r2   rW   c                       e Zd Zed        Zy)GeomOutputGeoFuncc                 B    t        | j                  j                        S )Nr   )r   r6   r   r1   s    r-   r   zGeomOutputGeoFunc.output_fields   s    $.."5"566r2   N)r0   rQ   rR   r   r   rY   r2   r-   r\   r\   r   s    7 7r2   r\   c                       e Zd ZdZd Zy)SQLiteDecimalToFloatMixinz
    By default, Decimal values are converted to str by the SQLite backend, which
    is not acceptable by the GIS functions expecting numeric values.
    c           
      6   | j                         }|j                  |j                         D cg c]H  }t        |d      r8t	        |j
                  t              rt        t        |j
                              n|J c}        |j                  ||fi |S c c}w )Nr"   )
copyset_source_expressionsget_source_expressionsrK   r!   r"   r   r   floatr;   )r&   r<   r=   r>   ra   r*   s         r-   	as_sqlitez#SQLiteDecimalToFloatMixin.as_sqlite~   s    yy{## !779 :D tW-*TZZ2Q %

+, :		
 t{{8ZA=AAs   ABN)r0   rQ   rR   __doc__re   rY   r2   r-   r_   r_   x   s    
Br2   r_   c                       e Zd ZdZd Zy)OracleToleranceMixing?c                    t        | j                  | j                  j                  d| j                        dt
                    }| j                         }|j                  g | j                         |        |j                  ||fi |S )N	tolerance)
r   rN   r(   getrj   NUMERIC_TYPESra   rb   rc   r;   )r&   r<   r=   r>   rj   clones         r-   	as_oraclezOracleToleranceMixin.as_oracle   s}    

{DNN;
	 		$$%Pt'B'B'D%Pi%PQu||HjBMBBr2   N)r0   rQ   rR   rj   rn   rY   r2   r-   rh   rh      s    I
Cr2   rh   c                   8     e Zd ZdZed        Z fdZd Z xZS )Arear   c                 ,    t        | j                        S r/   )r   r6   r1   s    r-   r   zArea.output_field   s    ((r2   c                     |j                   j                  s&| j                  j                  |      rt	        d      t        |   ||fi |S )Nz2Area on geodetic coordinate systems not supported.)featuressupports_area_geodeticr6   geodeticr
   r   r;   r&   r<   r=   r>   r,   s       r-   r;   zArea.as_sql   sP    ""99dnn>U>U?
 $D  w~h
DmDDr2   c                 t    | j                   j                  |      r
d|d<   d|d<    | j                  ||fi |S )Nz+%(function)s(%(expressions)s, %(spheroid)d)templateTspheroid)r6   ru   r;   )r&   r<   r=   r>   s       r-   re   zArea.as_sqlite   s@    >>"":.(UM*%(,M*%t{{8ZA=AAr2   )	r0   rQ   rR   arityr   r   r;   re   rT   rU   s   @r-   rp   rp      s&    E) )EBr2   rp   c                   "    e Zd Z e       ZdZdZy)Azimuth   r   r   Nr0   rQ   rR   r   r   rz   r   rY   r2   r-   r|   r|          <LENr2   r|   c                   8     e Zd Z e       Zd fd	Z fdZ xZS )	AsGeoJSONc                     |g}|&|j                  | j                  |dt                     d}|r|rd}n	|rd}n|rd}|j                  |       t        |   |i | y )N	precisionr      r   r}   appendrN   intr   r   )	r&   
expressionbboxcrsr   r(   r'   optionsr,   s	           r-   r   zAsGeoJSON.__init__   sl    !l t11)[#NO4GGG7#+//r2   c                     | j                         }| j                         }|j                  |d d        t        t        |  ||fi |S Nr   )rc   ra   rb   r   r   r;   r&   r<   r=   r>   r    rm   r,   s         r-   rn   zAsGeoJSON.as_oracle   sL    !88:		$$%7%;<Y-h
TmTTr2   )FF   )r0   rQ   rR   r   r   r   rn   rT   rU   s   @r-   r   r      s    ;L0U Ur2   r   c                   <     e Zd ZdZ e       Zd fd	Z fdZ xZS )AsGML)r   c                 |    ||g}|&|j                  | j                  |dt                     t        |   |i | y Nr   r   )r&   r   versionr   r(   r'   r,   s         r-   r   zAsGML.__init__   sB    
+ t11)[#NO+//r2   c                     | j                         }|d   }| j                         }|j                  |d   g       |j                  dk(  rdnd|d<   t	        t
        |  ||fi |S )Nr   r   r   zSDO_UTIL.TO_GML311GEOMETRYzSDO_UTIL.TO_GMLGEOMETRYr8   )rc   ra   rb   r"   r   r   r;   )r&   r<   r=   r>   r    r   rm   r,   s          r-   rn   zAsGML.as_oracle   sy    !88:$Q'		$$&8&;%<= }}! )* 	j!
 UE)(JP-PPr2   )r}   r   )	r0   rQ   rR   r   r   r   r   rn   rT   rU   s   @r-   r   r      s     N;L0
Q 
Qr2   r   c                   .     e Zd Z e       Zd fd	Z xZS )AsKMLc                 z    |g}|&|j                  | j                  |dt                     t        |   |i | y r   r   r&   r   r   r(   r'   r,   s        r-   r   zAsKML.__init__   ?    !l t11)[#NO+//r2   )r   r0   rQ   rR   r   r   r   rT   rU   s   @r-   r   r      s    ;L0 0r2   r   c                   .     e Zd Z e       Zd fd	Z xZS )AsSVGc                     t        |d      r|n
t        |      }||| j                  |dt              g}t        |   |i | y )NrA   r   )rK   r   rN   r   r   )r&   r   relativer   r(   r'   r,   s         r-   r   zAsSVG.__init__   sP    *>?HS] 	 y+s;

 	+//r2   )Fr   r   rU   s   @r-   r   r      s    ;L	0 	0r2   r   c                       e Zd Z e       ZdZy)AsWKBr   N)r0   rQ   rR   r   r   rz   rY   r2   r-   r   r     s    =LEr2   r   c                       e Zd Z e       ZdZy)AsWKTr   N)r0   rQ   rR   r   r   rz   rY   r2   r-   r   r     s    ;LEr2   r   c                   4     e Zd Zd fd	Z fdZ fdZ xZS )BoundingCirclec                 (    t        |   ||fi | y r/   )r   r   )r&   r   num_segr(   r,   s       r-   r   zBoundingCircle.__init__  s    W66r2   c                     | j                         }|j                  | j                         d   g       t        t        |  ||fi |S r4   )ra   rb   rc   r   r   rn   r&   r<   r=   r>   rm   r,   s        r-   rn   zBoundingCircle.as_oracle  N    		$$d&A&A&CA&F%GH^U5j
$1
 	
r2   c                     | j                         }|j                  | j                         d   g       t        t        |  ||fi |S r4   )ra   rb   rc   r   r   re   r   s        r-   re   zBoundingCircle.as_sqlite  r   r2   )0   )r0   rQ   rR   r   rn   re   rT   rU   s   @r-   r   r     s    7

 
r2   r   c                       e Zd ZdZy)Centroidr   Nr0   rQ   rR   rz   rY   r2   r-   r   r         Er2   r   c                       e Zd ZdZdZy)ClosestPointr}   r~   Nr0   rQ   rR   rz   r   rY   r2   r-   r   r   #      ENr2   r   c                       e Zd ZdZdZy)
Differencer}   r~   Nr   rY   r2   r-   r   r   (  r   r2   r   c                   "    e Zd Zed        Zd Zy)DistanceResultMixinc                 ,    t        | j                        S r/   )r   r6   r1   s    r-   r   z DistanceResultMixin.output_field.  s    T^^,,r2   c                 d    | j                   j                  xr | j                   j                  dk(  S )Ni  )r6   	geographyr   r1   s    r-   source_is_geographyz'DistanceResultMixin.source_is_geography2  s&    ~~''GDNN,?,?4,GGr2   N)r0   rQ   rR   r   r   r   rY   r2   r-   r   r   -  s    - -Hr2   r   c                   <     e Zd ZdZdZd fd	Z fdZ fdZ xZS )Distancer~   Nc                 h    ||g}|| j                  |dt              | _        t        |   |i | y )Nry   )rN   boolry   r   r   )r&   expr1expr2ry   r(   r'   r,   s         r-   r   zDistance.__init__:  s:    en ..xTJDM+//r2   c                    | j                         }d }|j                  d   }| j                         }|j                  j                  |k7  rZt        |t              r||j                  _        n8t        |t        |j                  j                  |            |j                  d<   |s| j                  j                  |      r| j                  rY|j                  j                  d      }|j                  j                  t        | j                  j                  |                   n|j                  j                  d      }t!        t"        |J  ||fd|i|S )Nr   )r   r   DistanceSpheroidDistanceSpherer8   )ra   r    r   r   r   r!   r   r   r   r   r6   ru   ry   r9   r:   r   r   r   r;   )	r&   r<   r=   r>   rm   r8   r   r   r,   s	           r-   as_postgresqlzDistance.as_postgresql@  s,   		((+,,.	''94%'/8"",.2!u'9'9'>'>)T/((+
 T^^44Z@ }} &>>??@RS((//$..11*=> &>>??@PQXu,j
+3
7D
 	
r2   c                     | j                   j                  |      r&d|d<   t        t        | j                              |d<   t        |   ||fi |S )Nz8COALESCE(%(function)s(%(expressions)s, %(spheroid)s), 0)rx   ry   )r6   ru   r   r   ry   r   r;   rv   s       r-   re   zDistance.as_sqlite_  sU    >>"":. K *% ),D,?(@M*%w~h
DmDDr2   r/   )	r0   rQ   rR   r   ry   r   r   re   rT   rU   s   @r-   r   r   6  s#    NH0
>E Er2   r   c                       e Zd ZdZy)Enveloper   Nr   rY   r2   r-   r   r   i  r   r2   r   c                       e Zd ZdZy)ForcePolygonCWr   Nr   rY   r2   r-   r   r   m  r   r2   r   c                   2     e Zd ZdZdZd fd	Z fdZ xZS )FromWKBr}   rY   c                 |    || j                  |dt              g}d|vrt        |      |d<   t        |   |i | y Nr   r   r   rN   r   r   r   r   r&   r   r   r(   r'   r,   s        r-   r   zFromWKB.__init__u  J    tVS1
 &$1t$<E.!+//r2   c                     | j                         }| j                         }|j                  |d d        t        t        |  ||fi |S r   )rc   ra   rb   r   r   r;   r   s         r-   rn   zFromWKB.as_oracle~  sL    !88:		$$%7%;<We+HjRMRRr2   r   )r0   rQ   rR   rz   r   r   rn   rT   rU   s   @r-   r   r   q  s    EN0S Sr2   r   c                       e Zd Zy)FromWKTNrX   rY   r2   r-   r   r     rZ   r2   r   c                   4     e Zd Z e       Zd fd	Zd Z xZS )GeoHashc                 z    |g}|&|j                  | j                  |dt                     t        |   |i | y r   r   r   s        r-   r   zGeoHash.__init__  r   r2   c                     | j                         }t        |j                        dk  r$|j                  j                  t	        d              |j
                  ||fi |S )Nr}   d   )ra   lenr    r   r   r;   )r&   r<   r=   r>   rm   s        r-   as_mysqlzGeoHash.as_mysql  sP    		u''(1,$$++E#J7u||HjBMBBr2   r/   )r0   rQ   rR   r   r   r   r   rT   rU   s   @r-   r   r     s    ;L0Cr2   r   c                   *    e Zd Z e       ZdZdZdZdZy)GeometryDistancer}   rP   z <-> r~   N)	r0   rQ   rR   r   r   rz   r8   
arg_joinerr   rY   r2   r-   r   r     s    <LEHJNr2   r   c                       e Zd ZdZdZy)Intersectionr}   r~   Nr   rY   r2   r-   r   r     r   r2   r   c                       e Zd ZdZ e       Zy)IsEmptyisemptyN)r0   rQ   rR   lookup_namer   r   rY   r2   r-   r   r     s    K>Lr2   r   c                   0     e Zd ZdZ e       Z fdZ xZS )IsValidisvalidc                 :    t        |   ||fi |\  }}d|z  |fS )Nz%CASE %s WHEN 'TRUE' THEN 1 ELSE 0 END)r   rn   )r&   r<   r=   r>   sqlparamsr,   s         r-   rn   zIsValid.as_oracle  s-    g'*NNV6<fDDr2   )r0   rQ   rR   r   r   r   rn   rT   rU   s   @r-   r   r     s    K>LE Er2   r   c                   >     e Zd Zd fd	Z fdZ fdZ fdZ xZS )Lengthc                 4    || _         t        |   |fi | y r/   )ry   r   r   )r&   r   ry   r(   r,   s       r-   r   zLength.__init__  s     (%(r2   c                     | j                   j                  |      r!|j                  j                  st	        d      t        |   ||fi |S )Nz6This backend doesn't support Length on geodetic fields)r6   ru   rs   supports_length_geodeticr
   r   r;   rv   s       r-   r;   zLength.as_sql  sL    NN##J/''@@#H  w~h
DmDDr2   c                 2   | j                         }d }| j                         r/|j                  j                  t	        | j
                               n| j                  j                  |      rY|j                  j                  d      }|j                  j                  t	        | j                  j                  |                   n;t        d | j                         D              }|dkD  r|j                  j                  }t        t        |>  ||fd|i|S )NLengthSpheroidc              3   :   K   | ]  }|s|j                     y wr/   dim.0fs     r-   	<genexpr>z'Length.as_postgresql.<locals>.<genexpr>  s     C%=aee%=s   r}   r8   )ra   r   r    r   r   ry   r6   ru   r9   r:   minrB   length3dr   r   r;   )r&   r<   r=   r>   rm   r8   r   r,   s          r-   r   zLength.as_postgresql  s    		##%$$++E$--,@A^^$$Z0!~~;;<LMH$$++E$..2I2I*2U,VWCT%;%;%=CCCQw%>>22VU*j
+3
7D
 	
r2   c                     d }| j                   j                  |      r| j                  rdnd}t        |   ||fd|i|S )NGeodesicLengthGreatCircleLengthr8   )r6   ru   ry   r   r;   )r&   r<   r=   r>   r8   r,   s        r-   re   zLength.as_sqlite  sD    >>"":.+/=='>QHw~h
WXWWWr2   )T)r0   rQ   rR   r   r;   r   re   rT   rU   s   @r-   r   r     s    )E
"X Xr2   r   c                   "    e Zd Z e       ZdZdZy)LineLocatePointr}   r~   Nr   rY   r2   r-   r  r    r   r2   r  c                       e Zd Zy)	MakeValidNrX   rY   r2   r-   r  r    rZ   r2   r  c                       e Zd Z e       ZdZy)MemSizer   Nr0   rQ   rR   r   r   rz   rY   r2   r-   r  r        >LEr2   r  c                       e Zd Z e       ZdZy)NumGeometriesr   Nr  rY   r2   r-   r	  r	    r  r2   r	  c                       e Zd Z e       ZdZy)	NumPointsr   Nr  rY   r2   r-   r  r    r  r2   r  c                   ,     e Zd ZdZ fdZ fdZ xZS )	Perimeterr   c                    d }| j                   j                  |      r| j                         st        d      t	        d | j                         D              }|dkD  r|j                  j                  }t        | $  ||fd|i|S )Nz<ST_Perimeter cannot use a non-projected non-geography field.c              3   4   K   | ]  }|j                     y wr/   r   r   s     r-   r   z*Perimeter.as_postgresql.<locals>.<genexpr>  s     :!9A!%%!9s   r}   r8   )
r6   ru   r   r
   r   rB   r9   perimeter3dr   r;   )r&   r<   r=   r>   r8   r   r,   s         r-   r   zPerimeter.as_postgresql  s    >>"":.t7O7O7Q#N  :!7!7!9::7!~~11Hw~h
WXWWWr2   c                 r    | j                   j                  |      rt        d      t        |   ||fi |S )Nz+Perimeter cannot use a non-projected field.)r6   ru   r
   r   r;   rv   s       r-   re   zPerimeter.as_sqlite  s7    >>"":.#$QRRw~h
DmDDr2   )r0   rQ   rR   rz   r   re   rT   rU   s   @r-   r  r    s    E	XE Er2   r  c                       e Zd ZdZy)PointOnSurfacer   Nr   rY   r2   r-   r  r    r   r2   r  c                       e Zd ZdZy)Reverser   Nr   rY   r2   r-   r  r    r   r2   r  c                         e Zd Zd fd	Z xZS )Scalec                     || j                  |dt              | j                  |dt              g}|dk7  r&|j                  | j                  |dt                     t        |   |i | y )Nxy        z)rN   rl   r   r   r   )r&   r   r  r  r  r(   r'   r,   s          r-   r   zScale.__init__  si    q#}5q#}5

 8t11!S-HI+//r2   )r  r0   rQ   rR   r   rT   rU   s   @r-   r  r    s    0 0r2   r  c                        e Zd Z fdZ xZS )
SnapToGridc           
      "    t        |      }|g}|dv r5|j                  |D cg c]  } j                  |dt               c}       n2|dk(  r"|g  fd|dd  D         fd|dd D        z  }nt	        d      t           |i | y c c}w )	N)r   r}   rP      c              3   L   K   | ]  }j                  |d t                ywrO   rN   rl   r   argr&   s     r-   r   z&SnapToGrid.__init__.<locals>.<genexpr>+  s!     Q$$$S"m<   !$r}   c              3   L   K   | ]  }j                  |d t                ywrO   r#  r$  s     r-   r   z&SnapToGrid.__init__.<locals>.<genexpr>,  s!     R	$$$S"m<	r&  r   z2Must provide 1, 2, or 4 arguments to `SnapToGrid`.)r   extendrN   rl   r%   r   r   )r&   r   rD   r(   nargsr'   r%  r,   s   `      r-   r   zSnapToGrid.__init__!  s    D	!lF?GKLt##C];tL aZ QQRQRQq	R K
 QRR+// Ms   Br  rU   s   @r-   r  r     s    0 0r2   r  c                       e Zd ZdZdZy)SymDifferencer}   r~   Nr   rY   r2   r-   r+  r+  3  r   r2   r+  c                        e Zd Z fdZ xZS )r   c                 |    || j                  |dt              g}d|vrt        |      |d<   t        |   |i | y r   r   r   s        r-   r   zTransform.__init__9  r   r2   r  rU   s   @r-   r   r   8  s    0 0r2   r   c                        e Zd Z fdZ xZS )	Translatec                     | j                         }t        | j                        dk  r$|j                  j                  t	        d             t        t        |  ||fi |S )Nr!  r   )ra   r   r    r   r   r   r/  re   r   s        r-   re   zTranslate.as_sqliteD  sR    		t&&'!+$$++E!H5Y0:WWWr2   )r0   rQ   rR   re   rT   rU   s   @r-   r/  r/  C  s    X Xr2   r/  c                       e Zd ZdZdZy)Unionr}   r~   Nr   rY   r2   r-   r2  r2  L  r   r2   r2  N)Idecimalr   #django.contrib.gis.db.models.fieldsr   r    django.contrib.gis.db.models.sqlr   r   django.contrib.gis.geosr   django.core.exceptionsr	   	django.dbr
   django.db.modelsr   r   r   r   r   r   r   r   django.db.models.functionsr   django.utils.functionalr   r   rd   rl   r   rW   r\   r_   rh   rp   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   register_lookupr   r   r   r  r  r  r	  r  r  r  r  r  r  r+  r/  r2  rY   r2   r-   <module>r=     s    O E 0 - '	 	 	 , 3eW%S Sl	lD 	7 7B B*C C B B.g U U0QG Q.0G 00G 0G 
G 

)+< 
&#%6 $ 
%'8 
H H0E"$8' 0Ef  & Sg S*	g 	Cg C"w '): 
 !!"lI " ""
 !!E"L) E "E$X "6 $XNg 	! 	g 
G 
 
E#%97 E()+< g 	0%'8 	00*,= 0&(*; 
0! 0X X "3 r2   