Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/LinearRemap.java @ 452:343f248e4c8c
use correct kms and step width now now
flys-artifacts/trunk@1948 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 19 May 2011 09:24:08 +0000 |
parents | 909196be11a0 |
children | f0c1250d1e7b |
comparison
equal
deleted
inserted
replaced
451:73bc64c4a7b0 | 452:343f248e4c8c |
---|---|
1 package de.intevation.flys.artifacts.math; | 1 package de.intevation.flys.artifacts.math; |
2 | |
3 import org.apache.log4j.Logger; | |
2 | 4 |
3 public class LinearRemap | 5 public class LinearRemap |
4 { | 6 { |
7 private static Logger logger = Logger.getLogger(LinearRemap.class); | |
8 | |
5 public static class Segment { | 9 public static class Segment { |
6 | 10 |
7 protected Segment next; | 11 protected Segment next; |
8 | 12 |
9 protected double from; | 13 protected double from; |
56 m = (y2 - y1)/(x2 - x1); | 60 m = (y2 - y1)/(x2 - x1); |
57 b = y1 - m*x1; | 61 b = y1 - m*x1; |
58 } | 62 } |
59 | 63 |
60 head = new Segment(from, to, m, b, head); | 64 head = new Segment(from, to, m, b, head); |
65 | |
66 if (logger.isDebugEnabled()) { | |
67 logger.debug("LinearRemap.add --------- enter"); | |
68 logger.debug(" range: [" + from + ", " + to + "]"); | |
69 logger.debug(" " + x1 + " -> " + y1 + " (" + head.eval(x1) + ")"); | |
70 logger.debug(" " + x2 + " -> " + y2 + " (" + head.eval(x2) + ")"); | |
71 logger.debug("LinearRemap.add --------- leave"); | |
72 } | |
61 } | 73 } |
62 | 74 |
63 public double eval(double pos, double x) { | 75 public double eval(double pos, double x) { |
64 Segment current = head; | 76 Segment current = head; |
65 | 77 |