java.lang.Object
org.jhotdraw8.geom.FXTransforms
Transforms.
- Author:
- Werner Randelshofer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final javafx.scene.transform.Transform'Immutable' identity transform. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull javafx.scene.transform.Transformstatic @NonNull javafx.scene.transform.TransformcreateProjectPointOnLineTransform(double x1, double y1, double x2, double y2) Creates a transformation matrix, which projects a point onto the given line.static @NonNull javafx.scene.transform.TransformcreateReshapeTransform(double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) static @NonNull javafx.scene.transform.TransformcreateReshapeTransform(@NonNull javafx.geometry.Bounds src, double destX, double destY, double destW, double destH) static @NonNull javafx.scene.transform.TransformcreateReshapeTransform(@NonNull javafx.geometry.Bounds src, @NonNull javafx.geometry.Bounds dest) static @NonNull javafx.scene.transform.TransformcreateReshapeTransform(@NonNull javafx.geometry.Rectangle2D src, double destX, double destY, double destW, double destH) Decomposes the given transformation matrix into rotation, followed by scale and then translation.static javafx.geometry.Point2DdeltaTransform(@Nullable javafx.scene.transform.Transform t, double x, double y) static javafx.geometry.Point2DdeltaTransform(@Nullable javafx.scene.transform.Transform t, @NonNull javafx.geometry.Point2D p) static javafx.geometry.Point2DinverseDeltaTransform(@Nullable javafx.scene.transform.Transform t, double x, double y) static javafx.geometry.Point2DinverseDeltaTransform(@Nullable javafx.scene.transform.Transform t, @NonNull javafx.geometry.Point2D p) static booleanisIdentityOrNull(@Nullable javafx.scene.transform.Transform t) static @NonNull javafx.geometry.Point2DprojectPointOnLine(double ax, double ay, double x1, double y1, double x2, double y2) static @NonNull javafx.scene.transform.Transformrotate(double tangentX, double tangentY, double pivotX, double pivotY) Rotates from tangent vector.static @NonNull javafx.scene.transform.TransformRotates from tangent vector.static @Nullable AffineTransformstatic @NonNull javafx.geometry.Point2Dstatic @NonNull javafx.geometry.Boundsstatic @NonNull javafx.geometry.Point2Dstatic voidtransform2DPoints(javafx.scene.transform.Transform t, double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) static javafx.geometry.BoundstransformedBoundingBox(@Nullable javafx.scene.transform.Transform t, javafx.geometry.Bounds b) Computes the bounding box in parent coordinates
-
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
-
createReshapeTransform
-
createReshapeTransform
-
createReshapeTransform
-
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
-
inverseDeltaTransform
public static javafx.geometry.Point2D inverseDeltaTransform(@Nullable javafx.scene.transform.Transform t, double x, double y) -
inverseDeltaTransform
-
toAwt
-
transform
-
transform
-
transform
-
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 vectorpivot- 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 vectortangentY- a tangent vectorpivotX- the pivot of the rotationpivotY- 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 liney1- y-coordinate of p1 of the linex2- x-coordinate of p2 of the liney2- 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
-
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
-