Affine transforms - matrix algebra

Pavel Safrata pavel.safrata at oracle.com
Thu Jul 12 13:48:54 PDT 2012


On 12.7.2012 22:07, Martin Desruisseaux wrote:
> Le 12/07/12 19:42, Pavel Safrata a écrit :
>> Even in this case I don't really like the inconsistency with List 
>> which allocates new array if the given one is not sufficient. I think 
>> we either need to choose one of the numbers or do
>>
>> public double[] toArray(MatrixArrayType type[, double[] a)
>>
>> where MatrixArrayType is an enum with values MAT_2D, MAT_3D, 
>> MAT_Full, requesting 6, 12, 16 numbers respectively. How does that 
>> sound?
>
> Maybe I lack a little bit of JavaFX knowledge here, but how do we 
> known for which axes are the 2D-relevant elements? Do the (x,y) plane 
> is special enough in the JavaFX infrastructure for stating that the 
> Affine 2D elements will never be (x,z) or (y,z)? Otherwise instead of 
> MAT_2D we could define MAT_XY, MAT_XZ and MAT_YZ.

In JavaFX the (x,y) plane is very special. If you use the scene in 2D 
you always work with the (x,y) plane. Any transform along z axis is 
considered 3D.

>
> But maybe there is an other issue: when I look at the matrices 
> documented in the javadoc of every Transform subclasses except Affine 
> (and maybe Rotate when the axis of rotation is not Z), I see X and Y 
> axes that are independent of Z (i.e. the coefficients in the third 
> column are zero for the first (X) and second (Y) rows). It make sense 
> for those Transforms to extract a sub-transform for only the (x,y) 
> plane, because transformations on that plane do not depend on the z 
> value.
>
> But in the Affine class, the mxz and myz coefficients can be anything. 
> Consequently the transformations on the (x,y) plane may not be 
> independent of z. If we extract the 2D part of that matrix, we would 
> need to specify in the javadoc that this two-dimensional transform is 
> valid only for z=0. For other values of z, the translation terms of 
> the two-dimensional transform may be different. Do we really want to 
> afford this additional complexity?

I would probably leave responsibility on users. I think we could even 
throw an exception when user tries to obtain 2D matrix from a 3D transform.

Pavel

>
>     Martin
>




More information about the openjfx-dev mailing list