void PlaneForceField<Rigid3dTypes>::setPlane(const Deriv& normal, Real d) { Real n = normal.getVCenter().norm(); planeNormal.beginEdit()->getVCenter() = normal.getVCenter() / n; planeNormal.endEdit(); planeD.setValue( d / n ); }
void PlaneForceField<Rigid3dTypes>::rotate( Deriv axe, Real angle ) { defaulttype::Vec3d axe3d(1,1,1); axe3d = axe.getVCenter(); defaulttype::Vec3d normal3d; normal3d = planeNormal.getValue().getVCenter(); defaulttype::Vec3d v = normal3d.cross(axe3d); if (v.norm2() < 1.0e-10) return; v.normalize(); v = normal3d * cos ( angle ) + v * sin ( angle ); planeNormal.beginEdit()->getVCenter() = v; planeNormal.endEdit(); }