← Back to team overview

yade-dev team mailing list archive

[svn] r1809 - trunk/gui/py

 

Author: richefeu
Date: 2009-06-23 18:12:27 +0200 (Tue, 23 Jun 2009)
New Revision: 1809

Modified:
   trunk/gui/py/utils.py
Log:
Add the function NormalRestitution2DampingRate.


Modified: trunk/gui/py/utils.py
===================================================================
--- trunk/gui/py/utils.py	2009-06-23 14:18:13 UTC (rev 1808)
+++ trunk/gui/py/utils.py	2009-06-23 16:12:27 UTC (rev 1809)
@@ -424,4 +424,11 @@
 	negIds,posIds=negPosExtremeIds(axis=axis,distFactor=2.2)
 	return {'negIds':negIds,'posIds':posIds,'axis':axis,'area':min(areas)}
 
-
+def NormalRestitution2DampingRate(en):
+        """Compute the normal damping rate as a function of the normal coefficient of restitution.
+        """
+	if en == 0.0: return 0.999999999
+	if en == 1.0: return 0.0
+	from math import sqrt,log,pi
+	ln_en = math.log(en)
+	return (-ln_en/math.sqrt((math.pow(ln_en,2) + math.pi*math.pi)))