本文整理汇总了Python中mesh.Mesh.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.__init__方法的具体用法?Python Mesh.__init__怎么用?Python Mesh.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesh.Mesh
的用法示例。
在下文中一共展示了Mesh.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import __init__ [as 别名]
def __init__(self, parent, color=0xFF0000, x=0, y=0):
Mesh.__init__(self)
self.parent = parent
self.position.x = x
self.position.y = y
#self.matrix.translate(x, y, 0.0)
self.color = color
r, g, b = self.toRgb(self.color)
v = [
0.0, 0.0, r, g, b,
0.0 + BLOCK_SIZE, 0.0, r, g, b,
0.0 + BLOCK_SIZE, 0.0 + BLOCK_SIZE, r, g, b,
0.0, 0.0 + BLOCK_SIZE, r, g, b,
]
i = [
0, 1, 2,
2, 3, 0
]
self.set_data(vertices=v, indices=i)
示例2: __init__
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import __init__ [as 别名]
def __init__(self, obj_file_name):
self.default_shape_name = obj_file_name or 'initial_shape'
self.default_surface_name = 'initial_surface'
self.default_material_name = 'default'
# Name of the shape/surface/material from the most recently parsed 'o'/'g'/'usemtl' line respectively
self.curr_shape_name = self.default_shape_name
self.curr_surf_name = self.default_surface_name
self.curr_mtl_name = self.default_material_name
# To keep of track of number of polygons parsed so far
self.next_polygon_index = 0
# A tuple of indices per vertex element
self.indices = [ ]
# Shortcut to be able to access the current surface in fewer characters and lookups
self.curr_surf = Surface(0, self.default_material_name)
# Dictionary of names -> shapes. Initialise to a default shape with a default surface
self.shapes = { self.default_shape_name : Shape({ self.default_surface_name : self.curr_surf }) }
Mesh.__init__(self)
示例3: set_block
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import __init__ [as 别名]
def set_block( self , s , d ) :
aoy = m.atan2( s[2] , s[0] )
aoz = m.atan2( s[1] , m.sqrt(s[0]**2+s[2]**2) )
rot = tr.rotation_matrix( aoy , (0,1,0) )
rot = np.dot( tr.rotation_matrix( -aoz , (0,0,1) ) , rot )
rot = np.dot( tr.rotation_matrix( m.pi/2.0 , (0,0,1) ) , rot )
v , n , t = self.gen_v( 1 , 1 , s )
for x in range(v.shape[0]) :
for y in range(v.shape[1]) :
for z in range(v.shape[2]) :
v[x,y,z] = np.dot(rot,v[x,y,z])
n[x,y,z] = np.resize(np.dot(rot,np.resize(n[x,y,z],4)),3)
Mesh.__init__( self , buffers = (v,n,t) )
self.x = np.array( ((0,0,0,1),(s[0],0,0,1),(0,0,s[2],1),(s[0],0,s[2],1),(0,s[1],0,1),(s[0],s[1],0,1),(0,s[1],s[2],1),(s[0],s[1],s[2],1)) , np.float64 )
for i in range(len(self.x)) : self.x[i] = np.dot(rot,self.x[i])
self.r = np.resize( np.dot( rot , np.array((s[0],s[1],s[2],0) , np.float64 )/2.0 ) , 3 )
self.m = np.array( [ d*s[0]*s[1]*s[2] / 8.0 ] * len(self.x) , np.float64 )
self.M = self.calc_m( self.x , self.m )
self.Mi = np.linalg.inv( self.M )
示例4: __init__
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import __init__ [as 别名]
def __init__( self , n ) :
Mesh.__init__( self , buffers = self.gen_v( n , n ) )
示例5: __init__
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import __init__ [as 别名]
def __init__(self):
Mesh.__init__(self)