yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #10681
[Branch ~yade-pkg/yade/git-trunk] Rev 3892: fix https://bugs.launchpad.net/yade/+bug/1301443
------------------------------------------------------------
revno: 3892
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Tue 2014-04-08 21:11:03 +0200
message:
fix https://bugs.launchpad.net/yade/+bug/1301443
modified:
pkg/dem/NewtonIntegrator.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp 2014-04-03 13:09:06 +0000
+++ pkg/dem/NewtonIntegrator.cpp 2014-04-08 19:11:03 +0000
@@ -231,10 +231,10 @@
void NewtonIntegrator::leapfrogSphericalRotate(State* state, const Body::id_t& id, const Real& dt )
{
- Vector3r axis = state->angVel;
- if (axis!=Vector3r::Zero()) {//If we have an angular velocity, we make a rotation
- Real angle=axis.norm(); axis/=angle;
- Quaternionr q(AngleAxisr(angle*dt,axis));
+ 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;
}
if(scene->forces.getMoveRotUsed() && scene->forces.getRot(id)!=Vector3r::Zero()) {