← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2078: Adaptation to Eigen Library

 

------------------------------------------------------------
revno: 2078
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
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;
 }


Follow ups