ladybug-tools / ladybug-geometry

🐞 📦 A library with geometry objects used throughout the Ladybug Tools core libraries
https://www.ladybug.tools/ladybug-geometry/docs/
GNU Affero General Public License v3.0
25 stars 23 forks source link

fix(polygon): Improve tolerance with removing colinear vertices #416

Closed chriswmackey closed 1 month ago

chriswmackey commented 1 month ago

This should help ensure the method gives more accurate results when removing colinear vertices at a tolerance that is 6 significant figures smaller than the polygon vertices.

The method essentially corrects for the "area of triangle" assumption that we use, dividing this area by 2 to relate it to the height of the triangle (aka. distance from collinearity). Also, we account for the fact that multiple skipped vertices compound this area, meaning that, with a lot of skipped vertices, there's a chance that some should be kept.