Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearMetrics.java @ 805:bb7afd783321
Removed trailing whitespace. Added more javadoc.
gnv-artifacts/trunk@887 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 08 Apr 2010 11:31:44 +0000 |
parents | 6cff63d0c434 |
children | 05bf8534a35a |
comparison
equal
deleted
inserted
replaced
804:9058c08eac3a | 805:bb7afd783321 |
---|---|
1 package de.intevation.gnv.math; | 1 package de.intevation.gnv.math; |
2 | 2 |
3 import com.vividsolutions.jts.geom.Coordinate; | 3 import com.vividsolutions.jts.geom.Coordinate; |
4 | 4 |
5 /** | 5 /** |
6 * Implements {@link de.intevation.gnv.math.Metrics} | |
7 * for linear interpolations and distance measurements. | |
6 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | 8 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
7 */ | 9 */ |
8 public final class LinearMetrics | 10 public final class LinearMetrics |
9 implements Metrics | 11 implements Metrics |
10 { | 12 { |
13 /** | |
14 * Instance to prevent needless creations of instances. | |
15 */ | |
11 public static final Metrics INSTANCE = | 16 public static final Metrics INSTANCE = |
12 new LinearMetrics(); | 17 new LinearMetrics(); |
13 | 18 |
19 /** | |
20 * Implements the corresponding linear interpolator. | |
21 */ | |
14 public static final class LinearInterpolator | 22 public static final class LinearInterpolator |
15 implements Interpolator | 23 implements Interpolator |
16 { | 24 { |
17 private double mx; | 25 private double mx; |
18 private double bx; | 26 private double bx; |
19 private double my; | 27 private double my; |
20 private double by; | 28 private double by; |
21 | 29 |
30 /** | |
31 * Constructor to create a linear interpolator between two | |
32 * given points. | |
33 * @param p1 The first point. | |
34 * @param p2 The second point. | |
35 */ | |
22 public LinearInterpolator(Coordinate p1, Coordinate p2) { | 36 public LinearInterpolator(Coordinate p1, Coordinate p2) { |
23 | 37 |
24 /* | 38 /* |
25 I) p1.x = 0*m + bx | 39 I) p1.x = 0*m + bx |
26 II) p2.x = 1*m + bx | 40 II) p2.x = 1*m + bx |