Lat-Lon Point is in rectangle defined by two other

2019-09-13 20:17发布

I would like to determine if a certain point is contained within a 'rectangle'. The 'rectangle' will be made up of latitude/longitude coordinates (given northWest and southEast coordinate points)... so basically here are the parameters:

public boolean hasPoint(LatLon northWest, LatLon southEast, LatLon point) {}

The LatLon class just has: double latitude; double longitude;

I have no idea how to start this... any help will be appreciated.

1条回答
爷、活的狠高调
2楼-- · 2019-09-13 20:39

Assuming this LatLon class just has an x and y value. How about just checking if your point x/y lies between the x/y from your other 2 positions ?

查看更多
登录 后发表回答