Object
SimpleIdentifiedObject
SimpleTransform
ProjectiveTransform
- All Implemented Interfaces:
Identifier
,IdentifiedObject
,CoordinateOperation
,MathTransform
,ReferenceIdentifier
A
MathTransform
which use a Matrix
for transforming the coordinates.
This transform is usually, but not necessarily, affine.
Constraints:
- The number of columns in the matrix shall be equal to the number of source dimensions + 1.
- The number of rows in the matrix shall be equal to the number of target dimensions + 1.
transform
methods expecting array arguments).- Since:
- 3.1
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final SimpleMatrix
The matrix used for performing the coordinate conversions.Fields inherited from class SimpleTransform
sourceCRS, targetCRS
Fields inherited from class SimpleIdentifiedObject
authority, code
Fields inherited from interface CoordinateOperation
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Fields inherited from interface Identifier
AUTHORITY_KEY, CODE_KEY, CODESPACE_KEY, DESCRIPTION_KEY, VERSION_KEY
-
Constructor Summary
ConstructorDescriptionProjectiveTransform
(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, SimpleMatrix matrix) Creates a new operation for the given name, CRS and matrix. -
Method Summary
Modifier and TypeMethodDescriptionderivative
(DirectPosition point) Gets the derivative of this transform.boolean
Compares this transform with the given object for equality.int
Gets the dimension of input points.int
Gets the dimension of target points.inverse()
Returns the inverse transform of this object.boolean
Tests whether this transform does not move any points.transform
(DirectPosition ptSrc, DirectPosition ptDst) Transforms the specifiedptSrc
.Methods inherited from class SimpleTransform
getMathTransform, getOperationVersion, getSourceCRS, getTargetCRS, transform, transform, transform, transform
Methods inherited from class SimpleIdentifiedObject
getAuthority, getCode, getCodeSpace, getDomainOfValidity, getName, getScope, hashCode, toString, toWKT
Methods inherited from interface CoordinateOperation
getCoordinateOperationAccuracy, getDomainOfValidity, getScope
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
Methods inherited from interface Identifier
getDescription, getVersion
Methods inherited from interface MathTransform
toWKT
-
Field Details
-
matrix
The matrix used for performing the coordinate conversions.
-
-
Constructor Details
-
ProjectiveTransform
public ProjectiveTransform(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, SimpleMatrix matrix) Creates a new operation for the given name, CRS and matrix.- Parameters:
authority
- organization responsible for definition of the name, ornull
.name
- the name of the new CRS.sourceCRS
- the source CRS to be returned bySimpleTransform.getSourceCRS()
, ornull
.targetCRS
- the target CRS to be returned bySimpleTransform.getTargetCRS()
, ornull
.matrix
- the matrix. See class javadoc for constraints on the matrix size.
-
-
Method Details
-
getSourceDimensions
public int getSourceDimensions()Gets the dimension of input points. This is equal to the number of columns in the matrix minus one.- Specified by:
getSourceDimensions
in interfaceMathTransform
- Overrides:
getSourceDimensions
in classSimpleTransform
- Returns:
- the dimension of input points.
- See Also:
-
getTargetDimensions
public int getTargetDimensions()Gets the dimension of target points. This is equal to the number of rows in the matrix minus one.- Specified by:
getTargetDimensions
in interfaceMathTransform
- Overrides:
getTargetDimensions
in classSimpleTransform
- Returns:
- the dimension of input points.
- See Also:
-
transform
public DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws MismatchedDimensionException Transforms the specifiedptSrc
. First, this implementation computes the following matrix product:┌ ┐ ┌ ┐ ┌ ┐ │ptDst│ = │matrix│ │ptSrc│ │ w │ │ │ │ 1 │ └ ┘ └ ┘ └ ┘
Then, the destination coordinate values are divided by w. Note that in the common case where the transform is affine, w = 1.
- Specified by:
transform
in interfaceMathTransform
- Specified by:
transform
in classSimpleTransform
- Parameters:
ptSrc
- the specified coordinate point to be transformed.ptDst
- the specified coordinate point that stores the result of transformingptSrc
, ornull
.- Returns:
- the coordinate point after transforming
ptSrc
and storing the result inptDst
, or a newly created point ifptDst
was null. - Throws:
MismatchedDimensionException
- ifptSrc
orptDst
does not have the expected dimension.
-
derivative
Gets the derivative of this transform. In the particular case of linear transforms, the derivative is the same at every points. Consequently, thepoint
argument is ignored.- Specified by:
derivative
in interfaceMathTransform
- Overrides:
derivative
in classSimpleTransform
- Parameters:
point
- ignored for a linear transform.- Returns:
- the derivative (never
null
).
-
inverse
Returns the inverse transform of this object. The default implementation invert the matrix and build a newProjectiveTransform
from it.- Specified by:
inverse
in interfaceMathTransform
- Overrides:
inverse
in classSimpleTransform
- Returns:
- the inverse transform.
- Throws:
NoninvertibleTransformException
- if the transform cannot be inverted.- See Also:
-
isIdentity
public boolean isIdentity()Tests whether this transform does not move any points. The default implementation delegates toSimpleMatrix.isIdentity()
.- Specified by:
isIdentity
in interfaceMathTransform
- Overrides:
isIdentity
in classSimpleTransform
- Returns:
true
if thisMathTransform
is an identity transform;false
otherwise.- See Also:
-
equals
Compares this transform with the given object for equality.- Overrides:
equals
in classSimpleTransform
- Parameters:
object
- the object to compare with thisSimpleTransform
.- Returns:
true
if the given object is equal to this object.
-