示例#1
0
文件: cube.py 项目: Sciumo/SFACT
def addCube(faces, inradius, vertexes, xmlElement):
	"""Add cube by inradius."""
	square = [
		complex(-inradius.x, -inradius.y),
		complex(inradius.x, -inradius.y),
		complex(inradius.x, inradius.y),
		complex(-inradius.x, inradius.y)]
	bottomTopSquare = triangle_mesh.getAddIndexedLoops(square, vertexes, [-inradius.z, inradius.z])
	triangle_mesh.addPillarByLoops(faces, bottomTopSquare)
示例#2
0
def addCube(elementNode, faces, inradius, vertexes):
	'Add cube by inradius.'
	square = [
		complex(-inradius.x, -inradius.y),
		complex(inradius.x, -inradius.y),
		complex(inradius.x, inradius.y),
		complex(-inradius.x, inradius.y)]
	bottomTopSquare = triangle_mesh.getAddIndexedLoops(square, vertexes, [-inradius.z, inradius.z])
	triangle_mesh.addPillarByLoops(faces, bottomTopSquare)
示例#3
0
	def createShape(self):
		"Create the shape."
		square = [
			complex( - self.inradius.x, - self.inradius.y ),
			complex( self.inradius.x, - self.inradius.y ),
			complex( self.inradius.x, self.inradius.y ),
			complex( - self.inradius.x, self.inradius.y ) ]
		bottomTopSquare = triangle_mesh.getAddIndexedLoops( square, self.vertexes, [ - self.inradius.z, self.inradius.z ] )
		triangle_mesh.addPillarByLoops( self.faces, bottomTopSquare )
示例#4
0
 def createShape(self):
     "Create the shape."
     square = [
         complex(-self.inradius.x, -self.inradius.y),
         complex(self.inradius.x, -self.inradius.y),
         complex(self.inradius.x, self.inradius.y),
         complex(-self.inradius.x, self.inradius.y)
     ]
     bottomTopSquare = triangle_mesh.getAddIndexedLoops(
         square, self.vertexes, [-self.inradius.z, self.inradius.z])
     triangle_mesh.addPillarByLoops(self.faces, bottomTopSquare)
示例#5
0
文件: cylinder.py 项目: 3DNogi/SFACT
def addCylinder(faces, inradius, sides, topOverBottom, vertexes):
	'Add cylinder by inradius.'
	polygonBottom = euclidean.getComplexPolygonByComplexRadius(complex(inradius.x, inradius.y), sides)
	polygonTop = polygonBottom
	if topOverBottom <= 0.0:
		polygonTop = [complex()]
	elif topOverBottom != 1.0:
		polygonTop = euclidean.getComplexPathByMultiplier(topOverBottom, polygonTop)
	bottomTopPolygon = [
		triangle_mesh.getAddIndexedLoop(polygonBottom, vertexes, -inradius.z),
		triangle_mesh.getAddIndexedLoop(polygonTop, vertexes, inradius.z)]
	triangle_mesh.addPillarByLoops(faces, bottomTopPolygon)
示例#6
0
文件: cylinder.py 项目: folksjos/RepG
def addCylinder(faces, inradius, sides, topOverBottom, vertexes):
	'Add cylinder by inradius.'
	polygonBottom = euclidean.getComplexPolygonByComplexRadius(complex(inradius.x, inradius.y), sides)
	polygonTop = polygonBottom
	if topOverBottom <= 0.0:
		polygonTop = [complex()]
	elif topOverBottom != 1.0:
		polygonTop = euclidean.getComplexPathByMultiplier(topOverBottom, polygonTop)
	bottomTopPolygon = [
		triangle_mesh.getAddIndexedLoop(polygonBottom, vertexes, -inradius.z),
		triangle_mesh.getAddIndexedLoop(polygonTop, vertexes, inradius.z)]
	triangle_mesh.addPillarByLoops(faces, bottomTopPolygon)
示例#7
0
def addSphere(faces, radius, vertexes, xmlElement):
	'Add sphere by radius.'
	bottom = -radius.z
	sides = evaluate.getSidesMinimumThreeBasedOnPrecision(max(radius.x, radius.y, radius.z), xmlElement )
	sphereSlices = max(sides / 2, 2)
	equator = euclidean.getComplexPolygonByComplexRadius(complex(radius.x, radius.y), sides)
	polygons = [triangle_mesh.getAddIndexedLoop([complex()], vertexes, bottom)]
	zIncrement = (radius.z + radius.z) / float(sphereSlices)
	z = bottom
	for sphereSlice in xrange(1, sphereSlices):
		z += zIncrement
		zPortion = abs(z) / radius.z
		multipliedPath = euclidean.getComplexPathByMultiplier(math.sqrt(1.0 - zPortion * zPortion), equator)
		polygons.append(triangle_mesh.getAddIndexedLoop(multipliedPath, vertexes, z))
	polygons.append(triangle_mesh.getAddIndexedLoop([complex()], vertexes, radius.z))
	triangle_mesh.addPillarByLoops(faces, polygons)