From 1bbf6581b4cb33214967490079fd7070d1320ca7 Mon Sep 17 00:00:00 2001 From: Felix Winterhalter <Felix@audiofair.de> Date: Tue, 11 Jul 2017 13:58:10 +0200 Subject: [PATCH] Revert Leapfrog --- src/pe/cr/DEM.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pe/cr/DEM.cpp b/src/pe/cr/DEM.cpp index e4915c75..c6aebbc2 100644 --- a/src/pe/cr/DEM.cpp +++ b/src/pe/cr/DEM.cpp @@ -245,23 +245,23 @@ void DEM::move( BodyID id, real_t dt ) // R * Iinv * R^T * torque const Vec3 wdot( id->getInvInertia() * id->getTorque() ); + // Updating the linear velocity + id->setLinearVel(id->getLinearVel() + vdot * dt); + + // Updating the angular velocity + id->setAngularVel( id->getAngularVel() + wdot * dt ); + // Calculating the translational displacement - id->setPosition( id->getPosition() + id->getLinearVel() * dt + 0.5 * vdot * dt * dt ); + id->setPosition( id->getPosition() + id->getLinearVel() * dt ); // Calculating the rotation angle - const Vec3 phi( id->getAngularVel() * dt + 0.5 * wdot * dt * dt); + const Vec3 phi( id->getAngularVel() * dt ); // Calculating the new orientation if (!floatIsEqual(phi.length(), 0)) id->rotate( Quat( phi, phi.length() ) ); WALBERLA_ASSERT_FLOAT_EQUAL( id->getRotation().getDeterminant(), real_c(1 ), "Corrupted rotation matrix determinant" ); - // Updating the linear velocity - id->setLinearVel(id->getLinearVel() + vdot * dt); - - // Updating the angular velocity - id->setAngularVel( id->getAngularVel() + wdot * dt ); - // Setting the axis-aligned bounding box id->calcBoundingBox(); -- GitLab