Hi,
Extracting data from a translation is problematic. The Transform3D
consists of a 4x4 matrix of values usually expressed by a <letter> <row number>
<column number> such as:
E11 E12 E13 E14
E21 E22 E23 E24
E31 E32 E33 E34
E41 E42 E43 E44
When making up a series of transformations you start with an identity transform
where the diagonal elements (row = column) are all 1's and all other elements
0's. This can then be multiplied by other transforms to achieve the desired
result. To uniformly scale an object, take an identity matrix and place the
scale factor in position E44. If you want to independently scale in the x
direction, place the scale factor in position E11. Similarly, scaling y or z
are the values of E22 and E23 respectively. To translate (move) an object, the
change in position is applied to the fourth column with E14 being the x offset,
E24 the y, and E34 the z. A rotation about an axis would insert the sine and
or cosine of the rotation angle into the upper 3x3 as follows:
About x axis About y axis
About z axis
1 0 0 0 cos 0 sin
0 cos -sin 0 0
0 cos -sin 0 0 1 0
0 sin cos 0 0
0 sin cos 0 -sin 0 cos
0 0 0 1 0
0 0 0 1 0 0 0
1 0 0 0 1
Independently altering other values of the matrix can produce shears,
reflections, etc.
It must be remembered that all of the transformations are relative to the
origin of the object’s coordinate system (usually the center of your locale)
and that the sequence in which they are performed is important. A rotation
followed by a translation is not the same as a translation followed by a
rotation. Think of holding an object in your hand next to your body (the
origin). Rotating it then sticking your arm out to the right. The final
object orientation will end up different if you first stick your arm out and
rotating the whole arm. Even scaling will make a difference. If you scale an
object which is not at the origin by *4, the object grows but will also move
away from the origin by a factor of four. For many rotation and scaling
problems you will want to first translate the object to the origin, rotate (or
scale) it, then translate it back to where you want it.
Looking at the construction of the matrices above, trying to extract the
individual impact of the object manipulation is extremely difficult. If you
read out a Transform3D and the only data which varies from the identity matrix
matches one of the patterns above you can derive the operation the data
performs. On the other hand, data in the upper 3x3 portion could be any
combination or rotations or scaling. Too tough to figure out in most cases.
I know this probably doesn’t help your problem, but it should help answer
your question. I found the book “Computer Graphics - C version” by Donald
Hearn and Pauline Baker (Prentice Hall) is generally quite readable when trying
to figure out this graphics stuff. The example code is in C but a Java user
should be able to understand it with no difficulty.
Good luck - Gary Graf
Hai Ning wrote:
> REPOST: can any one help me with this?
>
> can someone point me to the formula such that:
>
> given the 4 by 4 transform matrix, it calculates
> the translation(x, y, z), rotation(x, y, z) and
> the scale factor(x, y, z)?
>
> thanks in advance.
>
> -hai
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".