← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2432: 1. angleRange parameter is added to facetCylinder to create "semi-cylinders", "quarter-cylinders"...

 

------------------------------------------------------------
revno: 2432
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-09-10 10:43:25 +0200
message:
  1. angleRange parameter is added to facetCylinder to create "semi-cylinders", "quarter-cylinders" etc.
modified:
  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 'py/utils.py'
--- py/utils.py	2010-09-09 09:51:23 +0000
+++ py/utils.py	2010-09-10 08:43:25 +0000
@@ -341,7 +341,7 @@
 	if wallMask&32: ret+=doWall(E,H,G,F)
 	return ret
 	
-def facetCylinder(center,radius,height,orientation=Quaternion.Identity,segmentsNumber=10,wallMask=7,closed=1,**kw):
+def facetCylinder(center,radius,height,orientation=Quaternion.Identity,segmentsNumber=10,wallMask=7,angleRange=2.0*math.pi,**kw):
 	"""
 	Create arbitrarily-aligned cylinder composed of facets, with given center, radius, height and orientation.
 	Return List of facets forming the cylinder;
@@ -359,6 +359,7 @@
 				number of edges on the cylinder surface (>=5)
 			`wallMask`: bitmask
 				determines which walls will be created, in the order up (1), down (2), side (4). The numbers are ANDed; the default 7 means to create all walls;
+			`angleRange`: this variable allows to create only part of cylinder, 2.0*math.pi means the whole cylinder, 1.0*math.pi - the half etc;
 			`**kw`: (unused keyword arguments)
 				passed to utils.facet;
 	"""
@@ -375,7 +376,7 @@
 		wallMask=7
 	# ___________________________
 	import numpy
-	anglesInRad = numpy.linspace(0, 2.0*math.pi, segmentsNumber+1, endpoint=True)
+	anglesInRad = numpy.linspace(0, angleRange, segmentsNumber+1, endpoint=True)
 	P1=[]; P2=[]
 	P1.append(Vector3(0,0,-height/2))
 	P2.append(Vector3(0,0,+height/2))