I'm trying to figure out how to create a transformation to deform a rectangle into a quadrangle, where one corner stays the same. The basic mathematical solution is clear as described in [this Wiki article|http://en.wikipedia.org/wiki/Affine_transformation] . There are two questions I would like to pose:
1. Has anyone done this already?
2. Basically this could also be achieved by concatenating simpler transformation (scale, rotation, projection). While scale and rotation is available in JavaFX I wonder how to define projection in a simple way? Projection in this context would mean that I have one edge and then scale the opposing edge in- or outward. This would make a trapeze out of the rectangle. How would such a transformation matrix look like?

user8929955 wrote:
I'm trying to figure out how to create a transformation to deform a rectangle into a quadrangle, where one corner stays the same. The basic mathematical solution is clear as described in [this Wiki article|http://en.wikipedia.org/wiki/Affine_transformation] .

You can't use Affine Transformations to map a rectangle into an arbitrary quadrilateral. Affine Transformations preserve parallelism: so you can only transform a rectangle into another parallelogram.

There are two questions I would like to pose:
1. Has anyone done this already?
2. Basically this could also be achieved by concatenating simpler transformation (scale, rotation, projection). While scale and rotation is available in JavaFX I wonder how to define projection in a simple way? Projection in this context would mean that I have one edge and then scale the opposing edge in- or outward. This would make a trapeze out of the rectangle. How would such a transformation matrix look like?

The API defines Affine Transformations, and then Translations, Scales, Rotations, and Shears. You can (if I remember my Linear Algebra correctly) construct any Affine Transformation by composing translations, scale transformations, rotations, and shears. There's no API for non-affine transformations that I am aware of.

Thanks for your replies, especially the link
http://docs.oracle.com/javafx/2/api/javafx/scene/effect/PerspectiveTransform.html
was helpful. That was exactly what I was looking for. I then took it one step further, as I needed the transformed shapes to be clickable. I documented this in the following three blog entries:
http://sahits.ch/blog/?p=2286 (JavaFX: Deformation)
http://sahits.ch/blog/?p=2307 (JavaFX: Deformation with offscreen image)
http://sahits.ch/blog/?p=2314 (JavaFX: Perspective Transformation)