Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearFunction.java @ 371:bc00848f0350
Remove wkt line strings from i18n
gnv-artifacts/trunk@452 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 17 Dec 2009 15:39:20 +0000 |
parents | 25e4724aa504 |
children | 828df3ddb758 |
rev | line source |
---|---|
357
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.math; |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import org.apache.commons.math.optimization.fitting.ParametricRealFunction; |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import org.apache.commons.math.FunctionEvaluationException; |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 /** |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 * @author Sascha L. Teichmann |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 */ |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 public class LinearFunction |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 implements ParametricRealFunction |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 { |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 public static final LinearFunction INSTANCE = new LinearFunction(); |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 public LinearFunction() { |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 } |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 public double value(double x, double [] parameters) |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 throws FunctionEvaluationException |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 { |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 return x*parameters[0] + parameters[1]; |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 } |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 public double [] gradient(double x, double [] parameters) |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 throws FunctionEvaluationException |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 { |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 return new double [] { x, 1f }; |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 } |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
25e4724aa504
Fill (i, j)-gaps when building index buffer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |