Open rtavenner opened 5 years ago
To my knowledge the first and last point of a polygon has to be the same. I can try to take a look why this is not the case in this example. Chances are though, that it might be a bug with the algorithm itself. Have just checked this with the original version as well?
I cannot figure out how to test the Javascript version. Sorry.
FYI: https://github.com/w8r/martinez/issues/99
The intersection points in the result are correct, there are just in the wrong order. This seems to be a rounding issue (i.e. 631 instead of 531 works correctly).
As far as I can tell, the
geo_types::LineString
in ageo_types::Polygon
is supposed to have its first and last coordinates be the same. (I believe this is what the docs mean by "closed". Is that correct?) I have found a case wherepoly1
andpoly2
both satisfy that condition, butpoly1.intersection(&poly2)
does not.Is this a bug? Or am I just doing something wrong?
Cargo.toml
main.rs
Output: