annotate gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearFunction.java @ 365:f66088a43ecc

Added horizontal crossprofile charts to chart pallet. Fixed some bugs before interpolation. gnv-artifacts/trunk@440 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 16 Dec 2009 19:29:05 +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:

http://dive4elements.wald.intevation.org