org.deegree_impl.model.ct
Class MatrixTransform

java.lang.Object
  extended byorg.deegree_impl.model.ct.AbstractMathTransform
      extended byorg.deegree_impl.model.ct.MatrixTransform
All Implemented Interfaces:
MathTransform, java.io.Serializable

final class MatrixTransform
extends AbstractMathTransform
implements java.io.Serializable

Transforms multi-dimensional coordinate points using a Matrix.

Version:
1.00
Author:
OpenGIS (www.opengis.org), Martin Desruisseaux

Nested Class Summary
(package private) static class MatrixTransform.Provider
          The provider for MatrixTransform.
 
Nested classes inherited from class org.deegree_impl.model.ct.AbstractMathTransform
AbstractMathTransform.Inverse
 
Field Summary
private  double[] elt
          Elements of the matrix.
private  int numCol
          the number of columns.
private  int numRow
          the number of rows.
private static long serialVersionUID
          Serial number for interoperability with different versions.
 
Constructor Summary
protected MatrixTransform(GMatrix matrix)
          Construct a transform.
 
Method Summary
 Matrix derivative(CoordinatePoint point)
          Gets the derivative of this transform at a point.
 Matrix derivative(java.awt.geom.Point2D point)
          Gets the derivative of this transform at a point.
 boolean equals(java.lang.Object object)
          Compares the specified object with this math transform for equality.
 int getDimSource()
          Gets the dimension of input points.
 int getDimTarget()
          Gets the dimension of output points.
 Matrix getMatrix()
          Returns a copy of the matrix.
 int hashCode()
          Returns a hash value for this transform.
 MathTransform inverse()
          Creates the inverse transform of this object.
 boolean isIdentity()
          Tests whether this transform does not move any points.
 java.lang.String toString()
          Returns the WKT for this math transform.
(package private) static java.lang.String toString(Matrix matrix)
          Returns the WKT for an affine transform using the specified matrix.
 void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
          Transforms an array of floating point coordinates by this matrix.
 void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
          Transforms an array of floating point coordinates by this matrix.
 
Methods inherited from class org.deegree_impl.model.ct.AbstractMathTransform
addParameter, addParameter, createTransformedShape, createTransformedShape, getName, paramMT, toOpenGIS, transform, transform
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial number for interoperability with different versions.

See Also:
Constant Field Values

numRow

private final int numRow
the number of rows.


numCol

private final int numCol
the number of columns.


elt

private final double[] elt
Elements of the matrix. Column indice vary fastest.

Constructor Detail

MatrixTransform

protected MatrixTransform(GMatrix matrix)
Construct a transform.

Method Detail

transform

public void transform(float[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
Transforms an array of floating point coordinates by this matrix. Point coordinates must have a dimension equals to Matrix#getNumCol-1. For example, for square matrix of size 4×4, coordinate points are three-dimensional and stored in the arrays starting at the specified offset (srcOff) in the order [x0, y0, z0, x1, y1, z1..., xn, yn, zn]. The transformed points (x',y',z') are computed as below (note that this computation is similar to PerspectiveTransform):
 [ u ]     [ m00  m01  m02  m03 ] [ x ]
 [ v ]  =  [ m10  m11  m12  m13 ] [ y ]
 [ w ]     [ m20  m21  m22  m23 ] [ z ]
 [ t ]     [ m30  m31  m32  m33 ] [ 1 ]

   x' = u/t
   y' = v/t
   y' = w/t
 

Specified by:
transform in interface MathTransform
Overrides:
transform in class AbstractMathTransform
Parameters:
srcPts - The array containing the source point coordinates.
srcOff - The offset to the first point to be transformed in the source array.
dstPts - The array into which the transformed point coordinates are returned.
dstOff - The offset to the location of the first transformed point that is stored in the destination array. The source and destination array sections can be overlaps.
numPts - The number of points to be transformed

transform

public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
Transforms an array of floating point coordinates by this matrix. Point coordinates must have a dimension equals to Matrix#getNumCol-1. For example, for square matrix of size 4×4, coordinate points are three-dimensional and stored in the arrays starting at the specified offset (srcOff) in the order [x0, y0, z0, x1, y1, z1..., xn, yn, zn]. The transformed points (x',y',z') are computed as below (note that this computation is similar to PerspectiveTransform):
 [ u ]     [ m00  m01  m02  m03 ] [ x ]
 [ v ]  =  [ m10  m11  m12  m13 ] [ y ]
 [ w ]     [ m20  m21  m22  m23 ] [ z ]
 [ t ]     [ m30  m31  m32  m33 ] [ 1 ]

   x' = u/t
   y' = v/t
   y' = w/t
 

Specified by:
transform in interface MathTransform
Parameters:
srcPts - The array containing the source point coordinates.
srcOff - The offset to the first point to be transformed in the source array.
dstPts - The array into which the transformed point coordinates are returned.
dstOff - The offset to the location of the first transformed point that is stored in the destination array. The source and destination array sections can be overlaps.
numPts - The number of points to be transformed

derivative

public Matrix derivative(java.awt.geom.Point2D point)
Gets the derivative of this transform at a point. For a matrix transform, the derivative is the same everywhere.

Overrides:
derivative in class AbstractMathTransform
Parameters:
point - The coordinate point where to evaluate the derivative.
Returns:
The derivative at the specified point as a 2x2 matrix.
See Also:
MathTransform2D.derivative(Point2D)

derivative

public Matrix derivative(CoordinatePoint point)
Gets the derivative of this transform at a point. For a matrix transform, the derivative is the same everywhere.

Specified by:
derivative in interface MathTransform
Overrides:
derivative in class AbstractMathTransform
Parameters:
point - The coordinate point where to evaluate the derivative.
Returns:
The derivative at the specified point (never null).

getMatrix

public Matrix getMatrix()
Returns a copy of the matrix.


getDimSource

public int getDimSource()
Gets the dimension of input points.

Specified by:
getDimSource in interface MathTransform
See Also:
CT_MathTransform.getDimSource()

getDimTarget

public int getDimTarget()
Gets the dimension of output points.

Specified by:
getDimTarget in interface MathTransform
See Also:
CT_MathTransform.getDimTarget()

isIdentity

public boolean isIdentity()
Tests whether this transform does not move any points.

Specified by:
isIdentity in interface MathTransform
Returns:
true if this MathTransform is an identity transform; false otherwise.

inverse

public MathTransform inverse()
                      throws NoninvertibleTransformException
Creates the inverse transform of this object.

Specified by:
inverse in interface MathTransform
Overrides:
inverse in class AbstractMathTransform
Throws:
NoninvertibleTransformException

hashCode

public int hashCode()
Returns a hash value for this transform. This value need not remain consistent between different implementations of the same class.

Overrides:
hashCode in class AbstractMathTransform

equals

public boolean equals(java.lang.Object object)
Compares the specified object with this math transform for equality.

Overrides:
equals in class AbstractMathTransform

toString

public java.lang.String toString()
Returns the WKT for this math transform.

Overrides:
toString in class AbstractMathTransform

toString

static java.lang.String toString(Matrix matrix)
Returns the WKT for an affine transform using the specified matrix.