← Back to team overview

yade-users team mailing list archive

Re: [Question #702938]: About the code of sphere 3D ratation in yade

 

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

    Status: Answered => Open

xuanshenyu is still having a problem:
Thanks for your reply, Jan!

>the mean is I want to the declear of quaternion and other parapmeter in
C++ code, which are used to defined the 3D rotation. so I  can call
those parameter. And I have found the code in pkg/dem/NewtonIntegrator.*
and Yade documentation.

>I'm learning a little bit about 3D ratation, and there are four ways to
represent 3D ratation: Euler angle, aixs-angle, ratation matrix and
quaternion[3]. However, I can't understand the code in
pkg/dem/NewtonIntegrator.cpp as follow:

void NewtonIntegrator::leapfrogSphericalRotate(State* state, const Real& dt)
{
	if (scene->isPeriodic && homoDeform) { state->angVel += dSpin; }
	Real angle2 = state->angVel.squaredNorm();
	if (angle2 != 0) { //If we have an angular velocity, we make a rotation
		Real        angle = sqrt(angle2);
		Quaternionr q(AngleAxisr(angle * dt, state->angVel / angle));
		state->ori = q * state->ori;
	}
	state->ori.normalize();
}

There are used the quaternion but the calculate method of quaternion is
different from [3]. Could you help me explain this code? and from
thoretical method to code implementatyion process.

Shenyu

[3]https://www.euclideanspace.com/maths/geometry/rotations/theory/index.htm

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