openoffice-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Regina Henschel <rb.hensc...@t-online.de>
Subject Re: Shearing in 3D
Date Tue, 19 Nov 2013 20:30:23 GMT
Hi Armin,

Armin Le Grand schrieb:
>      Hi Regina,
>
> On 18.11.2013 23:45, Regina Henschel wrote:
>> Hi all,
>>
>> the B3DHomMatrix has a method decompose(...) which results tuples
>> rScale, rTranslate, rRotate and rShear.
>>
>> I do not understand the meaning of rShear. How are the rShear values
>> used to re-compose the original matrix? When I decompose a matrix with
>> only scale and rotation following the algorithm, then re-compose
>> works. But I have no idea how it is intended to work with shearing.
>
> Please have a look at http://en.wikipedia.org/wiki/Shear_matrix for
> shearing in general. You might think of it as 'bending' the geometry
> 'out of the right angle'...

Yes, I noticed, that in the method decompose an 
"Orthogonalisierungsverfahren" is used to extract the rotation matrix.

> In 2D, the composition is scale, shear, rotate, translate. In 3D it's
> the same, but we have three shear values (x against Y, Y against Z, Z
> against X), thus the order may vary, but should be the same as at
> decomposition. In B3DHomMatrix::decompose the order of shear extraction
> is: ShearXY, ShearXZ and ShearYZ, thus the linear combination should be
> vice versa; all in all for 3D it should be: scale(x,y,z), shearYZ,
> ShearXZ, ShearXY, rotate(x,y,z), translate(x,y,z).

I have a basic understanding of matrices. But here I have no idea, how 
the shear matrices are build. I have simulated the algorithm of 
decompose as spreadsheet (without the corner cases and accuracy handlings).
I have used input matrix
1   0  √3
0   1   0
0   0   1

 From my decompose simulation I get in order (x | y | z)
rScale( 1 | 1 | 2 )
rShear( 0 | 0.5*√3 | -0.5*√3 )
rRotate( 0 | 0 | 0 )
And now I wonder what matrices to use for shearing to get the original 
input matrix.

Of cause there might be an error in my simulation, but examine that, it 
would be helpful to know, in which way the values of rShear are intended 
to be used. Can you write me down the matrices?

I get as expected
for input matrix
1   √3  0
0   1   0
0   0   1
the output
rScale( 1 | 1 | 1)
rShear( √3 | 0 | 0 )
rRotate( 0 | 0 | 0 )

and for input matrix
1   0   0
0   1   √3
0   0   1
the output
rScale( 1 | 1 | 1)
rShear( 0 | 0 | √3 )
rRotate( 0 | 0 | 0 )

> Btw: 2D has 6 deg of freedom and decompose gives ShearX. It would also
> be possible to get ShearY, these two values are not linearly
> independent. More can be found in the book 'Computer Graphics:
> Principles and Practice' from James D. /Foley/, Andries van Dam, Steven
> K. /Feiner/, John F. /Hughes/ which I can recommend.

I've ordered it.

BTW: I have applied the above mentioned input matrix to a cube (manually 
in the file text) and it renders nicely in the 3D-scene, showing the 
expected shearing. It works fine, although there is no UI to set such 
shearing.

Kind regards
Regina

>
> HTH!
>
>>
>> There seem to be no code currently, which uses shearing; at least I do
>> not find anything. But because a transformation matrix can include
>> shearing, I want to know, how it works, and hope someone can give me a
>> tip.
>>
>> Kind regards
>> Regina
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
>> For additional commands, e-mail: dev-help@openoffice.apache.org
>>
> --
> ALG
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


Mime
View raw message