Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/shared/Transform2D.java @ 605:9e30c776cbef
Improved the exception handling.
flys-client/trunk@2212 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 23 Jun 2011 09:22:54 +0000 |
parents | 017371801479 |
children | ea2191b1299d |
line wrap: on
line source
package de.intevation.flys.client.shared; import java.io.Serializable; /** * This object supports a linear transformation to transform xy coordinates into * an other coordinate system based on scale and translation values. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class Transform2D implements Serializable { protected double sx; protected double sy; protected double tx; protected double ty; public Transform2D() { } /** * Creates a new transformation with scale and translation factors. * * @param sx The scale factor for the x axis. * @param sy The scale factor for the y axis. * @param tx The translation factor for the x axis. * @param ty The translation factor for the y axis. */ public Transform2D(double sx, double sy, double tx, double ty) { this.sx = sx; this.sy = sy; this.tx = tx; this.ty = ty; } /** * Transforms the pixel x and y into a new coordinate system based on the * scale and translation values specified in the constructor. */ public double[] transform(double x, double y) { double resX = sx * x + tx; double resY = sy * y + ty; return new double[] { resX, resY }; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :