sibartlett / Geo

A geospatial library for .NET
https://www.nuget.org/packages/Geo/
GNU Lesser General Public License v3.0
176 stars 39 forks source link

Implemented Polygon.Contains(Coordinate ) method #18

Closed asapostolov closed 4 years ago

asapostolov commented 8 years ago

Implemented the Polygon.Contains method described here

http://alienryderflex.com/polygon/

Also made some Tests for it.

If you need to see the polygon which I test against you can check it out with this script https://gist.github.com/asapostolov/35bb3e03b7f5dedaa000

Please review the code and share your thoughts.

sibartlett commented 8 years ago

Hi, thank you for the pull request.

Unfortunately I can not merge it. The algorithm you have implemented is for polygons on a 2D plane.

As Geo specializes in geometries on a Earth-like spheroid or sphere - we'd ideally need an algorithm that takes that into account, and as part of that it would also need to support polygons that intersect with the poles or date line.

I've been meaning to look at Google's s2 geometry library, which we may be able to use for some inspiration. However we'd need to be careful as I am not sure if the Apache license is compatible with the LGPL license.

asapostolov commented 8 years ago

Hey, thanks for the feedback.

I'll take a look at the s2 library. On first glance it seems that there are lot of things going on in there.

I'll think about how can we translate the algorithms in there to fit our cases.