georust / geo

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

Implement `CoordsIter` for arrays and slices #1146

Closed grovesNL closed 4 months ago

grovesNL commented 5 months ago

I found this useful so I could use extremes etc. on some kind of arbitrary coordinate list I'm already storing somewhere.

Many of the coordinate lists I'm using could technically form triangles but the points could be colinear or identical, so they don't follow the guarantees for Triangle. I also don't want to use MultiPoint for these because it would require creating another Vec (potentially thousands in my case).

I'm not sure if it makes sense to implement this for arrays and slices of Coord, Point, or both. For now it's only implemented at the Coord level.

grovesNL commented 5 months ago

I thought I might be able to use AsRef and ExactSizeIterator here instead (or even just as an iterator adapter with IntoIterator), but I wasn't sure how to make the types work out with CoordsIter, so I've kept it as two separate implementations (array and slices) for now

frewsxcv commented 5 months ago

Thanks! Will wait to see if others have feedback