← Back to team overview

yade-users team mailing list archive

Re: [Question #705414]: Accessing Quaternions' Components

 

Question #705414 on Yade changed:
https://answers.launchpad.net/yade/+question/705414

Utku posted a new comment:
Hello again.

I just figured out how to access the Quaternions' components. First, you
need to change Quaternion to tuple using the toAngleAxis() method. For
example, suppose we again have the same Quaternion that I used in my
question:

q =
Quaternion((-0.5511712429622227516,0.6264347706369409741,-0.5511712429622227516),2.022331863044346534)

Let us use toAngleAxis method and assign it to a different variable
name, say t.

t = q.toAngleAxis()

Then, t will become
(Vector3(-0.5511712429622227516,0.6264347706369409741,-0.5511712429622227516),
2.0223318630443465)

One can easily access the components now. t[0][0], t[0][1], t[0][2] are
the i,j,k values of the quaternion, and t[1] is the angle.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.