Class FXTransforms

java.lang.Object
org.jhotdraw8.geom.FXTransforms

public class FXTransforms extends Object
Transforms.
Author:
Werner Randelshofer
  • Field Details

    • IDENTITY

      public static final javafx.scene.transform.Transform IDENTITY
      'Immutable' identity transform.

      JavaFX Transforms are not actually immutable. Do not change the value of this transform!

  • Method Details

    • concat

      public static @NonNull javafx.scene.transform.Transform concat(@Nullable javafx.scene.transform.Transform... transforms)
    • createReshapeTransform

      public static @NonNull javafx.scene.transform.Transform createReshapeTransform(@NonNull javafx.geometry.Bounds src, @NonNull javafx.geometry.Bounds dest)
    • createReshapeTransform

      public static @NonNull javafx.scene.transform.Transform createReshapeTransform(@NonNull javafx.geometry.Bounds src, double destX, double destY, double destW, double destH)
    • createReshapeTransform

      public static @NonNull javafx.scene.transform.Transform createReshapeTransform(@NonNull javafx.geometry.Rectangle2D src, double destX, double destY, double destW, double destH)
    • createReshapeTransform

      public static @NonNull javafx.scene.transform.Transform createReshapeTransform(double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
    • decompose

      public static @NonNull List<javafx.scene.transform.Transform> decompose(@NonNull javafx.scene.transform.Transform transform)
      Decomposes the given transformation matrix into rotation, followed by scale and then translation. Returns the matrix if the decomposition fails. Returns an empty list if the transform is the identity matrix.
      Parameters:
      transform - a transformation
      Returns:
      decomposed transformation
    • deltaTransform

      public static javafx.geometry.Point2D deltaTransform(@Nullable javafx.scene.transform.Transform t, double x, double y)
    • deltaTransform

      public static javafx.geometry.Point2D deltaTransform(@Nullable javafx.scene.transform.Transform t, @NonNull javafx.geometry.Point2D p)
    • inverseDeltaTransform

      public static javafx.geometry.Point2D inverseDeltaTransform(@Nullable javafx.scene.transform.Transform t, double x, double y)
    • inverseDeltaTransform

      public static javafx.geometry.Point2D inverseDeltaTransform(@Nullable javafx.scene.transform.Transform t, @NonNull javafx.geometry.Point2D p)
    • toAwt

      public static @Nullable AffineTransform toAwt(@Nullable javafx.scene.transform.Transform t)
    • transform

      public static @NonNull javafx.geometry.Bounds transform(@Nullable javafx.scene.transform.Transform tx, @NonNull javafx.geometry.Bounds b)
    • transform

      public static @NonNull javafx.geometry.Point2D transform(@Nullable javafx.scene.transform.Transform tx, @NonNull javafx.geometry.Point2D b)
    • transform

      public static @NonNull javafx.geometry.Point2D transform(@Nullable javafx.scene.transform.Transform tx, double x, double y)
    • rotate

      public static @NonNull javafx.scene.transform.Transform rotate(@NonNull javafx.geometry.Point2D tangent, @NonNull javafx.geometry.Point2D pivot)
      Rotates from tangent vector.

      A tangent vector pointing to (1,0) results in an identity matrix.

      Parameters:
      tangent - a tangent vector
      pivot - the pivot of the rotation
      Returns:
      a rotation transform
    • rotate

      public static @NonNull javafx.scene.transform.Transform rotate(double tangentX, double tangentY, double pivotX, double pivotY)
      Rotates from tangent vector.

      A tangent vector pointing to (1,0) results in an identity matrix.

      Parameters:
      tangentX - a tangent vector
      tangentY - a tangent vector
      pivotX - the pivot of the rotation
      pivotY - the pivot of the rotation
      Returns:
      a rotation transform
    • createProjectPointOnLineTransform

      public static @NonNull javafx.scene.transform.Transform createProjectPointOnLineTransform(double x1, double y1, double x2, double y2)
      Creates a transformation matrix, which projects a point onto the given line. The projection is orthogonal to the line. The point will not be clipped off by the line.

      Formula: b = project(a, p1,p2)

        v = p2 - p1;
        b = vvT / vTv * (a - p1) + p1;
        b = [ vvT / vTv | vvT / vTv * p1 ] * a; // 2 by 3 matrix
       
      Parameters:
      x1 - x-coordinate of p1 of the line
      y1 - y-coordinate of p1 of the line
      x2 - x-coordinate of p2 of the line
      y2 - y-coordinate of p2 of the line
      Returns:
      the transformation matrix
    • projectPointOnLine

      public static @NonNull javafx.geometry.Point2D projectPointOnLine(double ax, double ay, double x1, double y1, double x2, double y2)
    • isIdentityOrNull

      public static boolean isIdentityOrNull(@Nullable javafx.scene.transform.Transform t)
    • transform2DPoints

      public static void transform2DPoints(javafx.scene.transform.Transform t, double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
    • transformedBoundingBox

      public static javafx.geometry.Bounds transformedBoundingBox(@Nullable javafx.scene.transform.Transform t, javafx.geometry.Bounds b)
      Computes the bounding box in parent coordinates
      Parameters:
      b - a box in local coordinates
      Returns:
      bounding box in parent coordinates