Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java @ 808:2e951160c43d
Finished the javadoc of the math package.
gnv-artifacts/trunk@890 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 08 Apr 2010 16:35:02 +0000 |
parents | 6cff63d0c434 |
children | 43f3c0cd60f2 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java Thu Apr 08 15:24:45 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java Thu Apr 08 16:35:02 2010 +0000 @@ -15,6 +15,9 @@ import org.apache.log4j.Logger; /** + * Interpolates parameter values along a given line string from surface + * to the sea ground to generate "Profilschnitte". + * * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class Interpolation3D @@ -22,57 +25,128 @@ { private static Logger log = Logger.getLogger(Interpolation3D.class); + /** + * The default width of the interpolation: {@value} + */ public static final int DEFAULT_WIDTH = 1024; + + /** + * The default height of the interpolation: {@value} + */ public static final int DEFAULT_HEIGHT = 768; + /** + * Epsilon for numerical stability. + */ public static final double EPS = 1e-6d; + /** + * The width of the interpolation. + */ protected int width; + + /** + * The height of the interpolation. + */ protected int height; + /** + * The cell width of the interpolation in world units. + */ protected double cellWidth; + + /** + * The cell height of the interpolation in world units. + */ protected double cellHeight; + /** + * The generated raster. + */ protected double [] raster; + + /** + * The sea ground depth along the line string. + */ protected double [] depths; + /** + * Default constructor. + */ public Interpolation3D() { this(DEFAULT_WIDTH, DEFAULT_HEIGHT); } + /** + * Constructor to create a Interpolation3D with a given size. + * @param size The size of the interpolation. + */ public Interpolation3D(Dimension size) { this(size.width, size.height); } + /** + * Constructor to create a Interpolation3D with a given size. + * @param width The width of the interpolation. + * @param height the height of the interpolation. + */ public Interpolation3D(int width, int height) { this.width = width; this.height = height; } + /** + * Returns the raster height of the interpolation. + * @return The raster height of the interpolation. + */ public int getHeight() { return height; } + /** + * Returns the raster width of the interpolation. + * @return The raster width of the interpolation. + */ public int getWidth() { return width; } + /** + * Returns the cell width of the interpolation in world units. + * @return The cell width of the interpolation in world units. + */ public double getCellWidth() { return cellWidth; } + /** + * Returns the cell height of the interpolation in world units. + * @return The cell height of the interpolation in world units. + */ public double getCellHeight() { return cellHeight; } + /** + * Returns the generated raster. + * @return The generated raster. + */ public double [] getRaster() { return raster; } + /** + * Returns the depths along the line string path. + * @return The depth along the line string path. + */ public double [] getDepths() { return depths; } + /** + * Returns the deepest depth along the line string path. + * @return The deepest depth along the line string path. + */ public double getMaxDepth() { double maxDepth = Double.MAX_VALUE; for (int i = depths!=null?depths.length-1:0; i >= 0; --i) { @@ -84,6 +158,17 @@ return maxDepth; } + /** + * Interpolates parameters along a given line string path from the surface + * to the sea ground. + * @param path The line string path. + * @param points The sample points. + * @param from Start point in scalar terms of the line string. + * @param to End point in scalar terms of the line string. + * @param metrics The used metric. + * @param xyDepth The callback to query the depth at a given point. + * @return true if the interpolation succeeds, else false. + */ public boolean interpolate( List<? extends Coordinate> path, List<? extends XYColumn> points,