问题
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:
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 ?
来源:https://stackoverflow.com/questions/42823844/lat-lon-point-is-in-rectangle-defined-by-two-other-lat-lon-points