Class TransformationFactory


  • public final class TransformationFactory
    extends java.lang.Object
    Author:
    Pierre Lando
    • Method Detail

      • getIdentity

        public static Transformation getIdentity()
        Return the identity transformation.
        Returns:
        the identity transformation.
      • getTranslateTransformation

        public static Transformation getTranslateTransformation​(double x,
                                                                double y,
                                                                double z)
        Return a translate transformation.
        Parameters:
        x - translation in x coordinate.
        y - translation in y coordinate.
        z - translation in z coordinate.
        Returns:
        a translate transformation.
      • getScaleTransformation

        public static Transformation getScaleTransformation​(double x,
                                                            double y,
                                                            double z)
                                                     throws DegenerateMatrixException
        Return a scale transformation.
        Parameters:
        x - scale in x.
        y - scale in y.
        z - scale in z.
        Returns:
        a scale transformation.
        Throws:
        DegenerateMatrixException - - A DegenerateMatrixException is thrown if one of the scale factor is zero.
      • getScaleTransformation

        public static Transformation getScaleTransformation​(double s)
                                                     throws DegenerateMatrixException
        Return a scale transformation.
        Parameters:
        s - scale value.
        Returns:
        a scale transformation.
        Throws:
        DegenerateMatrixException - - A DegenerateMatrixException is thrown if one coordinate of the scale vector is zero.
      • getRotationTransformation

        public static Transformation getRotationTransformation​(double angle,
                                                               double x,
                                                               double y,
                                                               double z)
                                                        throws DegenerateMatrixException
        Return a rotation transformation.
        Parameters:
        angle - the rotation angle in degree.
        x - the x coordinate of the rotation axes.
        y - the y coordinate of the rotation axes.
        z - the z coordinate of the rotation axes.
        Returns:
        a rotation transformation.
        Throws:
        DegenerateMatrixException - - A DegenerateMatrixException is thrown if the rotation axes is zero.
      • getRotationTransformation

        public static Transformation getRotationTransformation​(Rotation q)
        Return a rotation transformation.
        Parameters:
        q - the quaternion.
        Returns:
        a rotation transformation.
      • getPreferredAspectRatioTransformation

        public static Transformation getPreferredAspectRatioTransformation​(java.awt.Dimension dimension,
                                                                           double preferredRatio)
                                                                    throws DegenerateMatrixException
        Return the 'preferred aspect ratio transformation'
        Parameters:
        dimension - the canvas dimension.
        preferredRatio - the preferred aspect ratio.
        Returns:
        the 'preferred aspect ratio transformation'
        Throws:
        DegenerateMatrixException - - A DegenerateMatrixException is thrown if the given value are not reasonable.
      • getPerspectiveTransformation

        public static Transformation getPerspectiveTransformation​(double near,
                                                                  double far,
                                                                  double fov)
        Return a perspective transformation.
        Parameters:
        near - the distance from the viewer to the near clipping plane.
        far - the distance from the viewer to the far clipping plane.
        fov - the field of view angle in degree.
        Returns:
        a perspective transformation.
      • getOrthographic

        public static Transformation getOrthographic​(double left,
                                                     double right,
                                                     double bottom,
                                                     double top,
                                                     double near,
                                                     double far)
        Return an orthographic transformation.
        Parameters:
        left - the left plane distance to origin.
        right - the right plane distance to origin.
        bottom - the bottom plane distance to origin.
        top - the top plane distance to origin.
        near - the near plane distance to origin.
        far - the far plane distance to origin.
        Returns:
        an orthographic transformation.
      • getAffineTransformation

        public static Transformation getAffineTransformation​(Vector3d s,
                                                             Vector3d t)
                                                      throws DegenerateMatrixException
        Return an affine transformation aX + b
        Parameters:
        s - the scale parameter.
        t - the translate parameter.
        Returns:
        an affine transformation
        Throws:
        DegenerateMatrixException - - A DegenerateMatrixException is thrown if one coordinate of the scale vector is zero.