org.geotools.referencing.operation.matrix
Class Matrix2

java.lang.Object
  extended byorg.geotools.referencing.operation.matrix.Matrix2
All Implemented Interfaces:
org.opengis.util.Cloneable, java.lang.Cloneable, org.opengis.referencing.operation.Matrix, java.io.Serializable, XMatrix

public class Matrix2
extends java.lang.Object
implements XMatrix, java.io.Serializable

A matrix of fixed {@value}×{@value} size.

Since:
2.2
Version:
$Id: Matrix2.java 17964 2006-02-10 11:27:41Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
 double m00
          The first matrix element in the first row.
 double m01
          The second matrix element in the first row.
 double m10
          The first matrix element in the second row.
 double m11
          The second matrix element in the second row.
static int SIZE
          The matrix size, which is 2.
 
Constructor Summary
Matrix2()
          Creates a new identity matrix.
Matrix2(double m00, double m01, double m10, double m11)
          Creates a new matrix initialized to the specified values.
Matrix2(org.opengis.referencing.operation.Matrix matrix)
          Creates a new matrix initialized to the same value than the specified one.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this matrix.
 boolean equals(java.lang.Object object)
          Returns if the specified object is of type and all of the data members are equal to the corresponding data members in this matrix.
 double getElement(int row, int col)
          Returns the element at the specified index.
 int getNumCol()
          Returns the number of colmuns in this matrix, which is always {@value} in this implementation.
 int getNumRow()
          Returns the number of rows in this matrix, which is always {@value} in this implementation.
 int hashCode()
          Returns a hash code value based on the data values in this object.
 void invert()
          Inverts this matrix in place.
 boolean isAffine()
          Returns if this matrix is an affine transform. A transform is affine if the matrix is square and last row contains only zeros, except in the last column which contains 1.
 boolean isIdentity()
          Returns if this matrix is an identity matrix.
 void multiply(org.opengis.referencing.operation.Matrix matrix)
          Sets the value of this matrix to the result of multiplying itself with the specified matrix. In other words, performs = × . In the context of coordinate transformations, this is equivalent to AffineTransform.concatenate: first transforms by the supplied transform and then transform the result by the original transform.
 void negate()
          Negates the value of this matrix: = .
 void setElement(int row, int col, double value)
          Set the element at the specified index.
 void setIdentity()
          Sets this matrix to the identity matrix.
 void setZero()
          Sets all the values in this matrix to zero.
 java.lang.String toString()
          Returns a string representation of this matrix.
 void transpose()
          Sets the value of this matrix to its transpose.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE

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

See Also:
Constant Field Values

m00

public double m00
The first matrix element in the first row.


m01

public double m01
The second matrix element in the first row.


m10

public double m10
The first matrix element in the second row.


m11

public double m11
The second matrix element in the second row.

Constructor Detail

Matrix2

public Matrix2()
Creates a new identity matrix.


Matrix2

public Matrix2(double m00,
               double m01,
               double m10,
               double m11)
Creates a new matrix initialized to the specified values.


Matrix2

public Matrix2(org.opengis.referencing.operation.Matrix matrix)
Creates a new matrix initialized to the same value than the specified one. The specified matrix size must be {@value}×{@value}.

Method Detail

getNumRow

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

Specified by:
getNumRow in interface org.opengis.referencing.operation.Matrix

getNumCol

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

Specified by:
getNumCol in interface org.opengis.referencing.operation.Matrix

getElement

public final double getElement(int row,
                               int col)
Returns the element at the specified index.

Specified by:
getElement in interface org.opengis.referencing.operation.Matrix

setElement

public final void setElement(int row,
                             int col,
                             double value)
Set the element at the specified index.

Specified by:
setElement in interface org.opengis.referencing.operation.Matrix

setZero

public final void setZero()
Sets all the values in this matrix to zero.

Specified by:
setZero in interface XMatrix

setIdentity

public final void setIdentity()
Sets this matrix to the identity matrix.

Specified by:
setIdentity in interface XMatrix

isIdentity

public final boolean isIdentity()
Returns if this matrix is an identity matrix.

Specified by:
isIdentity in interface org.opengis.referencing.operation.Matrix

isAffine

public final boolean isAffine()
Returns if this matrix is an affine transform. A transform is affine if the matrix is square and last row contains only zeros, except in the last column which contains 1.

Specified by:
isAffine in interface XMatrix

negate

public final void negate()
Negates the value of this matrix: = .

Specified by:
negate in interface XMatrix

transpose

public final void transpose()
Sets the value of this matrix to its transpose.

Specified by:
transpose in interface XMatrix

invert

public final void invert()
Inverts this matrix in place.

Specified by:
invert in interface XMatrix

multiply

public final void multiply(org.opengis.referencing.operation.Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix. In other words, performs = × . In the context of coordinate transformations, this is equivalent to AffineTransform.concatenate: first transforms by the supplied transform and then transform the result by the original transform.

Specified by:
multiply in interface XMatrix

equals

public boolean equals(java.lang.Object object)
Returns if the specified object is of type and all of the data members are equal to the corresponding data members in this matrix.


hashCode

public int hashCode()
Returns a hash code value based on the data values in this object.


toString

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


clone

public java.lang.Object clone()
Returns a clone of this matrix.

Specified by:
clone in interface org.opengis.referencing.operation.Matrix


Copyright © GeoTools. All Rights Reserved.