Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/Distance.java @ 3318:dbe2f85bf160
merged flys-artifacts/2.8
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:35 +0200 |
parents | 229e9b27ce15 |
children |
comparison
equal
deleted
inserted
replaced
2987:98c7a46ec5ae | 3318:dbe2f85bf160 |
---|---|
1 package de.intevation.flys.artifacts.math; | |
2 | |
3 /** Helper to calculate distance(s). */ | |
4 public final class Distance { | |
5 /** Return distance between two values. */ | |
6 public static double distance(double a, double b) { | |
7 return Math.abs(a - b); | |
8 } | |
9 | |
10 /** Return whether a and be are within a certain distance. */ | |
11 public static boolean within(double a, double b, double threshold) { | |
12 return distance(a, b) <= threshold; | |
13 } | |
14 } | |
15 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |