
    \i                     R    S r SSKrSSKrS rS rS	S jr\R                  " \SSS9rg)
zShapely CGA algorithms.    Nc                     [         R                  " U R                  5      SS2SS24   n[         R                  " XS   /5      R                  u  p#[         R
                  " USS USS USS -
  -  5      S-  $ )zReturn the signed area enclosed by a ring in linear time.

Algorithm used: https://web.archive.org/web/20080209143651/http://cgafaq.info:80/wiki/Polygon_Area
N      g       @)nparraycoordsvstackTsum)ringr
   xsyss       Y/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/shapely/algorithms/cga.pysigned_arear      sp    
 XXdkk"1bqb5)FYYq	*+--FB66"Qr(bfr#2w./0366    c                 .   [         R                  " U5      n[         R                  " U5      (       a  [        R                  " U 5      n U $ [         R
                  " U5      (       a0  [         R                  " U 5      n [        R                  " X   5      X'   U $ )zIReturn a copy of the rings potentially reversed depending on `condition`.)r   asarrayallshapelyreverseanyr	   )rings	conditions     r   _reverse_conditionedr      sk    

9%I	vvi& L 
			"??5+;<Lr   c           	         U c  g U R                   S;   a5  U R                  U R                   Vs/ s H  n[        X!5      PM     sn5      $ U R                   S:X  a  [        R
                  " U R                  /U R                  Q5      n[        R                  " U5      nUS   (       + US'   U(       a  [        R                  " U5      n[        R                  " U5      (       a#  [        X45      nU R                  US   USS  5      $ U $ s  snf )N)MultiPolygonGeometryCollectionPolygonr   r   )	geom_type	__class__geoms_orient_polygonr   r	   exterior	interiorsr   is_ccwlogical_notr   r   )geometryexterior_cwgeomr   reverse_conditions        r   r$   r$      s    CC!!<DNNKND_T/NK
 	

 
		y	((++Ah.@.@AB#NN51#4Q#77! "/@ A66#$$(BE%%eAhab	::O Ls   Dr   r   )ninnout)F)	__doc__numpyr   r   r   r   r$   
frompyfunc_orient_polygons_vectorized r   r   <module>r4      s2      7* !mmOK r   