FA-70643 / GIS polygon topology / Member archive
Area-weighted centroid of a multipolygon with holes: orientation normalisation · case 03
Clockwise parts pull the centroid away instead of toward themselves.
Case contract
Input: a multipolygon as a list of polygons, each a list of closed rings (exterior first). Ring orientation is arbitrary: every ring contributes its absolute area and matching first moments, exteriors positively and holes negatively. Moments use the shoelace terms (xi + xi+1)*cross/6. If the total area is 0 return None, else the centroid [cx, cy] rounded to 6 decimals.
Why this case matters
Label placement, zonal summaries and map joins use polygon centroids; courtyards and multi-part parcels must pull the centroid correctly.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression #5 | [-1.0, -1.0] | [3.8, 3.8] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗