yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #04005
facetCylinder orientation
Hello!
Can we replace orientation by quaternion for orientation by axis in
utils.facetCylinder?
Seems, it will be more simple for users.
Diff is attached.
S.
=== modified file 'py/utils.py'
--- py/utils.py 2010-04-10 15:11:48 +0000
+++ py/utils.py 2010-04-15 09:47:06 +0000
@@ -304,7 +304,7 @@
if wallMask&32: ret+=doWall(E,H,G,F)
return ret
-def facetCylinder(center,radius,height,orientation=[1,0,0,0],segmentsNumber=10,wallMask=7,closed=1,**kw):
+def facetCylinder(center,radius,height,axis=Vector3(0,0,1),segmentsNumber=10,wallMask=7,**kw):
"""
Create arbitrarily-aligned cylinder composed of facets, with given center, radius, height and orientation.
Return List of facets forming the cylinder;
@@ -348,7 +348,9 @@
Y=radius*math.sin(i)
P1.append(Vector3(X,Y,-height/2))
P2.append(Vector3(X,Y,+height/2))
- qTemp = Quaternion(Vector3(orientation[0],orientation[1],orientation[2]),orientation[3])
+ axis_default = Vector3(0,0,1)
+ axis.Normalize()
+ qTemp = Quaternion().Align( axis_default, axis )
for i in range(0,len(P1)):
P1[i]=qTemp.Rotate(P1[i])+Vector3(center[0],center[1],center[2])
P2[i]=qTemp.Rotate(P2[i])+Vector3(center[0],center[1],center[2])
Follow ups