Get rotation matrix of clumped spheres

Asked by Sebastien Loriot on 2012-03-01

Hello,

I am running a simulation with a bunch of clumped spheres. At the end of the simulation,
I would like for each clump to have the rotation matrix that brings the clump from its original
orientation to its final one.

Is there a simple way to do that?

Thanks,

Sebastien.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
2012-03-02
Last query:
2012-03-02
Last reply:
2012-03-02

Hi Sebastien,

The current rotation is O.bodies[id].state.ori, defined with respect to
the initial orientation.
It is a quaternion, but it is easily converted to a matrix as follows:

Initial state:

Yade [3]: s=O.bodies[10].state
Yade [4]: s.ori
 -> [4]: Quaternion((1,0,0),0)
Yade [5]: s.ori.toRotationMatrix()
 -> [5]: Matrix3(1,0,0, 0,1,0, 0,0,1)

... then after some iterations:

Yade [6]: s.ori
 -> [6]:
Quaternion((-0.01610542244969038,0.64554625934713161,0.76355133580568291),1.2211557600740852)
Yade [7]: s.ori.toRotationMatrix()
 -> [7]: Matrix3(0.342731,-0.724189,0.598403,
0.710518,0.616535,0.339188, -0.614573,0.308926,0.725855)

Sebastien Loriot (sloriot-ml) said : #2

Thanks Chareyre, that solved my question.