net.sf.latexdraw.parsers.svg
Class SVGMatrix

java.lang.Object
  extended by net.sf.latexdraw.parsers.svg.SVGMatrix

public class SVGMatrix
extends java.lang.Object

Defines a matrix according to the SVG specifications.

This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

10/16/07

Since:
0.1
Version:
3.0
Author:
Arnaud BLOUIN

Field Summary
protected  double a
          [a, c, e, b, d, f, 0, 0, 1] An element of the matrix.
protected  double b
          [a, c, e, b, d, f, 0, 0, 1] An element of the matrix.
protected  double c
          [a, c, e, b, d, f, 0, 0, 1] An element of the matrix.
protected  double d
          [a, c, e, b, d, f, 0, 0, 1] An element of the matrix.
protected  double e
          [a, c, e, b, d, f, 0, 0, 1] An element of the matrix.
protected  double f
          [a, c, e, b, d, f, 0, 0, 1] An element of the matrix.
static int HEIGHT
           
static int WIDTH
           
 
Constructor Summary
SVGMatrix()
          Creates a matrix by initialising it as the identity.
 
Method Summary
 double getA()
           
 double getB()
           
 double getC()
           
 double getD()
           
 double getE()
           
 double getF()
           
 void initMatrix()
          Initialises the matrix as the identity.
 SVGMatrix multiply(SVGMatrix m)
           
 void rotate(double angle)
          Rotates the matrix (without reinitialisation).
 void scale(double scaleFactor)
          Scales the matrix (without reinitialisation).
 void scaleNonUniform(double scaleFactorX, double scaleFactorY)
          Scales the matrix (without reinitialisation).
 void setMatrix(double a, double b, double c, double d, double e, double f)
          Sets the matrix with the given values.
 void skewX(double angle)
          Skews the matrix (without reinitialisation).
 void skewY(double angle)
          Skews the matrix (without reinitialisation).
 java.lang.String toString()
           
 void translate(double x, double y)
          Translates the matrix (without reinitialisation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WIDTH

public static final int WIDTH
See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
See Also:
Constant Field Values

a

protected double a
[a, c, e, b, d, f, 0, 0, 1] An element of the matrix.


b

protected double b
[a, c, e, b, d, f, 0, 0, 1] An element of the matrix.


c

protected double c
[a, c, e, b, d, f, 0, 0, 1] An element of the matrix.


d

protected double d
[a, c, e, b, d, f, 0, 0, 1] An element of the matrix.


e

protected double e
[a, c, e, b, d, f, 0, 0, 1] An element of the matrix.


f

protected double f
[a, c, e, b, d, f, 0, 0, 1] An element of the matrix.

Constructor Detail

SVGMatrix

public SVGMatrix()
Creates a matrix by initialising it as the identity.

Since:
0.1
Method Detail

initMatrix

public void initMatrix()
Initialises the matrix as the identity.

Since:
0.1

rotate

public void rotate(double angle)
Rotates the matrix (without reinitialisation).

Parameters:
angle - The angle of rotation (in radian).
Since:
0.1

translate

public void translate(double x,
                      double y)
Translates the matrix (without reinitialisation).

Parameters:
x - The x translation.
y - The y translation.
Since:
0.1

scale

public void scale(double scaleFactor)
Scales the matrix (without reinitialisation).

Parameters:
scaleFactor - The scale factor.
Since:
0.1

scaleNonUniform

public void scaleNonUniform(double scaleFactorX,
                            double scaleFactorY)
Scales the matrix (without reinitialisation).

Parameters:
scaleFactorX - The x scale factor.
scaleFactorY - The y scale factor.
Since:
0.1

skewX

public void skewX(double angle)
Skews the matrix (without reinitialisation).

Parameters:
angle - The X angle.
Since:
0.1

skewY

public void skewY(double angle)
Skews the matrix (without reinitialisation).

Parameters:
angle - The Y angle.
Since:
0.1

multiply

public SVGMatrix multiply(SVGMatrix m)
Parameters:
m - The matrix to multiply to the called matrix: this * m = out. Or null if m is null.
Returns:
Creates a SVGMatrix from the multiplication of the two given matrixes.

setMatrix

public void setMatrix(double a,
                      double b,
                      double c,
                      double d,
                      double e,
                      double f)
Sets the matrix with the given values.

Parameters:
a - The values of the matrix: [a, c, e, b, d, f, 0, 0, 1].
b - The values of the matrix: [a, c, e, b, d, f, 0, 0, 1].
c - The values of the matrix: [a, c, e, b, d, f, 0, 0, 1].
d - The values of the matrix: [a, c, e, b, d, f, 0, 0, 1].
e - The values of the matrix: [a, c, e, b, d, f, 0, 0, 1].
f - The values of the matrix: [a, c, e, b, d, f, 0, 0, 1].
Since:
0.1

getA

public double getA()
Returns:
The (0,0) element of the matrix.
Since:
0.1

getB

public double getB()
Returns:
The (1,0) element of the matrix.
Since:
0.1

getC

public double getC()
Returns:
The (2,0) element of the matrix.
Since:
0.1

getD

public double getD()
Returns:
The (0,1) element of the matrix.
Since:
0.1

getE

public double getE()
Returns:
The (1,1) element of the matrix.
Since:
0.1

getF

public double getF()
Returns:
The (2,1) element of the matrix.
Since:
0.1

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object