JavaFX and (Affine)Transforms
martin.desruisseaux at geomatys.fr
Fri May 4 06:14:11 PDT 2012
Now it is my turn to vote a big ++1.
Affine transform is also a crucial part of Geographic Information
System. Our implementation is making an extensive use of
java.awt.geom.AffineTransform and I can not yet switch to the JavaFX
transform classes in their current form. Almost every methods in the
Java2D AffineTransform class are important, with special emphasis on:
* transform(double, int, double, int, int)
* transform(float, int, float, int, int)
* transform(float, int, double, int, int)
* transform(double, int, float, int, int)
* getScaleX(), getScaleY(), getShearX(), etc.
* Java2D AffineTransform is modifiable, while JavaFX transform classes
seem to be immutable. Immutable transforms with 'concatenate' and
similar methods returning new instances are fine.
* Transform methods working in arbitrary positions of existing arrays
are essential. We are continuously transforming million of
coordinates, not only for display purpose - performance is critical
in this area.
* We only need 'float' and 'double' types, no need for 'int'. The
'double' type is essential - map projections in float precision have
* The 'transform' methods mixing the array of 'float' and 'double'
types in their signature are important. They are used in the
following scenario, where to source and target arrays are of type
'float', but the intermediate map projection must be performed in
1. Affine transform for applying axis reordering, unit conversion,
prime meridian rotation. Source array may be 'float' or
'double', but destination array must be 'double'.
2. Map projection - must be performed on array of type 'double',
otherwise errors are too high.
3. Affine transform for applying scale factor, easting, northing,
unit conversion and axis reordering. Source array is always
'double', but destination array may be 'double' or 'float'.
In summary, the current Java2D AffineTransform API is excellent in my
opinion. Having equivalent functionalities in JavaFX would be nice
(hardware acceleration would be wonderful), eventually as immutable
classes. Otherwise we would probably stay with the Java2D implementation
on the computation side...
Le 04/05/12 14:40, Dr. Michael Paus a écrit :
> I recently experimented a bit with the graphic features of JavaFX
> (Shapes, Group-Nodes and Transforms).
> One thing I very quickly stumbled over is the missing support for any
> kind of mathematical operations
> on (Affine) transforms. You can neither get at the matrix elements of
> a Scale, Translate, etc. (because
> these Affine transforms are not even a sub-class of Affine) nor could
> you perform any operations on them
> like for example combining two transforms into one or applying the
> transform or its inverse to a point.
> Sometimes even the documentation is wrong (see for example Scale: The
> description of the matrix
> completely ignores the pivot element which is an integral part of this
> I really wonder how you can write any sophisticated graphics program
> without support for such kind
> of operations. Is there any magic way around this, which I don't know
> or has just nobody ever tried
> to do that? There already exists a JIRA entry for this
> but obviously I am the only person in the world, in addition to the
> original author, who is interested
> in that. How can that be?
More information about the openjfx-dev