Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private double addLatitude(double base, double offset) {
- double newLatitude = base + offset;
- if (newLatitude <= LATITUDE_BOUND) {
- return newLatitude;
- } else {
- return -(crossBound(newLatitude, LATITUDE_BOUND));
- }
- }
- private double subtractLatitude(double base, double offset) {
- double newLatitude = base - offset;
- if (newLatitude >= -LATITUDE_BOUND) {
- return newLatitude;
- } else {
- return crossBound(newLatitude, LATITUDE_BOUND);
- }
- }
- private double addLongitude(double base, double offset) {
- double newLongitude = base + offset;
- if (newLongitude <= LONGITUDE_BOUND) {
- return newLongitude;
- } else {
- return crossBound(newLongitude, LONGITUDE_BOUND);
- }
- }
- private double subtractLongitude(double base, double offset) {
- double newLongitude = base - offset;
- if (newLongitude >= -LONGITUDE_BOUND) {
- return newLongitude;
- } else {
- return -(crossBound(newLongitude, LONGITUDE_BOUND));
- }
- }
- private double crossBound(double newValue, double bound) {
- return bound - (Math.abs(newValue) - bound);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement