Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/Distance.java @ 3468:f37e7e8907cb
merged flys-artifacts/2.8.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:39 +0200 |
parents | 229e9b27ce15 |
children |
comparison
equal
deleted
inserted
replaced
3387:5ffad8bde8ad | 3468:f37e7e8907cb |
---|---|
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 : |