yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #04952
[Branch ~yade-dev/yade/trunk] Rev 2304: 1. utils.facetCylinder and utils.facetBox orientations are changed according to https://lists.lau...
------------------------------------------------------------
revno: 2304
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-06-29 23:02:29 +0200
message:
1. utils.facetCylinder and utils.facetBox orientations are changed according to https://lists.launchpad.net/yade-dev/msg04886.html
PLEASE, update your code.
modified:
examples/regular-sphere-pack/regular-sphere-pack.py
py/utils.py
--
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 'examples/regular-sphere-pack/regular-sphere-pack.py'
--- examples/regular-sphere-pack/regular-sphere-pack.py 2010-05-29 20:52:10 +0000
+++ examples/regular-sphere-pack/regular-sphere-pack.py 2010-06-29 21:02:29 +0000
@@ -48,19 +48,17 @@
# Example of utils.facetBox usage
q1 = Quaternion(Vector3(0,0,1),(3.14159/3))
-o1,o_angl = q1.toAxisAngle()
-O.bodies.append(utils.facetBox((12,0,-6+0.9),(1,0.7,0.9),(o1[0],o1[1],o1[2],o_angl),**kwBoxes))
+O.bodies.append(utils.facetBox((12,0,-6+0.9),(1,0.7,0.9),q1,**kwBoxes))
+
q1 = Quaternion(Vector3(0,0,1),(3.14159/2))
-o1,o_angl = q1.toAxisAngle()
-O.bodies.append(utils.facetBox((0,12,-6+0.9),(1,0.7,0.9),(o1[0],o1[1],o1[2],o_angl),**kwBoxes))
+O.bodies.append(utils.facetBox((0,12,-6+0.9),(1,0.7,0.9),q1,**kwBoxes))
+
q1 = Quaternion(Vector3(0,0,1),(3.14159))
-o1,o_angl = q1.toAxisAngle()
-O.bodies.append(utils.facetBox((-12,-12,-6+0.9),(1,0.7,0.9),(o1[0],o1[1],o1[2],o_angl),**kwBoxes))
+O.bodies.append(utils.facetBox((-12,-12,-6+0.9),(1,0.7,0.9),q1,**kwBoxes))
# Example of utils.facetCylinder usage, RotationEngine example see below
q1 = Quaternion(Vector3(0,0,1),(3.14159/2))
-o1,o_angl = q1.toAxisAngle()
-rotateIDs=O.bodies.append(utils.facetCylinder((6.0,6.0,-4.0),2.0,4.0,(o1[0],o1[1],o1[2],o_angl),wallMask=4,segmentsNumber=10,**kwBoxes))
+rotateIDs=O.bodies.append(utils.facetCylinder((6.0,6.0,-4.0),2.0,4.0,q1,wallMask=4,segmentsNumber=10,**kwBoxes))
# Import regular-sphere-pack.mesh into the YADE simulation
O.bodies.append(ymport.gmsh('regular-sphere-pack.mesh',**kwMeshes))#generates facets from the mesh file
=== modified file 'py/utils.py'
--- py/utils.py 2010-06-16 16:39:17 +0000
+++ py/utils.py 2010-06-29 21:02:29 +0000
@@ -266,7 +266,7 @@
b.mask=mask
return b
-def facetBox(center,extents,orientation=Quaternion().Identity,wallMask=63,**kw):
+def facetBox(center,extents,orientation=Quaternion.Identity,wallMask=63,**kw):
"""
Create arbitrarily-aligned box composed of facets, with given center, extents and orientation.
If any of the box dimensions is zero, corresponding facets will not be created. The facets are oriented outwards from the box.
@@ -306,15 +306,15 @@
def doWall(a,b,c,d):
return [facet((a,b,c),**kw),facet((a,c,d),**kw)]
ret=[]
- qTemp = Quaternion(Vector3(orientation[0],orientation[1],orientation[2]),orientation[3])
- A=qTemp.Rotate(Vector3(mn[0],mn[1],mn[2]))+center
- B=qTemp.Rotate(Vector3(mx[0],mn[1],mn[2]))+center
- C=qTemp.Rotate(Vector3(mx[0],mx[1],mn[2]))+center
- D=qTemp.Rotate(Vector3(mn[0],mx[1],mn[2]))+center
- E=qTemp.Rotate(Vector3(mn[0],mn[1],mx[2]))+center
- F=qTemp.Rotate(Vector3(mx[0],mn[1],mx[2]))+center
- G=qTemp.Rotate(Vector3(mx[0],mx[1],mx[2]))+center
- H=qTemp.Rotate(Vector3(mn[0],mx[1],mx[2]))+center
+
+ A=orientation*Vector3(mn[0],mn[1],mn[2])+center
+ B=orientation*Vector3(mx[0],mn[1],mn[2])+center
+ C=orientation*Vector3(mx[0],mx[1],mn[2])+center
+ D=orientation*Vector3(mn[0],mx[1],mn[2])+center
+ E=orientation*Vector3(mn[0],mn[1],mx[2])+center
+ F=orientation*Vector3(mx[0],mn[1],mx[2])+center
+ G=orientation*Vector3(mx[0],mx[1],mx[2])+center
+ H=orientation*Vector3(mn[0],mx[1],mx[2])+center
if wallMask&1: ret+=doWall(A,D,H,E)
if wallMask&2: ret+=doWall(B,F,G,C)
if wallMask&4: ret+=doWall(A,E,F,B)
@@ -368,8 +368,8 @@
P1.append(Vector3(X,Y,-height/2))
P2.append(Vector3(X,Y,+height/2))
for i in range(0,len(P1)):
- P1[i]=orientation*(P1[i])+Vector3(center[0],center[1],center[2])
- P2[i]=orientation*(P2[i])+Vector3(center[0],center[1],center[2])
+ P1[i]=orientation*P1[i]+center
+ P2[i]=orientation*P2[i]+center
ret=[]
for i in range(2,len(P1)):