java.lang.Object
imagingbook.common.geometry.mappings.linear.LinearMapping2D
imagingbook.common.geometry.mappings.linear.ProjectiveMapping2D
imagingbook.common.geometry.mappings.linear.AffineMapping2D
imagingbook.common.geometry.mappings.linear.Translation2D
This class represents a pure 2D translation (as a special case of affine transformation). Instances are immutable and it can be assumed that every instance of this class is indeed a translation. See Secs. 21.1.3 and 21.3.1 of [1] for details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTranslation2D
(double[] txy) Constructor, creates a new 2D translation mapping.Translation2D
(double tx, double ty) Constructor, creates a new 2D translation mapping.Constructor, reates a new translation instance from a given translation. -
Method Summary
Modifier and TypeMethodDescriptionConcatenates this translation A with another translation B and returns a new translation C, such that C(x) = B(A(x)).Returns a copy of this mapping.static Translation2D
fromPoints
(Pnt2d p, Pnt2d q) Creates a new translation that maps between the first point to the second point specified.Calculates and returns the inverse mapping.double[][]
getJacobian
(Pnt2d xy) Returns the Jacobian matrix for this mapping, evaluated at the given 2D point.Methods inherited from class imagingbook.common.geometry.mappings.linear.AffineMapping2D
applyTo, concat, fromPoints, fromPoints, isAffine
Methods inherited from class imagingbook.common.geometry.mappings.linear.ProjectiveMapping2D
concat, main
Methods inherited from class imagingbook.common.geometry.mappings.linear.LinearMapping2D
concat, concatenate, getTransformationMatrix, normalize, toString
-
Constructor Details
-
Translation2D
Constructor, creates a new 2D translation mapping.- Parameters:
tx
- translation in xty
- translation in y
-
Translation2D
Constructor, creates a new 2D translation mapping.- Parameters:
txy
- translation in x/y (2-element array)
-
Translation2D
Constructor, reates a new translation instance from a given translation.- Parameters:
m
- a 2D translation mapping
-
-
Method Details
-
fromPoints
Creates a new translation that maps between the first point to the second point specified.- Parameters:
p
- the first pointq
- the second point- Returns:
- a new translation instance
-
duplicate
Description copied from class:AffineMapping2D
Returns a copy of this mapping.- Overrides:
duplicate
in classAffineMapping2D
- Returns:
- a new affine mapping
-
concat
Concatenates this translation A with another translation B and returns a new translation C, such that C(x) = B(A(x)).- Parameters:
B
- the second translation- Returns:
- the concatenated translations
-
getInverse
Description copied from class:AffineMapping2D
Calculates and returns the inverse mapping. Note that the inverse A' of a projective transformation matrix A is again a linear transformation but its a'2' element is generally not 1. Scaling A' to A'' = A' / a22' yields a projective transformation that reverses A. While A * A' = I, the result of A * A'' is a scaled identity matrix. Note that inverting an affine transformation always yields another affine transformation.- Specified by:
getInverse
in interfaceInversion
- Overrides:
getInverse
in classAffineMapping2D
- Returns:
- the inverse projective transformation
-
getJacobian
Description copied from interface:Jacobian
Returns the Jacobian matrix for this mapping, evaluated at the given 2D point. See Appendix Sec. D.1.1 of [1] for more details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
- Specified by:
getJacobian
in interfaceJacobian
- Overrides:
getJacobian
in classAffineMapping2D
- Parameters:
xy
- the 2D position to calculate the Jacobian for- Returns:
- the Jacobian matrix
-