Well my question was more related to people who have used this 2D calculation,
and what are the resoults there getting? Dose actully created polygon from a latlng(s)
and a given random point(latlng) returns correct outcome. I dont know how to use this methods as can be seen all are taking a int values for the poly points, but we have angles in the case of lat lng...
>> In spherical geometry (which is indeed 2D)
Sperical forms are 3D objects and only a 3D objects, in this kind of objects the values changes per 3 axes but this is found to be not important for a
proper Sperical object(a ball) because the R stays all the time the same. For the Earth this R= 6371000 so the only important stuff for positioning are the angles which are showing the exact position on the surface.
There values moves from -90 to 90 and -180 to 180.
So if we take the example that you said a 'circle' on a sphere, teoreticaly there isnt this kind of circle, because this is a part of the sphere that looks like eg baseboll hat, and I dont know how is called in english because its not my native language. But lets take this as a examle the head is the Earth then the hat on the head is a "circle". So we all here ask the question, dose a point with a given latlng is "inside" this circle, but the real question is dose this point lays out on the surface of the head which is overlaped with the hat.
As an example if we take a distance between 2 points on the surface:
this would be the correct 3D formula:
distance = Math.acos(latPoint1) * Math.sin(latPoint2) +
Math.cos(latPoint1) * Math.cos(latPoint2) * Math.cos(lngPoint1 - lngPoint2)) * EARTH_RADIUS;
- counting 2D space will have to use the very famous pitagora teorema
So there is a big difference.
Also in the js maps libs there is a pakage called geometry and you can see most of the methods are getting a EARTH_RADIUS as a optional parameter so minning this is used inside, and all the solution from the link(2D) uses just normal int x,y values for the points.
google.maps.geometry.spherical namespace