Math question


(klopes) #1

Which convention uses blender to generate the rotation matrix? In other words, i 've an axis system, with the corresponding Euler angles: what i’ve to do to create an object (python, of course) oriented in that way?

Where do i found such math material, or so…??? It’s for the Kloputils 2.0, with a lot of new features, but i am jammed with the calculus!
(v1.0 is at http://usuarios.lycos.es/klopes/enchufes.htm)


(eeshlo) #2

This might help:
http://www.elysiun.com/viewtopic.php?t=184


(klopes) #3

Thanks, I’ve just copied all the scripts and look great, next time I promise to look before in the forum 8)


(klopes) #4

NO,no,no!

Really, this is my problem:

I have the 3 (ortogonal) vectors of a basis: OX,OY and OZ. Now I want to create a new object whose orientation was THAT BASIS.
For that, I must calculate the Euler angles and put on the obj.rot, but… ¿how, exactly? Which’s the correct order in the angles calculus? Somebody has done it? Is there a drawing with the angles placed on an axis? It can be very long to get! :frowning:


(eeshlo) #5

I don’t really understand what you are trying to do, you said first you had the euler angles, now you say you need to know the euler angles. From what exactly?

Matrix? Use the functions from the link

Vectors?
You probably mean this.
If you have three axis vectors, then you could normalize them and construct a matrix from it like this:
mtx = [[vector OX], [vector OY], [vector OZ]]
and then use the mat2euler function to get the euler angles.

Arbitrary set of meshvertices?
Do a ‘Google’ for “eigenvectors from covariance matrix”, real fun stuff…


(klopes) #6

Well, the algoritm starts from a matrix like:


[D*F     ,   D*E   , -C ], 
[AC*F-B*E, AC*E+B*F, A*D], 
[BC*F+A*E, BC*E-A*F, B*D]

(it’s extracted from the makeRotMtx3D function, and:
A, B = sin(rx), cos(rx)
C, D = sin(ry), cos(ry)
E, F = sin(rz), cos(rz) )
that is, the rotation matrix. But I have the vectors:

[OXx,OXy,OXz]
[OYx,OYy,OYz]
[OZx,OZy,OZz]

The mat2euler algoritm works with the 1st. model. I’m trying to understand how euler angles run, looking how they vary as the object rotates. When i get something, I’ll post it. Thanks for all.


(klopes) #7

Well… I finally, noticed myself the squizofrenique situation… now I’m looking for both, a tall anough bridge and a deep river, and falling and falling, and… AAAARGGGHH! Yes I know, BOTH matrices are the same. Ok. Yes! Now, I know all you can’t stop laughing of me, but, YOU, know a think: I model 3Des very well!