Esempio n. 1
0
def facetSphere(center,
                radius,
                thetaResolution=8,
                phiResolution=8,
                returnElementMap=False,
                **kw):
    """
	Create arbitrarily-aligned sphere composed of facets, with given center, radius and orientation.
	Return List of facets forming the sphere. Parameters inspired by ParaView sphere glyph

	:param Vector3 center: center of the created sphere
	:param float radius: sphere radius
	:param int thetaResolution: number of facets around "equator"
	:param int phiResolution: number of facets between "poles" + 1
	:param bool returnElementMap: returns also tuple of nodes ((x1,y1,z1),(x2,y2,z2),...) and elements ((id01,id02,id03),(id11,id12,id13),...) if true, only facets otherwise
	:param \*\*kw: (unused keyword arguments) passed to utils.facet;
	"""
    # check zero dimentions
    if (radius <= 0):
        raise RuntimeError("The radius should have the positive value")
    if (thetaResolution < 3): raise RuntimeError("thetaResolution must be > 3")
    if (phiResolution < 3): raise RuntimeError("phiResolution must be > 3")

    r, c0, c1, c2 = radius, center[0], center[1], center[2]
    nodes = [Vector3(c0, c1, c2 + radius)]
    phis = numpy.linspace(math.pi / (phiResolution - 1),
                          math.pi,
                          phiResolution - 2,
                          endpoint=False)
    thetas = numpy.linspace(0, 2 * math.pi, thetaResolution, endpoint=False)
    nodes.extend((Vector3(c0 + r * math.cos(theta) * math.sin(phi),
                          c1 + r * math.sin(theta) * math.sin(phi),
                          c2 + r * math.cos(phi)) for phi in phis
                  for theta in thetas))
    nodes.append(Vector3(c0, c1, c2 - radius))
    n = len(nodes) - 1

    elements = [(0, i + 1, i + 2) for i in xrange(thetaResolution - 1)]
    elements.append((0, 1, thetaResolution))
    for j in xrange(0, phiResolution - 3):
        k = j * thetaResolution + 1
        elements.extend((k + i, k + i + 1, k + i + thetaResolution)
                        for i in xrange(thetaResolution - 1))
        elements.append(
            (k, k + thetaResolution - 1, k + 2 * thetaResolution - 1))
        elements.extend(
            (k + i + thetaResolution, k + i + 1 + thetaResolution, k + i + 1)
            for i in xrange(thetaResolution - 1))
        elements.append((k + 2 * thetaResolution - 1, k + thetaResolution, k))
    elements.extend(
        (n, n - i - 1, n - i - 2) for i in xrange(thetaResolution - 1))
    elements.append((n, n - 1, n - thetaResolution))

    facets = [
        utils.facet(tuple(nodes[node] for node in elem), **kw)
        for elem in elements
    ]
    if returnElementMap:
        return facets, nodes, elements
    return facets
Esempio n. 2
0
File: geom.py Progetto: DEMANY/trunk
def facetPolygonHelixGenerator(center,radiusOuter,pitch=0,orientation=Quaternion((0,1,0),0.0),segmentsNumber=10,angleRange=None,radiusInner=0,**kw):
	"""
	Please, do not use this function directly! Use geom.facetPloygon and geom.facetHelix instead.
	This is the base function for generating polygons and helixes from facets.
	"""
	# check zero dimentions
	if (segmentsNumber<3): raise RuntimeError("The segmentsNumber should be at least 3");
	if (radiusOuter<=0): raise RuntimeError("The radiusOuter should have the positive value");
	if (radiusInner<0): raise RuntimeError("The radiusInner should have the positive value or 0");
	if angleRange==None: angleRange=(0,2*math.pi)
	
	anglesInRad = numpy.linspace(angleRange[0], angleRange[1], segmentsNumber+1, endpoint=True)
	heightsInRad = numpy.linspace(0, pitch*(abs(angleRange[1]-angleRange[0])/(2.0*math.pi)), segmentsNumber+1, endpoint=True)
	
	POuter=[];
	PInner=[];
	PCenter=[];
	z=0;
	for i in anglesInRad:
		XOuter=radiusOuter*math.cos(i); YOuter=radiusOuter*math.sin(i); 
		POuter.append(Vector3(XOuter,YOuter,heightsInRad[z]))
		PCenter.append(Vector3(0,0,heightsInRad[z]))
		if (radiusInner<>0):
			XInner=radiusInner*math.cos(i); YInner=radiusInner*math.sin(i); 
			PInner.append(Vector3(XInner,YInner,heightsInRad[z]))
		z+=1
	
	for i in range(0,len(POuter)):
		POuter[i]=orientation*POuter[i]+center
		PCenter[i]=orientation*PCenter[i]+center
		if (radiusInner<>0):
			PInner[i]=orientation*PInner[i]+center
	
	ret=[]
	for i in range(1,len(POuter)):
		if (radiusInner==0):
			ret.append(utils.facet((PCenter[i],POuter[i],POuter[i-1]),**kw))
		else:
			ret.append(utils.facet((PInner[i-1],POuter[i-1],POuter[i]),**kw))
			ret.append(utils.facet((PInner[i],PInner[i-1],POuter[i]),**kw))
	
	return ret
Esempio n. 3
0
def facetPolygonHelixGenerator(center,radiusOuter,pitch=0,orientation=Quaternion.Identity,segmentsNumber=10,angleRange=None,radiusInner=0,**kw):
	"""
	Please, do not use this function directly! Use geom.facetPloygon and geom.facetHelix instead.
	This is the base function for generating polygons and helixes from facets.
	"""
	# check zero dimentions
	if (segmentsNumber<3): raise RuntimeError("The segmentsNumber should be at least 3");
	if (radiusOuter<=0): raise RuntimeError("The radiusOuter should have the positive value");
	if (radiusInner<0): raise RuntimeError("The radiusInner should have the positive value or 0");
	if angleRange==None: angleRange=(0,2*math.pi)
	
	anglesInRad = numpy.linspace(angleRange[0], angleRange[1], segmentsNumber+1, endpoint=True)
	heightsInRad = numpy.linspace(0, pitch*(abs(angleRange[1]-angleRange[0])/(2.0*math.pi)), segmentsNumber+1, endpoint=True)
	
	POuter=[];
	PInner=[];
	PCenter=[];
	z=0;
	for i in anglesInRad:
		XOuter=radiusOuter*math.cos(i); YOuter=radiusOuter*math.sin(i); 
		POuter.append(Vector3(XOuter,YOuter,heightsInRad[z]))
		PCenter.append(Vector3(0,0,heightsInRad[z]))
		if (radiusInner<>0):
			XInner=radiusInner*math.cos(i); YInner=radiusInner*math.sin(i); 
			PInner.append(Vector3(XInner,YInner,heightsInRad[z]))
		z+=1
	
	for i in range(0,len(POuter)):
		POuter[i]=orientation*POuter[i]+center
		PCenter[i]=orientation*PCenter[i]+center
		if (radiusInner<>0):
			PInner[i]=orientation*PInner[i]+center
	
	ret=[]
	for i in range(1,len(POuter)):
		if (radiusInner==0):
			ret.append(utils.facet((PCenter[i],POuter[i],POuter[i-1]),**kw))
		else:
			ret.append(utils.facet((PInner[i-1],POuter[i-1],POuter[i]),**kw))
			ret.append(utils.facet((PInner[i],PInner[i-1],POuter[i]),**kw))
	
	return ret
Esempio n. 4
0
File: geom.py Progetto: DEMANY/trunk
def facetSphere(center,radius,thetaResolution=8,phiResolution=8,returnElementMap=False,**kw):
	"""
	Create arbitrarily-aligned sphere composed of facets, with given center, radius and orientation.
	Return List of facets forming the sphere. Parameters inspired by ParaView sphere glyph

	:param Vector3 center: center of the created sphere
	:param float radius: sphere radius
	:param int thetaResolution: number of facets around "equator"
	:param int phiResolution: number of facets between "poles" + 1
	:param bool returnElementMap: returns also tuple of nodes ((x1,y1,z1),(x2,y2,z2),...) and elements ((id01,id02,id03),(id11,id12,id13),...) if true, only facets otherwise
	:param \*\*kw: (unused keyword arguments) passed to utils.facet;
	"""
	# check zero dimentions
	if (radius<=0):          raise RuntimeError("The radius should have the positive value");
	if (thetaResolution<3): raise RuntimeError("thetaResolution must be > 3");
	if (phiResolution<3):   raise RuntimeError("phiResolution must be > 3");
	
	r,c0,c1,c2 = radius,center[0],center[1],center[2]
	nodes = [Vector3(c0,c1,c2+radius)]
	phis   = numpy.linspace(math.pi/(phiResolution-1),math.pi,phiResolution-2,endpoint=False)
	thetas = numpy.linspace(0,2*math.pi,thetaResolution,endpoint=False)
	nodes.extend((Vector3(c0+r*math.cos(theta)*math.sin(phi),c1+r*math.sin(theta)*math.sin(phi),c2+r*math.cos(phi)) for phi in phis for theta in thetas))
	nodes.append(Vector3(c0,c1,c2-radius))
	n = len(nodes)-1
	
	elements = [(0,i+1,i+2) for i in xrange(thetaResolution-1)]
	elements.append((0,1,thetaResolution))
	for j in xrange(0,phiResolution-3):
		k = j*thetaResolution + 1
		elements.extend((k+i,k+i+1,k+i+thetaResolution) for i in xrange(thetaResolution-1))
		elements.append((k,k+thetaResolution-1,k+2*thetaResolution-1))
		elements.extend((k+i+thetaResolution,k+i+1+thetaResolution,k+i+1) for i in xrange(thetaResolution-1))
		elements.append((k+2*thetaResolution-1,k+thetaResolution,k))
	elements.extend((n,n-i-1,n-i-2) for i in xrange(thetaResolution-1))
	elements.append((n,n-1,n-thetaResolution))
	
	facets = [utils.facet(tuple(nodes[node] for node in elem),**kw) for elem in elements]
	if returnElementMap:
		return facets,nodes,elements
	return facets
Esempio n. 5
0
File: geom.py Progetto: DEMANY/trunk
	def doWall(a,b,c,d):
		return [utils.facet((a,b,c),**kw),utils.facet((a,c,d),**kw)]
Esempio n. 6
0
File: geom.py Progetto: DEMANY/trunk
def facetCylinderConeGenerator(center,radiusTop,height,orientation=Quaternion((0,1,0),0.0),
	segmentsNumber=10,wallMask=7,angleRange=None,closeGap=False,
	radiusBottom=-1,
	radiusTopInner=-1,
	radiusBottomInner=-1,
	**kw):
	"""
	Please, do not use this function directly! Use geom.facetCylinder and geom.facetCone instead.
	This is the base function for generating cylinders and cones from facets.
	:param float radiusTop:  top radius
	:param float radiusBottom:  bottom radius
	:param \*\*kw: (unused keyword arguments) passed to utils.facet;
	"""
	
	#For cylinders top and bottom radii are equal
	if (radiusBottom == -1):
		radiusBottom = radiusTop
	
	if ((radiusTopInner > 0 and radiusTopInner > radiusTop) or (radiusBottomInner > 0 and radiusBottomInner > radiusBottom)): 
		raise RuntimeError("The internal radius cannot be larger than outer");
	# check zero dimentions
	if (segmentsNumber<3): raise RuntimeError("The segmentsNumber should be at least 3");
	if (height<0): raise RuntimeError("The height should have the positive value");
	if angleRange==None: angleRange=(0,2*math.pi)
	if (abs(angleRange[1]-angleRange[0])>2.0*math.pi): raise RuntimeError("The |angleRange| cannot be larger 2.0*math.pi");
	if (angleRange[1]<angleRange[0]): raise RuntimeError("angleRange[1] should be larger or equal angleRange[1]");
	
	if isinstance(angleRange,float):
		print u'WARNING: geom.facetCylinder,angleRange should be (Θmin,Θmax), not just Θmax (one number), update your code.'
		angleRange=(0,angleRange)
		
	anglesInRad = numpy.linspace(angleRange[0], angleRange[1], segmentsNumber+1, endpoint=True)
	
	PTop=[]; PTop.append(Vector3(0,0,+height/2))
	PTopIn=[]; PTopIn.append(Vector3(0,0,+height/2))
	
	PBottom=[]; PBottom.append(Vector3(0,0,-height/2))
	PBottomIn=[]; PBottomIn.append(Vector3(0,0,-height/2))
	
	for i in anglesInRad:
		XTop=radiusTop*math.cos(i); YTop=radiusTop*math.sin(i); 
		PTop.append(Vector3(XTop,YTop,+height/2))
		if (radiusTopInner > 0):
			XTopIn=radiusTopInner*math.cos(i); YTopIn=radiusTopInner*math.sin(i); 
			PTopIn.append(Vector3(XTopIn,YTopIn,+height/2))
		
		XBottom=radiusBottom*math.cos(i); YBottom=radiusBottom*math.sin(i); 
		PBottom.append(Vector3(XBottom,YBottom,-height/2))
		if (radiusBottomInner > 0):
			XBottomIn=radiusBottomInner*math.cos(i); YBottomIn=radiusBottomInner*math.sin(i);
			PBottomIn.append(Vector3(XBottomIn,YBottomIn,-height/2))
		
	for i in range(0,len(PTop)):
		PTop[i]=orientation*PTop[i]+center
		PBottom[i]=orientation*PBottom[i]+center
		if (len(PTopIn)>1):
			PTopIn[i]=orientation*PTopIn[i]+center
		if (len(PBottomIn)>1):
			PBottomIn[i]=orientation*PBottomIn[i]+center

	ret=[]
	for i in range(2,len(PTop)):
		if (wallMask&1)and(radiusTop!=0):
			if (len(PTopIn)>1):
				ret.append(utils.facet((PTop[i-1],PTopIn[i],PTopIn[i-1]),**kw))
				ret.append(utils.facet((PTop[i-1],PTop[i],PTopIn[i]),**kw))
			else:
				ret.append(utils.facet((PTop[0],PTop[i],PTop[i-1]),**kw))
			
		if (wallMask&2)and(radiusBottom!=0):
			if (len(PBottomIn)>1):
				ret.append(utils.facet((PBottom[i-1],PBottomIn[i],PBottomIn[i-1]),**kw))
				ret.append(utils.facet((PBottom[i-1],PBottom[i],PBottomIn[i]),**kw))
			else:
				ret.append(utils.facet((PBottom[0],PBottom[i-1],PBottom[i]),**kw))
			
		if wallMask&4:
			if (radiusBottom!=0):
				ret.append(utils.facet((PTop[i],PBottom[i],PBottom[i-1]),**kw))
			if (radiusTop!=0):
				ret.append(utils.facet((PBottom[i-1],PTop[i-1],PTop[i]),**kw))
				
	if (closeGap):
		if (wallMask&1)and(radiusTop!=0)and(abs(((angleRange[1]-angleRange[0])) > math.pi)):
			pts=[(radiusTop*math.cos(angleRange[i]),radiusTop*math.sin(angleRange[i])) for i in (0,1)]
			pp=[(pts[0][0],pts[0][1],+height/2.0), (pts[1][0],pts[1][1],+height/2.0), (0,0,+height/2.0)]
			pp=[orientation*p+center for p in pp]
			ret.append(utils.facet(pp,**kw))
			
		if (wallMask&2)and(radiusBottom!=0)and(abs(((angleRange[1]-angleRange[0])) > math.pi)):
			pts=[(radiusBottom*math.cos(angleRange[i]),radiusBottom*math.sin(angleRange[i])) for i in (0,1)]
			pp=[(0,0,-height/2.0), (pts[1][0],pts[1][1],-height/2.0), (pts[0][0],pts[0][1],-height/2.0)]
			pp=[orientation*p+center for p in pp]
			ret.append(utils.facet(pp,**kw))
		
		if (wallMask&4):
			ptsBottom=[(radiusBottom*math.cos(angleRange[i]),radiusBottom*math.sin(angleRange[i])) for i in (0,1)]
			ptsTop=[(radiusTop*math.cos(angleRange[i]),radiusTop*math.sin(angleRange[i])) for i in (0,1)]
			
			if (abs(((angleRange[1]-angleRange[0])) >= math.pi)):
				if (radiusBottom!=0)and(radiusTop!=0):	#Cylinder
					pp=[(ptsBottom[0][0],ptsBottom[0][1],-height/2.0),(ptsBottom[1][0],ptsBottom[1][1],-height/2.0),(ptsTop[0][0],ptsTop[0][1],height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
					
					pp=[(ptsBottom[1][0],ptsBottom[1][1],-height/2.0), (ptsTop[1][0],ptsTop[1][1],height/2.0), (ptsTop[0][0],ptsTop[0][1],height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
				elif (radiusBottom==0)and(radiusTop!=0):	#ConeTop
					pp=[(ptsTop[1][0],ptsTop[1][1],height/2.0), (ptsTop[0][0],ptsTop[0][1],height/2.0), (0,0,-height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
				elif (radiusTop==0)and(radiusBottom!=0):	#ConeBottom
					pp=[(0,0,height/2.0),(ptsBottom[0][0],ptsBottom[0][1],-height/2.0),(ptsBottom[1][0],ptsBottom[1][1],-height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
			else:
				if (radiusBottom!=0)and(radiusTop!=0):	#Cylinder
					pp=[(ptsBottom[0][0],ptsBottom[0][1],-height/2.0),(0,0,-height/2.0),(ptsTop[0][0],ptsTop[0][1],height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
					
					pp=[(0,0,-height/2.0), (0,0,height/2.0), (ptsTop[0][0],ptsTop[0][1],height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
					
					pp=[(0,0,-height/2.0),(ptsBottom[1][0],ptsBottom[1][1],-height/2.0),(0,0,height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
					
					pp=[(ptsBottom[1][0],ptsBottom[1][1],-height/2.0), (ptsTop[1][0],ptsTop[1][1],height/2.0), (0,0,height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
				elif (radiusBottom==0)and(radiusTop!=0):	#ConeTop
					pp=[(0,0,height/2.0), (ptsTop[0][0],ptsTop[0][1],height/2.0), (0,0,-height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
					
					pp=[(ptsTop[1][0],ptsTop[1][1],height/2.0), (0,0,height/2.0), (0,0,-height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
				elif (radiusTop==0)and(radiusBottom!=0):	#ConeBottom
					pp=[(0,0,height/2.0),(ptsBottom[0][0],ptsBottom[0][1],-height/2.0),(0,0,-height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
					
					pp=[(0,0,height/2.0),(0,0,-height/2.0),(ptsBottom[1][0],ptsBottom[1][1],-height/2.0)]
					pp=[orientation*p+center for p in pp]
					ret.append(utils.facet(pp,**kw))
	return ret
Esempio n. 7
0
 def doWall(a, b, c, d):
     return [utils.facet((a, b, c), **kw), utils.facet((a, c, d), **kw)]
Esempio n. 8
0
def facetCylinderConeGenerator(center,
                               radiusTop,
                               height,
                               orientation=Quaternion((0, 1, 0), 0.0),
                               segmentsNumber=10,
                               wallMask=7,
                               angleRange=None,
                               closeGap=False,
                               radiusBottom=-1,
                               radiusTopInner=-1,
                               radiusBottomInner=-1,
                               **kw):
    """
	Please, do not use this function directly! Use geom.facetCylinder and geom.facetCone instead.
	This is the base function for generating cylinders and cones from facets.
	:param float radiusTop:  top radius
	:param float radiusBottom:  bottom radius
	:param \*\*kw: (unused keyword arguments) passed to utils.facet;
	"""

    #For cylinders top and bottom radii are equal
    if (radiusBottom == -1):
        radiusBottom = radiusTop

    if ((radiusTopInner > 0 and radiusTopInner > radiusTop)
            or (radiusBottomInner > 0 and radiusBottomInner > radiusBottom)):
        raise RuntimeError("The internal radius cannot be larger than outer")
    # check zero dimentions
    if (segmentsNumber < 3):
        raise RuntimeError("The segmentsNumber should be at least 3")
    if (height < 0):
        raise RuntimeError("The height should have the positive value")
    if angleRange == None: angleRange = (0, 2 * math.pi)
    if (abs(angleRange[1] - angleRange[0]) > 2.0 * math.pi):
        raise RuntimeError("The |angleRange| cannot be larger 2.0*math.pi")
    if (angleRange[1] < angleRange[0]):
        raise RuntimeError(
            "angleRange[1] should be larger or equal angleRange[1]")

    if isinstance(angleRange, float):
        print u'WARNING: geom.facetCylinder,angleRange should be (Θmin,Θmax), not just Θmax (one number), update your code.'
        angleRange = (0, angleRange)

    anglesInRad = numpy.linspace(angleRange[0],
                                 angleRange[1],
                                 segmentsNumber + 1,
                                 endpoint=True)

    PTop = []
    PTop.append(Vector3(0, 0, +height / 2))
    PTopIn = []
    PTopIn.append(Vector3(0, 0, +height / 2))

    PBottom = []
    PBottom.append(Vector3(0, 0, -height / 2))
    PBottomIn = []
    PBottomIn.append(Vector3(0, 0, -height / 2))

    for i in anglesInRad:
        XTop = radiusTop * math.cos(i)
        YTop = radiusTop * math.sin(i)
        PTop.append(Vector3(XTop, YTop, +height / 2))
        if (radiusTopInner > 0):
            XTopIn = radiusTopInner * math.cos(i)
            YTopIn = radiusTopInner * math.sin(i)
            PTopIn.append(Vector3(XTopIn, YTopIn, +height / 2))

        XBottom = radiusBottom * math.cos(i)
        YBottom = radiusBottom * math.sin(i)
        PBottom.append(Vector3(XBottom, YBottom, -height / 2))
        if (radiusBottomInner > 0):
            XBottomIn = radiusBottomInner * math.cos(i)
            YBottomIn = radiusBottomInner * math.sin(i)
            PBottomIn.append(Vector3(XBottomIn, YBottomIn, -height / 2))

    for i in range(0, len(PTop)):
        PTop[i] = orientation * PTop[i] + center
        PBottom[i] = orientation * PBottom[i] + center
        if (len(PTopIn) > 1):
            PTopIn[i] = orientation * PTopIn[i] + center
        if (len(PBottomIn) > 1):
            PBottomIn[i] = orientation * PBottomIn[i] + center

    ret = []
    for i in range(2, len(PTop)):
        if (wallMask & 1) and (radiusTop != 0):
            if (len(PTopIn) > 1):
                ret.append(
                    utils.facet((PTop[i - 1], PTopIn[i], PTopIn[i - 1]), **kw))
                ret.append(utils.facet((PTop[i - 1], PTop[i], PTopIn[i]),
                                       **kw))
            else:
                ret.append(utils.facet((PTop[0], PTop[i], PTop[i - 1]), **kw))

        if (wallMask & 2) and (radiusBottom != 0):
            if (len(PBottomIn) > 1):
                ret.append(
                    utils.facet(
                        (PBottom[i - 1], PBottomIn[i], PBottomIn[i - 1]),
                        **kw))
                ret.append(
                    utils.facet((PBottom[i - 1], PBottom[i], PBottomIn[i]),
                                **kw))
            else:
                ret.append(
                    utils.facet((PBottom[0], PBottom[i - 1], PBottom[i]),
                                **kw))

        if wallMask & 4:
            if (radiusBottom != 0):
                ret.append(
                    utils.facet((PTop[i], PBottom[i], PBottom[i - 1]), **kw))
            if (radiusTop != 0):
                ret.append(
                    utils.facet((PBottom[i - 1], PTop[i - 1], PTop[i]), **kw))

    if (closeGap):
        if (wallMask & 1) and (radiusTop != 0) and (abs(
            ((angleRange[1] - angleRange[0])) > math.pi)):
            pts = [(radiusTop * math.cos(angleRange[i]),
                    radiusTop * math.sin(angleRange[i])) for i in (0, 1)]
            pp = [(pts[0][0], pts[0][1], +height / 2.0),
                  (pts[1][0], pts[1][1], +height / 2.0), (0, 0, +height / 2.0)]
            pp = [orientation * p + center for p in pp]
            ret.append(utils.facet(pp, **kw))

        if (wallMask & 2) and (radiusBottom != 0) and (abs(
            ((angleRange[1] - angleRange[0])) > math.pi)):
            pts = [(radiusBottom * math.cos(angleRange[i]),
                    radiusBottom * math.sin(angleRange[i])) for i in (0, 1)]
            pp = [(0, 0, -height / 2.0), (pts[1][0], pts[1][1], -height / 2.0),
                  (pts[0][0], pts[0][1], -height / 2.0)]
            pp = [orientation * p + center for p in pp]
            ret.append(utils.facet(pp, **kw))

        if (wallMask & 4):
            ptsBottom = [(radiusBottom * math.cos(angleRange[i]),
                          radiusBottom * math.sin(angleRange[i]))
                         for i in (0, 1)]
            ptsTop = [(radiusTop * math.cos(angleRange[i]),
                       radiusTop * math.sin(angleRange[i])) for i in (0, 1)]

            if (abs(((angleRange[1] - angleRange[0])) >= math.pi)):
                if (radiusBottom != 0) and (radiusTop != 0):  #Cylinder
                    pp = [(ptsBottom[0][0], ptsBottom[0][1], -height / 2.0),
                          (ptsBottom[1][0], ptsBottom[1][1], -height / 2.0),
                          (ptsTop[0][0], ptsTop[0][1], height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))

                    pp = [(ptsBottom[1][0], ptsBottom[1][1], -height / 2.0),
                          (ptsTop[1][0], ptsTop[1][1], height / 2.0),
                          (ptsTop[0][0], ptsTop[0][1], height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))
                elif (radiusBottom == 0) and (radiusTop != 0):  #ConeTop
                    pp = [(ptsTop[1][0], ptsTop[1][1], height / 2.0),
                          (ptsTop[0][0], ptsTop[0][1], height / 2.0),
                          (0, 0, -height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))
                elif (radiusTop == 0) and (radiusBottom != 0):  #ConeBottom
                    pp = [(0, 0, height / 2.0),
                          (ptsBottom[0][0], ptsBottom[0][1], -height / 2.0),
                          (ptsBottom[1][0], ptsBottom[1][1], -height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))
            else:
                if (radiusBottom != 0) and (radiusTop != 0):  #Cylinder
                    pp = [(ptsBottom[0][0], ptsBottom[0][1], -height / 2.0),
                          (0, 0, -height / 2.0),
                          (ptsTop[0][0], ptsTop[0][1], height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))

                    pp = [(0, 0, -height / 2.0), (0, 0, height / 2.0),
                          (ptsTop[0][0], ptsTop[0][1], height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))

                    pp = [(0, 0, -height / 2.0),
                          (ptsBottom[1][0], ptsBottom[1][1], -height / 2.0),
                          (0, 0, height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))

                    pp = [(ptsBottom[1][0], ptsBottom[1][1], -height / 2.0),
                          (ptsTop[1][0], ptsTop[1][1], height / 2.0),
                          (0, 0, height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))
                elif (radiusBottom == 0) and (radiusTop != 0):  #ConeTop
                    pp = [(0, 0, height / 2.0),
                          (ptsTop[0][0], ptsTop[0][1], height / 2.0),
                          (0, 0, -height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))

                    pp = [(ptsTop[1][0], ptsTop[1][1], height / 2.0),
                          (0, 0, height / 2.0), (0, 0, -height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))
                elif (radiusTop == 0) and (radiusBottom != 0):  #ConeBottom
                    pp = [(0, 0, height / 2.0),
                          (ptsBottom[0][0], ptsBottom[0][1], -height / 2.0),
                          (0, 0, -height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))

                    pp = [(0, 0, height / 2.0), (0, 0, -height / 2.0),
                          (ptsBottom[1][0], ptsBottom[1][1], -height / 2.0)]
                    pp = [orientation * p + center for p in pp]
                    ret.append(utils.facet(pp, **kw))
    return ret