yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #28583
Re: [Question #703712]: Use quaternion to transform coordinate system in yade
Question #703712 on Yade changed:
https://answers.launchpad.net/yade/+question/703712
Status: Open => Answered
Jan Stránský proposed the following answer:
Hello,
> I try to use quaternion in yade source code
Suggestion: try it in python first.
Why do you need it in C++? Is the value needed in C++?
> granular coordinate system and geodetic coordinate system.
In yade, usually "local" and "global" is used terminology
> May I ask if this method is correct?
of course you may ask.
What also you may do is to test it yourself.
Create an artificial settings, where you know p1 and p2 and test if the code works as expected or not.
If it does not work, then it is not correct.
If it does work, it might be correct.
> May I ask if this method is correct?
> Quaternionr(se31,orientation)
First thing to make it correct is to compile the code and fix errors
> p2=Quaternionr(se31,orientation).inverse()*(p1-se31.position)
//p2=Q^-1*(p1-position)
I **guess** (not tested, just intuition, you have to verify yourself) that it should be inverse:
p2 = se31.position + Quaternionr(se31.orientation)*p1 //p2=position+Q*p1
or in Python:
p2 = state.pos + state.ori * p1
Cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.