1
\$\begingroup\$

I have a 2D square. It has an initial position translation T0. It rotates about the Z axis, about an arbitrary point, say 45 degrees, then moves (translates) along the +X axis some distance.

I'm trying to put together the 4x4 homogeneous transform (this example is only 2D but the problem is really in 3D) to move the square but I seem to be missing something, and I get odd results.

T0 := initial translation to some point T1 := center of rotation point Rz := rotation Matrix about Z and about point located at T1 T2 := additional translation TF := final transform p := a vertex of the square to rotate If I use the following sequence -

TF = T2 * T1 * Rz * T1^-1 * T0

I can rotate about T1 as long as T2 is (0,0).

If I use only T0 - by combining T0 and T2 - it rotates correctly but it moves along the rotated X axis rather than the original X axis.

So, it seems I can

Transform first and get the rotation correct but not the translation OR Transform last and get the translation correct but not the rotation.

example:

move to 10,10 rotate about 9.5, 9.5 move -5,0

Example

It seems there should be a way to get my desired result, but I seem to be missing something.

Thanks

Rick

\$\endgroup\$
1
\$\begingroup\$

is this the transform you require for
move to 10,10 rotate about 9.5, 9.5 move -5,0:

rot = 45 degrees
trans1 = vec(10.0,10.0,0.0)
trans2 = vec(-5.0,0.0,0.0)
rot_point = vec(9.5,9.5,0.0)

translate(trans2) *
translate(rot_point) *
rotatez(rot) *
translate(trans1 - rot_point)
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.