------------------------------------------------------------
revno: 2078
committer: Anton Gladky <gladky.an...@gmail.com>
branch nick: trunk
timestamp: Fri 2010-03-12 22:20:32 +0100
message:
  Adaptation to Eigen Library
modified:
  pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp	2010-03-10 09:18:14 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp	2010-03-12 21:20:32 +0000
@@ -40,9 +40,12 @@
  * @note It is not checked whether planePt relly lies on the tangent plane. If not, result will be incorrect.
  */
 Quaternionr Dem3DofGeom_SphereSphere::rollPlanePtToSphere(const Vector3r& planePt, const Real& radius, const Vector3r& planeNormal){
-	Vector3r axis=planeNormal.Cross(planePt); axis.Normalize();
-	Real angle=planePt.Length()/radius;
-	Quaternionr normal2pt(axis,angle);
+	Quaternionr normal2pt;
+	if (planePt!=Vector3r::ZERO) {
+		Vector3r axis=planeNormal.Cross(planePt); axis.Normalize();
+		Real angle=planePt.Length()/radius;
+		normal2pt.FromAxisAngle(axis,angle);
+	}
 	Quaternionr ret; ret.Align(Vector3r::UNIT_X,normal2pt*planeNormal);
 	return ret;
 }

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to