
    _ h                     V    d Z ddlZddlZd Zd Zd	dZ ej                  edd      Zy)
zShapely CGA algorithms.    Nc                     t        j                  | j                        ddddf   }t        j                  ||d   g      j                  \  }}t        j
                  |dd |dd |dd z
  z        dz  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       r/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/shapely/algorithms/cga.pysigned_arear      st    
 XXdkk"1bqb5)FYYq	*+--FB66"Qr(bfr#2w./0366    c                    t        j                  |      }t        j                  |      rt        j                  |       } | S t        j
                  |      r0t        j                  |       } t        j                  | |         | |<   | S )zIReturn a copy of the rings potentially reversed depending on `condition`.)r   asarrayallshapelyreverseanyr	   )rings	conditions     r   _reverse_conditionedr      si    

9%I	vvi& L 
		"??5+;<iLr   c           	         | y | j                   dv r3| j                  | j                  D cg c]  }t        ||       c}      S | j                   dk(  rt	        j
                  | j                  g| j                        }t        j                  |      }|d    |d<   |rt	        j                  |      }t	        j                  |      r$t        ||      }| j                  |d   |dd        S | S c c}w )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KD_T;/K
 	

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