Forum Replies Created
-
AuthorPosts
-
DeimelBlocked
It would probably be nice to also fix it in the current “stable” v15-09 branch.
Best,
RaphaelDeimelBlockedHello Maxime,
Please have a look at the testcase I posted, it doesn’t contain a RigidRigidMapping directive but nevertheless rotates the DOFs around the wrong axis (the DoF’s frame instead of the global frame).
Best,
RaphaelDeimelBlockedThe forum does not seem to handle code correctly :/
Patch:
http://pastebin.com/cE3X4YENTestcase:
http://pastebin.com/X10WnYPHDeimelBlockedSeems like the rotations are applied to MechanicalObject’s in the wrong order. As long as either of the rotation property or the DoF’s orientation in the position property are not set (or set to 0 0 0 1), this bug does not affect the outcome.
Here’s the simple fix:
diff --git a/modules/SofaBaseMechanics/MechanicalObject.cpp b/modules/SofaBaseMechanics/MechanicalObject.cpp index 074ea8e..9c32cfe 100644 --- a/modules/SofaBaseMechanics/MechanicalObject.cpp +++ b/modules/SofaBaseMechanics/MechanicalObject.cpp @@ -132,7 +132,7 @@ void MechanicalObject<defaulttype::Rigid3dTypes>::applyRotation (const defaultty for (unsigned int i = 0; i < x.size(); i++) { x[i].getCenter() = q.rotate(x[i].getCenter()); - x[i].getOrientation() *= q; + x[i].getOrientation() = q * x[i].getOrientation(); } }
It would be nice if somebody with repository access could fix the patch 🙂 Here’s a simple testcase to check the result:
<?xml version="1.0"?> <!-- the point frame coordinates are rotated in global frame, but the orientation is rotated in local frame --> <Node name="root" gravity="0 -9.81 0" dt="1e-4" time="0" > <BackgroundSetting name="prettify" color=" 0 0 0" /> <ViewerSetting cameraMode="Orthographic" /> <VisualStyle name="visualStyle1" displayFlags="showVisual showBehaviorModels hideForceFields showInteractionForceFields hideCollision hideMapping hideOptions" /> <MultiStepAnimationLoop collisionSteps="1" integrationSteps="5"/> <MechanicalObject template="Rigid3d" name="DOFs" showObjectScale="2.5" showObject="1" rest_position=" 0 0 0 0 0 0 1 32.1804178343 0.0 11.73187801 0.0 0.371991451914 0.0 -0.928236155137 42.4985667543 0.0 38.9022536239 0.0 0.702721776175 0.0 -0.711464760399 " translation="0 0 0" rotation="0 0 0" /> <MechanicalObject template="Rigid3d" name="DOFs" showObjectScale="2.5" showObject="1" rest_position=" 0 0 0 0 0 0 1 32.1804178343 0.0 11.73187801 0.0 0.371991451914 0.0 -0.928236155137 42.4985667543 0.0 38.9022536239 0.0 0.702721776175 0.0 -0.711464760399 " translation="0 0 0" rotation="0 0 30" /> </Node> </Node>
DeimelBlocked -
AuthorPosts