|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormattableObject
AbstractMathTransform
ProjectiveTransform
@Immutable public class ProjectiveTransform
A usually affine, or otherwise a projective transform. A projective transform is capable of mapping an arbitrary quadrilateral into another arbitrary quadrilateral, while preserving the straightness of lines. In the special case where the transform is affine, the parallelism of lines in the source is preserved in the output.
Such a coordinate transformation can be represented by a square matrix
of arbitrary size. Point coordinates must have a dimension equal to the matrix size minus one.
For example a square matrix of size 4×4 is used for transforming three-dimensional
coordinates. The transformed points (x',y',z') are computed as below (note that this
computation is similar to PerspectiveTransform in
Java Advanced Imaging):
x' = u/t y' = v/t y' = w/t |
where |
┌ ┐ ┌ ┐ ┌ ┐ │ u │ │ m00 m01 m02 m03 │ │ x │ │ v │ = │ m10 m11 m12 m13 │ │ y │ │ w │ │ m20 m21 m22 m23 │ │ z │ │ t │ │ m30 m31 m32 m33 │ │ 1 │ └ ┘ └ ┘ └ ┘ |
See any of the following providers for a list of programmatic parameters:
Affine -
"Affine general parametric transformation" (EPSG 9624) with default matrix size of
3×3.LongitudeRotation -
"Longitude rotation" (EPSG 9601)
PerspectiveTransform,
AffineTransform,
Affine transformation on MathWorld,
Serialized Form
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class AbstractMathTransform |
|---|
AbstractMathTransform.Inverse |
| Field Summary |
|---|
| Fields inherited from class FormattableObject |
|---|
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE |
| Constructor Summary | |
|---|---|
protected |
ProjectiveTransform(Matrix matrix)
Constructs a transform from the specified matrix. |
| Method Summary | |
|---|---|
protected int |
computeHashCode()
Computes a hash value for this transform. |
static LinearTransform |
create(AffineTransform matrix)
Deprecated. Moved to MathTransforms.linear(AffineTransform). |
static LinearTransform |
create(Matrix matrix)
Creates a transform for the specified matrix. |
static LinearTransform |
createScale(int dimension,
double scale)
Deprecated. Moved to MathTransforms.linear(int, double, double). |
static XMatrix |
createSelectMatrix(int sourceDim,
int[] toKeep)
Deprecated. Moved to Matrices.createDimensionFilter(int, int[]) and
MathTransforms.dimensionFilter(int, int[]). |
static LinearTransform |
createTranslation(int dimension,
double offset)
Deprecated. Moved to MathTransforms.linear(int, double, double). |
Matrix |
derivative(DirectPosition point)
Gets the derivative of this transform at a point. |
Matrix |
derivative(Point2D point)
Gets the derivative of this transform at a point. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares the specified object with this math transform for equality. |
Matrix |
getMatrix()
Returns a copy of the matrix. |
ParameterDescriptorGroup |
getParameterDescriptors()
Returns the parameter descriptors for this math transform. |
ParameterValueGroup |
getParameterValues()
Returns the matrix elements as a group of parameters values. |
int |
getSourceDimensions()
Gets the dimension of input points. |
int |
getTargetDimensions()
Gets the dimension of output points. |
static LinearTransform |
identity(int dimension)
Returns an identity transform of the specified dimension. |
MathTransform |
inverse()
Creates the inverse transform of this object. |
boolean |
isIdentity()
Tests whether this transform does not move any points. |
boolean |
isIdentity(double tolerance)
Tests whether this transform does not move any points by using the provided tolerance. |
Matrix |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
boolean derivate)
Converts a single coordinate point in a list of ordinal values, and optionally computes the derivative at that location. |
void |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transforms an array of floating point coordinates by this matrix. |
void |
transform(double[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Transforms an array of floating point coordinates by this matrix. |
void |
transform(float[] 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 AbstractMathTransform |
|---|
createTransformedShape, ensureNonNull, equals, formatWKT, getName, hashCode, rollLongitude, transform, transform |
| Methods inherited from class FormattableObject |
|---|
getDefaultIndentation, print, setDefaultIndentation, toString, toWKT, toWKT, toWKT, toWKT |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface MathTransform |
|---|
toWKT, transform |
| Methods inherited from interface LenientComparable |
|---|
equals |
| Constructor Detail |
|---|
protected ProjectiveTransform(Matrix matrix)
matrix - The matrix.| Method Detail |
|---|
public static LinearTransform create(Matrix matrix)
matrix - The affine transform as a matrix.
MathTransforms.linear(Matrix)public static LinearTransform identity(int dimension)
LinearTransform1D or
AffineTransform2D respectively.
dimension - The dimension of the transform to be returned.
MathTransforms.identity(int)@Deprecated public static LinearTransform create(AffineTransform matrix)
MathTransforms.linear(AffineTransform).
matrix - The affine transform as a matrix.
@Deprecated
public static LinearTransform createScale(int dimension,
double scale)
MathTransforms.linear(int, double, double).
dimension - The input and output dimensions.scale - The scale factor.
@Deprecated
public static LinearTransform createTranslation(int dimension,
double offset)
MathTransforms.linear(int, double, double).
dimension - The input and output dimensions.offset - The translation.
@Deprecated
public static XMatrix createSelectMatrix(int sourceDim,
int[] toKeep)
throws IndexOutOfBoundsException
Matrices.createDimensionFilter(int, int[]) and
MathTransforms.dimensionFilter(int, int[]).
sourceDim and
the dimension of target coordinates is toKeep.length.
sourceDim - the dimension of source coordinates.toKeep - the indices of ordinate values to keep.
create(Matrix)
method in order to create the transform.
IndexOutOfBoundsException - if a value of toKeep
is lower than 0 or not smaller than sourceDim.public ParameterDescriptorGroup getParameterDescriptors()
getParameterDescriptors in interface ParameterizedgetParameterDescriptors in class AbstractMathTransformnull.OperationMethod.getParameters()public ParameterValueGroup getParameterValues()
getParameterValues in interface ParameterizedgetParameterValues in class AbstractMathTransformSingleOperation.getParameterValues()
public Matrix transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
boolean derivate)
transform in class AbstractMathTransformsrcPts - The array containing the source coordinate (can not be null).srcOff - The offset to the point to be transformed in the source array.dstPts - the array into which the transformed coordinate is returned.
May be the same than srcPts. May be null if
only the derivative matrix is desired.dstOff - The offset to the location of the transformed point that is
stored in the destination array.derivate - true for computing the derivative, or false if not needed.
null
if the derivate argument is false.AbstractMathTransform.derivative(DirectPosition),
AbstractMathTransform.transform(DirectPosition, DirectPosition),
MathTransforms.derivativeAndTransform(MathTransform, double[], int, double[], int)
public void transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
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].
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.
public void transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
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].
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.
public void transform(double[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.numPts - The number of points to be transformed.
public void transform(float[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.numPts - The number of points to be transformed.public Matrix derivative(Point2D point)
derivative in class AbstractMathTransformpoint - Ignored (can be null).
MathTransform2D.derivative(Point2D)public Matrix derivative(DirectPosition point)
derivative in interface MathTransformderivative in class AbstractMathTransformpoint - Ignored (can be null).
null).public Matrix getMatrix()
getMatrix in interface LinearTransformpublic int getSourceDimensions()
getSourceDimensions in interface MathTransformgetSourceDimensions in class AbstractMathTransformpublic int getTargetDimensions()
getTargetDimensions in interface MathTransformgetTargetDimensions in class AbstractMathTransformpublic boolean isIdentity()
isIdentity in interface MathTransformisIdentity in class AbstractMathTransformpublic boolean isIdentity(double tolerance)
XMatrix.isIdentity(double).
isIdentity in interface LinearTransformtolerance - The tolerance factor.
true if this transform is the identity oneMatrices.getMatrix(MathTransform),
XMatrix.isIdentity(double)
public MathTransform inverse()
throws NoninvertibleTransformException
inverse in interface MathTransforminverse in class AbstractMathTransformNoninvertibleTransformExceptionprotected int computeHashCode()
AbstractMathTransform.hashCode()
when first needed.
computeHashCode in class AbstractMathTransform
public boolean equals(Object object,
ComparisonMode mode)
true if the following conditions are meet:
object is an instance of the same class than this. We require the
same class because there is no interface for the various kinds of transform.The parameter values are not compared because subclasses can typically compare those values more efficiently by accessing to their member fields.
equals in interface LinearTransformequals in interface LenientComparableequals in class AbstractMathTransformobject - The object to compare with this transform.mode - The strictness level of the comparison. Default to STRICT.
true if the given object is a transform of the same class and if, given
identical source position, the transformed position would be the equals.Utilities.deepEquals(Object, Object, ComparisonMode)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||