Class AffineTransformationFactory


  • public class AffineTransformationFactory
    extends java.lang.Object
    Supports creating AffineTransformations defined by various kinds of inputs and transformation mapping rules.
    Author:
    Martin Davis
    • Constructor Detail

      • AffineTransformationFactory

        public AffineTransformationFactory()
    • Method Detail

      • createFromControlVectors

        public static AffineTransformation createFromControlVectors​(Coordinate src0,
                                                                    Coordinate src1,
                                                                    Coordinate src2,
                                                                    Coordinate dest0,
                                                                    Coordinate dest1,
                                                                    Coordinate dest2)
        Creates a transformation from a set of three control vectors. A control vector consists of a source point and a destination point, which is the image of the source point under the desired transformation. Three control vectors allows defining a fully general affine transformation.
        Parameters:
        src0 -
        src1 -
        src2 -
        dest0 -
        dest1 -
        dest2 -
        Returns:
        the computed transformation
      • createFromControlVectors

        public static AffineTransformation createFromControlVectors​(Coordinate src0,
                                                                    Coordinate src1,
                                                                    Coordinate dest0,
                                                                    Coordinate dest1)
        Creates an AffineTransformation defined by a pair of control vectors. A control vector consists of a source point and a destination point, which is the image of the source point under the desired transformation. The computed transformation is a combination of one or more of a uniform scale, a rotation, and a translation (i.e. there is no shear component and no reflection)
        Parameters:
        src0 -
        src1 -
        dest0 -
        dest1 -
        Returns:
        the computed transformation, or null if the control vectors do not determine a well-defined transformation
      • createFromControlVectors

        public static AffineTransformation createFromControlVectors​(Coordinate src0,
                                                                    Coordinate dest0)
        Creates an AffineTransformation defined by a single control vector. A control vector consists of a source point and a destination point, which is the image of the source point under the desired transformation. This produces a translation.
        Parameters:
        src0 - the start point of the control vector
        dest0 - the end point of the control vector
        Returns:
        the computed transformation
      • createFromControlVectors

        public static AffineTransformation createFromControlVectors​(Coordinate[] src,
                                                                    Coordinate[] dest)
        Creates an AffineTransformation defined by a set of control vectors. Between one and three vectors must be supplied.
        Parameters:
        src - the source points of the vectors
        dest - the destination points of the vectors
        Returns:
        the computed transformation
        Throws:
        java.lang.IllegalArgumentException - if the control vector arrays are too short, long or of different lengths
      • createFromBaseLines

        public static AffineTransformation createFromBaseLines​(Coordinate src0,
                                                               Coordinate src1,
                                                               Coordinate dest0,
                                                               Coordinate dest1)
        Creates an AffineTransformation defined by a mapping between two baselines. The computed transformation consists of:
        • a translation from the start point of the source baseline to the start point of the destination baseline,
        • a rotation through the angle between the baselines about the destination start point,
        • and a scaling equal to the ratio of the baseline lengths.
        If the source baseline has zero length, an identity transformation is returned.
        Parameters:
        src0 - the start point of the source baseline
        src1 - the end point of the source baseline
        dest0 - the start point of the destination baseline
        dest1 - the end point of the destination baseline
        Returns:
        the computed transformation