X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fgraphics%2FAffine.java;h=027f0486e0c1863efa60fec7abdc658ac478551b;hb=0db31fc0dc88749cd8022790fd475df8b7b06c27;hp=31e2e2b25dada1a0ccb1d20537251292b10b617f;hpb=8e190fb0ff508ccf4962bbfbf8295a431805c12b;p=org.ibex.core.git diff --git a/src/org/ibex/graphics/Affine.java b/src/org/ibex/graphics/Affine.java index 31e2e2b..027f048 100644 --- a/src/org/ibex/graphics/Affine.java +++ b/src/org/ibex/graphics/Affine.java @@ -1,5 +1,8 @@ +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the GNU General Public License version 2 ("the License"). +// You may not use this file except in compliance with the License. + // FIXME -// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL] package org.ibex.graphics; import java.util.*; @@ -48,6 +51,18 @@ public final class Affine { return this; } + /** this = a * this */ + public Affine premultiply(Affine A) { + float _a = A.a * this.a + A.b * this.c; + float _b = A.a * this.b + A.b * this.d; + float _c = A.c * this.a + A.d * this.c; + float _d = A.c * this.b + A.d * this.d; + float _e = A.e * this.a + A.f * this.c + this.e; + float _f = A.e * this.b + A.f * this.d + this.f; + a = _a; b = _b; c = _c; d = _d; e = _e; f = _f; + return this; + } + public void invert() { float det = 1 / (a * d - b * c); float _a = d * det;