[PATCH 4 of 4] issue1462: 1) & 4) Fix wrong density interpolation code

Wald Commits scm-commit at wald.intevation.org
Fri Aug 30 09:37:54 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1377848891 -7200
# Node ID 13c2762270a66f70496aaa05b62fcf494ebbdfbd
# Parent  d4108d6c400088d643bbb041076fd19673205b20
issue1462: 1) & 4) Fix wrong density interpolation code.

diff -r d4108d6c4000 -r 13c2762270a6 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java	Fri Aug 30 09:47:15 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java	Fri Aug 30 09:48:11 2013 +0200
@@ -129,9 +129,8 @@
         double upperDensity = next.getDensity();
         double lowerDensity = prev.getDensity();
 
-        double m =(upperDensity - lowerDensity)/(upper - lower) * km;
-        double b = lowerDensity -
-            ((upperDensity - lowerDensity)/(upper - lower) * lower);
+        double m =(upperDensity - lowerDensity)/(upper - lower);
+        double b = lowerDensity - (m * lower);
         return (m * km) + b;
     }
 


More information about the Dive4elements-commits mailing list