Hi Armin,
Armin Le Grand schrieb:
Regina Henschel schrieb:
Hi all,
I want to use the transformation matrix in my macro, but it does not
contain what I expect. So I need some help to understand it.
Take a draw document with page border 0cm.
Draw a rectangle at left=2cm; top=1cm and width=2cm; height=4cm.
Now in Position&Size set the slant angle to 20°.
The transformed rectangle gets the transformation matrix (rounded)
2001 1454.4 2727
0 3996 1000
0 0 1
I thought that if a apply the transformation matrix to
1
1
1
then I will get the coordinates of the former right bottom corner.
Therefore I expect the matrix
2000 -1455.9 2727.9
0 4000 1000
0 0 0
Now I have three questions:
1) Is it correct, that Draw has a positive value in line1/column2 ?
Yes. For historical reasons, the OOo Drawinglayer has a right-handed 2D
coordinate system, that means the Y-Axis points down (as can be seen in
the positions dialog; the bigger the position, the more downward on the
page is the object).
I'm aware of that.
This also has the consequences, that all
mathematical stuff related to a left-handed coordinate system as we
learn it in school is 'mirrored' in Y. This is true for shear and
rotation angle values (e.g. positive rotation goes clockwise).
2) If it is correct, how is the transformation to be used?
Keep in mind that You are working with a right-handed coordinate sytem.
It is not clear, how to use the matrix.
Perhaps let's take a more simple example, were the center of the
operations are in the origin. (Please correct me were I'm wrong.)
Take a line from (0cm|-1cm) to (0cm|1cm). With 1/100mm in integers that
is in model coordinates a line from (0|-1000) to (0|1000). It gets the
transformation matrix
0 0 0
0 2000 -1000
0 0 1
That is as expected so far.
Now apply a rotation with 30° (30° entered in position&size dialog). The
rotated line has the coordinates (those which one can see on screen)
from (-0.5cm|-0.87cm) to (0.5cm|0.87cm)
It gets the transformation matrix
1000 0 -500
0 1732.05 -866.02
0 0 1
I apply the matrix
/ \ / \ / \
| 1000 0 -500 | | 0 | | -500 |
| 0 1732.05 -866.02 | * | 0 | = | -866.03 |
| 0 0 1 | | 1 | | 1 |
\ / \ / \ /
/ \ / \ / \
| 1000 0 -500 | | 1 | | 500 |
| 0 1732.05 -866.02 | * | 1 | = | 866.03 |
| 0 0 1 | | 1 | | 1 |
\ / \ / \ /
which gives the model coordinates (-500|-866) and (500|866). That fits
to the coordinates on screen and is as expected.
Now remove the rotation and set a 20° shearing (in position&size
dialog). The sheared line goes from (0.36cm|-1cm) to (-0.36cm|1cm).
It gets the matrix
727.94 0 -363.97
0 2000 -1000
0 0 1
I apply the matrix
/ \ / \ / \
| 727.94 0 -363.97 | | 0 | | -363.97 |
| 0 2000 -1000 | * | 0 | = | -1000 |
| 0 0 1 | | 1 | | 1 |
\ / \ / \ /
/ \ / \ / \
| 727.94 0 -363.97 | | 1 | | 363.97 |
| 0 2000 -1000 | * | 1 | = | 1000 |
| 0 0 1 | | 1 | | 1 |
\ / \ / \ /
That gives the model coordinates (-364|-1000) and (364|1000). That does
not fit the coordinates on screen, the x-coordinate has opposite sign.
I'm confused.
kind regards
Regina
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]