Thread: PHP GeoLocation
View Single Post
Old 12-26-2009, 05:07 PM   #9 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,298
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Jarod B View Post
Try this, I worked with something like this once with graph dimensions once. I dont remember it exactly, but from how I've always consider it was to imagine it as a square. So point 1, 2, 3, and 4 are the cases...
PHP Code:
if( (144.30.39.82 <= -38.16.22.00) && /*Point #1*/
    
(144.31.12.99 <= -38.16.16.20) && /*Point #2*/
    
(144.30.41.77 <= -38.16.37.09) && /*Point #3*/
    
(144.31.12.74 <= -38.16.33.05)    /*Point #4*/ ) {
    print(
"You are within this area");

As I explained in my previous post, that is not a rectangle so you can not do that. You have to check it against the equation of each line opposed to the points themselves. Cheking it your way also only works when the rectangle's sides are either perpendicular or parallel with the axis.
__________________

Village Idiot is offline  
Reply With Quote