org.geotoolkit.referencing.operation.matrix
Class AffineMatrix3

Object
  extended by AffineTransform
      extended by AffineMatrix3
All Implemented Interfaces:
Serializable, Cloneable, Matrix

public class AffineMatrix3
extends AffineTransform
implements Matrix, Cloneable

An affine matrix of fixed 3×3 size. Here, the term "affine" means a matrix with the last row fixed to [0,0,1] values. Such matrices are used for affine transformations in a 2D space.

This class both extends the Java2D AffineTransform class and implements the Matrix interface. It allows interoperbility for code that need to pass the same matrix to both Java2D API and more generic API working with coordinates of arbitrary dimension.

Note: This class does not implement the XMatrix interface because the inherited invert() method (new in Java 6) declares a checked exception, setZero() would be an unsupported operation since it is not possible to change the value of element (2,2), transpose() would fail in most cases and isAffine() would be useless.

Since:
2.3
Version:
3.00
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form
Module:
referencing/geotk-referencing (download)    View source code for this class

Field Summary
static int SIZE
          The matrix size, which is 3.
 
Fields inherited from class AffineTransform
TYPE_FLIP, TYPE_GENERAL_ROTATION, TYPE_GENERAL_SCALE, TYPE_GENERAL_TRANSFORM, TYPE_IDENTITY, TYPE_MASK_ROTATION, TYPE_MASK_SCALE, TYPE_QUADRANT_ROTATION, TYPE_TRANSLATION, TYPE_UNIFORM_SCALE
 
Constructor Summary
AffineMatrix3()
          Creates a new identity matrix.
AffineMatrix3(AffineTransform transform)
          Constructs a 3×3 matrix from the specified affine transform.
AffineMatrix3(double m00, double m10, double m01, double m11, double m02, double m12)
          Constructs a 3×3 matrix from the specified element values.
AffineMatrix3(Matrix matrix)
          Creates a new matrix initialized to the same value than the specified one.
 
Method Summary
 AffineMatrix3 clone()
          Returns a clone of this affine transform.
 double getElement(int row, int column)
          Retrieves the value at the specified row and column of this matrix.
 int getNumCol()
          Returns the number of colmuns in this matrix, which is always 3 in this implementation.
 int getNumRow()
          Returns the number of rows in this matrix, which is always 3 in this implementation.
 void setElement(int row, int column, double value)
          Modifies the value at the specified row and column of this matrix.
 String toString()
          Returns a string representation of this matrix.
 
Methods inherited from class AffineTransform
concatenate, createInverse, createTransformedShape, deltaTransform, deltaTransform, equals, getDeterminant, getMatrix, getQuadrantRotateInstance, getQuadrantRotateInstance, getRotateInstance, getRotateInstance, getRotateInstance, getRotateInstance, getScaleInstance, getScaleX, getScaleY, getShearInstance, getShearX, getShearY, getTranslateInstance, getTranslateX, getTranslateY, getType, hashCode, inverseTransform, inverseTransform, invert, isIdentity, preConcatenate, quadrantRotate, quadrantRotate, rotate, rotate, rotate, rotate, scale, setToIdentity, setToQuadrantRotation, setToQuadrantRotation, setToRotation, setToRotation, setToRotation, setToRotation, setToScale, setToShear, setToTranslation, setTransform, setTransform, shear, transform, transform, transform, transform, transform, transform, translate
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Matrix
isIdentity
 

Field Detail

SIZE

public static final int SIZE
The matrix size, which is 3.

See Also:
Constant Field Values
Constructor Detail

AffineMatrix3

public AffineMatrix3()
Creates a new identity matrix.


AffineMatrix3

public AffineMatrix3(double m00,
                     double m10,
                     double m01,
                     double m11,
                     double m02,
                     double m12)
Constructs a 3×3 matrix from the specified element values.

Parameters:
m00 - the X scaling element.
m10 - the Y shearing element.
m01 - the X shearing element.
m11 - the Y scaling element.
m02 - the X translation element.
m12 - the Y translation element.
Since:
3.00

AffineMatrix3

public AffineMatrix3(AffineTransform transform)
Constructs a 3×3 matrix from the specified affine transform.

Parameters:
transform - The affine transform to copy.

AffineMatrix3

public AffineMatrix3(Matrix matrix)
              throws IllegalArgumentException
Creates a new matrix initialized to the same value than the specified one. The specified matrix size must be 3×3.

Parameters:
matrix - The matrix to copy.
Throws:
IllegalArgumentException - if the given matrix is not of the expected size.
Method Detail

getNumRow

public final int getNumRow()
Returns the number of rows in this matrix, which is always 3 in this implementation.

Specified by:
getNumRow in interface Matrix

getNumCol

public final int getNumCol()
Returns the number of colmuns in this matrix, which is always 3 in this implementation.

Specified by:
getNumCol in interface Matrix

getElement

public double getElement(int row,
                         int column)
Retrieves the value at the specified row and column of this matrix.

Specified by:
getElement in interface Matrix
Parameters:
row - The row number to be retrieved (zero indexed).
column - The column number to be retrieved (zero indexed).
Returns:
The value at the indexed element.

setElement

public void setElement(int row,
                       int column,
                       double value)
Modifies the value at the specified row and column of this matrix.

Specified by:
setElement in interface Matrix
Parameters:
row - The row number to be retrieved (zero indexed).
column - The column number to be retrieved (zero indexed).
value - The new matrix element value.

toString

public String toString()
Returns a string representation of this matrix. The returned string is implementation dependent. It is usually provided for debugging purposes only.

Overrides:
toString in class AffineTransform

clone

public AffineMatrix3 clone()
Returns a clone of this affine transform.

Specified by:
clone in interface Matrix
Overrides:
clone in class AffineTransform


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.