Math Problem

How do I extract the rotation from a transform matrix? There is no atan2 or anything, right?

there’s arctan2(x,y) implemented within the Expr (Value) node. undocumented though…

Thanks woei!
Also just found the -Function (Complex Inverse)- node.
Unfortunately I forgot that the scaling is also part of the same matrix… no idea how to decompose all that mixture yet… :/
Any math crack out there?

you shouldn’t, because in general there is not THE solution but an infinite number of solutions… no one does that, if you have to decompose a transform, you should consider to re-think your patch or try to get the transform values from earlier in the patch.

The task is to exchange y and z within the transform. De- and recomposing was the first solution I could think of.

if you want to exchange y and z fields within the matrix you can read the matrix with GetMatrix, sort out the right slices with GetSlice and put that into a SetMatrix node. however i still don’t understand the task behind that. what is it what you really want to achieve? is there a patch illustrating the problem?

VVVVs transform 3D node applies many transformations in one go. So how could I exchange the fields afterwards?

What I’m up to: I’d like to take a row of transformations and apply it to 2 different coordinate systems. The normal Direct3D one and one with y and z exchanged.

i just patched what i described above. just use it as a module and give a feedback if it works / if it has something todo with your problem.

RightHanded (Transform).v4p (5.7 kB)

Thanks gregsn! But as far as I can see (just opened the patch), your module set y and z scaling to 0.

i suppose you can do that with the ParalellEpiped node, which sets up a new coordinate system…

hm. it works for me. but it should work for you, right? do you have a patch which illustrates the problem?

i did a demo patch for the solution for the problem as i understood it.

please put the new module into the modules path within the vvvv directory. it is updated and now supports spreading.

what the module does:

it just rearranges the columns of the matrix.
note that a matrix

1 0 0 0
0 1 0 0
0 0 1 0
1 2 3 1

can be read like

  1. column:
    new_x = 1x + 0y + 0*z + 1
    new_x = x + 1

  2. column:
    new_y = y + 2

  3. column:
    new_z = z + 3

(4. column: new_w = w)

after swaping the second and third column you just set new_y to what normally gets applied to z and the other way round. so in fact this is a mirroring at the plane y=z.

1 0 0 0
0 0 1 0
0 1 0 0
1 3 2 1

  1. column:
    new_y = z + 3

  2. column:
    new_z = y + 2

hope that helps!
greetings, s

hi again.
ahm.

ah: module and demo patch.

don’t forget to put the module into the modules folder to get that working.

right handed demo.zip (2.9 kB)

Thanks gregsn for your kind help. Unfortunately the matrix has to stay orthogonal. That’s the problem…

another way of thinking of the mirroring at the plane is this:

first invert the world in z direction. a scale with -1 will do that. and you have your right handed system already. the z direction arrow (normally pointing into the screen) is now pointing at you.

now if you really want to have y pointing into the depth and z upwards you have to rotate your world around x by 90 degrees and now the z arrow is pointing upwards and the y arrow points into the screen.

there are always so many solutions to the same problem.

however i still hope that i understood your problem right…

RightHanded (Transform).v4p (3.2 kB)

if you use an orthogonal matrix as the source, you will get an orthogonal matrix as the result of the module.