yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11904
[Branch ~yade-pkg/yade/git-trunk] Rev 3608: box inertia computation correction
------------------------------------------------------------
revno: 3608
committer: Jan Stransky <jan.stransky@xxxxxxxxxxx>
timestamp: Wed 2015-03-04 13:51:37 +0100
message:
box inertia computation correction
modified:
py/utils.py
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'py/utils.py'
--- py/utils.py 2014-12-01 18:29:59 +0000
+++ py/utils.py 2015-03-04 12:51:37 +0000
@@ -220,7 +220,8 @@
b=Body()
b.shape=Box(extents=extents,color=color if color else randomColor(),wire=wire,highlight=highlight)
V=8*extents[0]*extents[1]*extents[2]
- geomInert=Vector3(4*(extents[1]**2+extents[2]**2),4*(extents[0]**2+extents[2]**2),4*(extents[0]**2+extents[1]**2))
+ # I = m*dim**2/12. = (m=V) = V*(2*extent)**2/12. = V*extent**2*4/12. = V*extent**2/3.
+ geomInert=(V/3.)*Vector3(extents[1]**2+extents[2]**2,extents[0]**2+extents[2]**2,extents[0]**2+extents[1]**2)
_commonBodySetup(b,V,geomInert,material,pos=center,dynamic=dynamic,fixed=fixed)
b.state.ori=orientation
b.mask=mask