public class ProjectiveTransform extends AbstractMathTransform implements LinearTransform, Serializable
Such a coordinate transformation can be represented by a square matrix of an arbitrary size. 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. The transformed points (x',y',z')
are
computed as below (note that this computation is similar to PerspectiveTransform
in Java Advanced Imaging):
In the special case of an affine transform, the last row contains only zero values except in the last column, which contains 1.[ 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
PerspectiveTransform
,
AffineTransform
,
Affine transformation on
MathWorld,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
ProjectiveTransform.ProviderAffine
The provider for the "Affine general parametric transformation" (EPSG 9624).
|
static class |
ProjectiveTransform.ProviderLongitudeRotation
The provider for the "Longitude rotation" (EPSG 9601).
|
AbstractMathTransform.Inverse
SINGLE_LINE
Modifier | Constructor and Description |
---|---|
protected |
ProjectiveTransform(Matrix matrix)
Constructs a transform from the specified matrix.
|
Modifier and Type | Method and Description |
---|---|
static LinearTransform |
create(AffineTransform matrix)
Creates a transform for the specified matrix as a Java2D object.
|
static LinearTransform |
create(Matrix matrix)
Creates a transform for the specified matrix.
|
static LinearTransform |
createScale(int dimension,
double scale)
Creates a transform that apply a uniform scale along all axis.
|
static Matrix |
createSelectMatrix(int sourceDim,
int[] toKeep)
Creates a matrix that keep only a subset of the ordinate values.
|
static LinearTransform |
createTranslation(int dimension,
double offset)
Creates a transform that apply the same translation along all axis.
|
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)
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.
|
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.
|
boolean |
isIdentity(double tolerance)
Tests whether this transform does not move any points by using the provided tolerance.
|
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.
|
createTransformedShape, ensureNonNull, formatWKT, getName, needCopy, normalizeAngle, rollLongitude, transform, transform, transform, transform
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
toWKT, transform, transform, transform
protected ProjectiveTransform(Matrix matrix)
matrix
- The matrix.public static LinearTransform create(Matrix matrix)
matrix
- The affine transform as a matrix.public static LinearTransform create(AffineTransform matrix)
matrix
- The affine transform as a matrix.public static LinearTransform createScale(int dimension, double scale)
dimension
- The input and output dimensions.scale
- The scale factor.public static LinearTransform createTranslation(int dimension, double offset)
dimension
- The input and output dimensions.offset
- The translation.public static Matrix createSelectMatrix(int sourceDim, int[] toKeep) throws IndexOutOfBoundsException
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 class AbstractMathTransform
null
.OperationMethod.getParameters()
public ParameterValueGroup getParameterValues()
getParameterValues
in class AbstractMathTransform
Operation.getParameterValues()
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 MathTransform
transform
in class AbstractMathTransform
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 transformedpublic 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 MathTransform
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 transformedpublic Matrix derivative(Point2D point)
derivative
in class AbstractMathTransform
point
- The coordinate point where to evaluate the derivative.MathTransform2D.derivative(Point2D)
public Matrix derivative(DirectPosition point)
derivative
in interface MathTransform
derivative
in class AbstractMathTransform
point
- The coordinate point where to evaluate the derivative.null
).public Matrix getMatrix()
getMatrix
in interface LinearTransform
public int getSourceDimensions()
getSourceDimensions
in interface MathTransform
getSourceDimensions
in class AbstractMathTransform
public int getTargetDimensions()
getTargetDimensions
in interface MathTransform
getTargetDimensions
in class AbstractMathTransform
public boolean isIdentity()
isIdentity
in interface MathTransform
isIdentity
in class AbstractMathTransform
true
if this MathTransform
is an identity transform; false
otherwise.public boolean isIdentity(double tolerance)
XMatrix.isIdentity(double)
.isIdentity
in interface LinearTransform
tolerance
- The tolerance factor.true
if this transform is the identity onepublic MathTransform inverse() throws NoninvertibleTransformException
inverse
in interface MathTransform
inverse
in class AbstractMathTransform
NoninvertibleTransformException
- if the transform can't be inversed.public int hashCode()
hashCode
in class AbstractMathTransform
public boolean equals(Object object)
equals
in class AbstractMathTransform
object
- The object to compare with this transform.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.Copyright © 1996–2019 Geotools. All rights reserved.