Ejemplo n.º 1
0
	def createShape( self, matrixChain ):
		"Create the shape."
		numberOfSides = 31
		halfHeight = 0.5 * self.height
		sideAngle = 2.0 * math.pi / float( numberOfSides )
		polygonBottom = []
		polygonTop = []
		imaginaryRadius = self.radiusZ
		if self.isYImaginaryAxis:
			imaginaryRadius = self.radiusY
		for side in xrange( numberOfSides ):
			angle = float( side ) * sideAngle
			unitComplex = euclidean.getUnitPolar( angle )
			pointBottom = complex( unitComplex.real * self.radiusX, unitComplex.imag * imaginaryRadius )
			polygonBottom.append( pointBottom )
			if self.topOverBottom > 0.0:
				polygonTop.append( pointBottom * self.topOverBottom )
		if self.topOverBottom <= 0.0:
			polygonTop.append( complex() )
		bottomTopPolygon = [ triangle_mesh.getAddIndexedLoop( polygonBottom, self.vertices, - halfHeight ), triangle_mesh.getAddIndexedLoop( polygonTop, self.vertices, halfHeight ) ]
		triangle_mesh.addPillarFromConvexLoops( self.faces, bottomTopPolygon )
		if not self.isYImaginaryAxis:
			for vertex in self.vertices:
				oldY = vertex.y
				vertex.y = vertex.z
				vertex.z = oldY
		self.transformSetBottomTopEdges( matrixChain )
Ejemplo n.º 2
0
 def createShape(self, matrixChain):
     "Create the shape."
     numberOfSides = 31
     halfHeight = 0.5 * self.height
     sideAngle = 2.0 * math.pi / float(numberOfSides)
     polygonBottom = []
     polygonTop = []
     imaginaryRadius = self.radiusZ
     if self.isYImaginaryAxis:
         imaginaryRadius = self.radiusY
     for side in xrange(numberOfSides):
         angle = float(side) * sideAngle
         unitComplex = euclidean.getUnitPolar(angle)
         pointBottom = complex(unitComplex.real * self.radiusX,
                               unitComplex.imag * imaginaryRadius)
         polygonBottom.append(pointBottom)
         if self.topOverBottom > 0.0:
             polygonTop.append(pointBottom * self.topOverBottom)
     if self.topOverBottom <= 0.0:
         polygonTop.append(complex())
     bottomTopPolygon = [
         triangle_mesh.getAddIndexedLoop(polygonBottom, self.vertices,
                                         -halfHeight),
         triangle_mesh.getAddIndexedLoop(polygonTop, self.vertices,
                                         halfHeight)
     ]
     triangle_mesh.addPillarFromConvexLoops(self.faces, bottomTopPolygon)
     if not self.isYImaginaryAxis:
         for vertex in self.vertices:
             oldY = vertex.y
             vertex.y = vertex.z
             vertex.z = oldY
     self.transformSetBottomTopEdges(matrixChain)
Ejemplo n.º 3
0
 def createShape(self, matrixChain):
     "Create the shape."
     square = [
         complex(-self.halfX, -self.halfY),
         complex(self.halfX, -self.halfY),
         complex(self.halfX, self.halfY),
         complex(-self.halfX, self.halfY)
     ]
     bottomTopSquare = triangle_mesh.getAddIndexedLoops(
         square, self.vertices, [-self.halfZ, self.halfZ])
     triangle_mesh.addPillarFromConvexLoops(self.faces, bottomTopSquare)
     self.transformSetBottomTopEdges(matrixChain)
Ejemplo n.º 4
0
	def createShape( self, matrixChain ):
		"Create the shape."
		square = [ complex( - self.halfX, - self.halfY ), complex( self.halfX, - self.halfY ), complex( self.halfX, self.halfY ), complex( - self.halfX, self.halfY ) ]
		bottomTopSquare = triangle_mesh.getAddIndexedLoops( square, self.vertices, [ - self.halfZ, self.halfZ ] )
		triangle_mesh.addPillarFromConvexLoops( self.faces, bottomTopSquare )
		self.transformSetBottomTopEdges( matrixChain )