georust / geo

Geospatial primitives and algorithms for Rust
https://crates.io/crates/geo
Other
1.54k stars 197 forks source link

Clarify that the `triangles` method does _not_ do triangulation #1003

Open frewsxcv opened 1 year ago

frewsxcv commented 1 year ago

https://docs.rs/geo/0.24.1/geo/geometry/struct.LineString.html#method.triangles

Would be good to clarify now that we are considering adding a Triangulate algorithm

michaelkirk commented 1 year ago

This is sort of an aside, but what is the use case for LineString::triangles?

Does anyone know of another geospatial package that implements such an algorithm?

edit: to clarify, I understand why a triangulation algorithm is useful (e.g. Delaunay triangulation), but the LineString::triangles algorithm we have is very different (hence this issue) — it returns a series of overlapping triangles made from the sliding window of 3 coordinates of the linestring.

frewsxcv commented 1 year ago

It's used in our simplify algorithms:

https://github.com/georust/geo/blob/2b3f7b94f4f7aa9cab65e4d2db7ff09d8bf86177/geo/src/algorithm/simplify_vw.rs#L98-L114

frewsxcv commented 1 year ago

We could rename it to triangle_windows to match the naming scheme of slice#windows (as opposed to slice#chunks)