Created
March 5, 2018 12:48
-
-
Save jens-a-e/2174dc29c1d1362831617ccc2defe0ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean withinPosition(float lat, float lon, float tolarance) { | |
float gpsLat, gpsLong; | |
// read gps... | |
tolarance = tolarance / 1000.0; // 10 => 0.0010 | |
// Check position within tolarance | |
boolean isLat = lat >= gpsLat - tolarance && lat <= gpsLat+tolarance; | |
boolean isLon = lon >= gpsLon - tolarance && lon <= gpsLong+tolarance; | |
return isLat && isLon; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment