Welcome to Fractal Forums

Fractal Software => Mandelbulb 3d => Topic started by: DarkBeam on June 18, 2011, 01:18:01 PM




Title: Rotation matrix & inverse rot
Post by: DarkBeam on June 18, 2011, 01:18:01 PM
Question to Jesse (and/or other folks) :D

The function Rotate gives a "rotation matrix" for three given angles; x,y,z

Is it easy to get the reverse rotation starting from it?

I mean, for the rotation -x,-y,-z. :dink:

Luca

Rot matrix is in form;

x' = x*m[0,0] + y*m[0,1] + z*m[0,2]
y' = x*m[1,0] + y*m[1,1] + z*m[1,2]
z' = x*m[2,0] + y*m[2,1] + z*m[2,2]


Title: Re: Rotation matrix & inverse rot
Post by: Jesse on June 19, 2011, 01:47:25 AM
If you flip the indizes you get the inverse rotation, m[y,x] -> m[x,y]

cheers


Title: Re: Rotation matrix & inverse rot
Post by: DarkBeam on June 19, 2011, 04:38:57 PM
If you flip the indizes you get the inverse rotation, m[y,x] -> m[x,y]

cheers

Okay! m[0,0] is the first param in memory, and others follow in order?  :)


Title: Re: Rotation matrix & inverse rot
Post by: Jesse on June 19, 2011, 11:33:01 PM
Ok, a bit more details (was late yesterday  ^-^)

It is the transposed matrix, so if you want to use the same rotation matrix you would calculate the inverse rotation this way:

x' = x*m[0,0] + y*m[1,0] + z*m[2,0]
y' = x*m[0,1] + y*m[1,1] + z*m[2,1]
z' = x*m[0,2] + y*m[1,2] + z*m[2,2]


Or you transpose the matrix first (mtmp=m; for x=0 to 2 for y=0 to 2 m[x,y] = mtmp[y,x]) and do your standard rotation calculation with the transposed matrix.

This way to do the inverse rotation works only with pure normalized rotation matrices, should be noticed.


Title: Re: Rotation matrix & inverse rot
Post by: DarkBeam on June 20, 2011, 08:55:50 AM
I already knew it, I studied matrices for the university ;)
I am asking if the first matrix element is loaded in the first memory cell on function call ... There is no hurry to reply I can also find the answer by myself lol


Title: Re: Rotation matrix & inverse rot
Post by: Jesse on June 21, 2011, 01:26:10 AM
I see, so you missed some lessons?  :dink:
 ;D

The user parameters are in decreasing order, so the first matrix entry m[0,0] is on the top, next m[0,1] one below... etc.

Just don't rely on a special right or left hand rule for rotations, i have no strong relation to standards  :)

cheers


 


Title: Re: Rotation matrix & inverse rot
Post by: DarkBeam on June 21, 2011, 09:26:34 AM
I see, so you missed some lessons?  :dink:
 ;D

Italian education system is not very good... ;D

Now I will try with your quick course ;D :beer: