teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.math; felix@3246: felix@3246: /** Helper to calculate distance(s). */ felix@3246: public final class Distance { felix@3246: /** Return distance between two values. */ felix@3246: public static double distance(double a, double b) { felix@3246: return Math.abs(a - b); felix@3246: } felix@3246: felix@3246: /** Return whether a and be are within a certain distance. */ felix@3246: public static boolean within(double a, double b, double threshold) { felix@3246: return distance(a, b) <= threshold; felix@3246: } felix@3246: } felix@3246: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :