I'm using the Google S2 Geometry library to check whether a given geo point is within a polygon.
The following assertion should pass, but is failing and I'm unable to explain what's going wrong:
std::vector<S2Point> vertices = {
S2LatLng::FromDegrees(60, -118).ToPoint(),
S2LatLng::FromDegrees(23, -118).ToPoint(),
S2LatLng::FromDegrees(23, 34).ToPoint(),
S2LatLng::FromDegrees(60, 34).ToPoint(),
};
auto loop = new S2Loop(vertices, S2Debug::DISABLE);
S2Point p = S2LatLng::FromDegrees(42.716450, -67.079284).ToPoint();
ASSERT_TRUE(loop->Contains(p));
The point is certainly within the polygon indicated by the vertices but S2 says that the point is not inside.