本文整理汇总了Python中collection.Collection.append方法的典型用法代码示例。如果您正苦于以下问题:Python Collection.append方法的具体用法?Python Collection.append怎么用?Python Collection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collection.Collection
的用法示例。
在下文中一共展示了Collection.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: append
# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import append [as 别名]
def append( self, points, fg_color=(0, 0, 0, 1),
linewidth=1.0, antialias=1.0, caps = ('round','round')):
P = np.array(points).astype(np.float32)
n = len(P)
V = np.zeros(2*(n+2),self.vtype)
U = np.zeros(1, self.utype)
I = (np.ones((2*n-2,3),dtype=np.uint32)*[0,1,2]).ravel()
I += np.repeat(np.arange(2*n-2),3)
I = I.ravel()
D = ((P[:-1]-P[1:])**2).sum(axis=1)
D = np.sqrt(D).cumsum().astype(np.float32)
U['fg_color'] = fg_color
U['linewidth'] = linewidth
U['antialias'] = antialias
U['length'] = D[-1]
U['caps'] = (self.caps.get(caps[0], 'round'),
self.caps.get(caps[1], 'round'))
V['a_curr'][2:2+2*n:2] = P
V['a_curr'][3:3+2*n:2] = P
V['a_curr'][:2] = P[0] - (P[ 1] - P[ 0])
V['a_curr'][-2:] = P[-1] + (P[-1] - P[-2])
V['a_texcoord'][4:4+2*(n-1):2,0] = D
V['a_texcoord'][5:5+2*(n-1):2,0] = D
V['a_texcoord'][0::2,1] = -1
V['a_texcoord'][1::2,1] = +1
Collection.append(self, V, I, U )
示例2: append
# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import append [as 别名]
def append( self, centers=(0, 0, 0), radius=3.0,
fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 1),
linewidth=1.5, antialias=1.5,
translate=(0, 0, 0), scale=1.0, rotate=0.0 ):
centers = np.atleast_2d(np.array(centers))
n = len(centers)
V = np.zeros(4*n, self.vtype)
U = np.zeros(n, self.utype)
V['a_center'][0::4] = centers
V['a_center'][1::4] = V['a_center'][::4]
V['a_center'][2::4] = V['a_center'][::4]
V['a_center'][3::4] = V['a_center'][::4]
V['a_texcoord'][0::4] = -1, -1
V['a_texcoord'][1::4] = -1, +1
V['a_texcoord'][2::4] = +1, -1
V['a_texcoord'][3::4] = +1, +1
U['fg_color'][:] = fg_color
U['bg_color'][:] = bg_color
U['radius'][:] = radius
U['scale'][:] = scale
U['linewidth'][:] = linewidth
U['antialias'][:] = antialias
I = np.resize(np.array([0,1,2,1,2,3], dtype=np.uint32), n*(2*3))
Collection.append(self, V, I, U, (4,6) )
示例3: append
# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import append [as 别名]
def append( self, center=(0, 0), radius=100.0, color=(0, 0, 0, 1),
linewidth=1.0, antialias=1.0, translate=(0, 0), scale=1.0, rotate=0.0 ):
V, I, _ = self.bake(center)
U = np.zeros(1, self.utype)
U['linewidth'] = linewidth
U['antialias'] = antialias
U['color'] = color
U['translate'] = translate
U['scale'] = scale
U['rotate'] = rotate
U['radius'] = radius
Collection.append(self, V, I, U)
示例4: append
# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import append [as 别名]
def append( self, center=(0, 0), radius=100.0,
fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 0),
linewidth=1.0, antialias=1.0,
translate=(0, 0), scale=1.0, rotate=0.0,
dash_pattern='dotted', dash_phase=0.0, dash_caps=('round', 'round') ):
V, I, _ = self.bake(center)
U = np.zeros(1, self.utype)
U['linewidth'] = linewidth
U['antialias'] = antialias
U['fg_color'] = fg_color
U['bg_color'] = bg_color
U['translate'] = translate
U['scale'] = scale
U['rotate'] = rotate
U['radius'] = radius
if self.dash_atlas:
dash_index, dash_period = self.dash_atlas[dash_pattern]
U['dash_phase'] = 0
U['dash_index'] = dash_index
U['dash_period'] = dash_period
U['dash_caps'] = ( self.caps.get(dash_caps[0], 'round'),
self.caps.get(dash_caps[1], 'round') )
Collection.append(self, V, I, U)
示例5: append
# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import append [as 别名]
def append( self, size = (1,1), antialias = 1.0,
translate = (0,0), scale = 1.0, rotate = 0.0,
offset = (0,0), zoom = 1,
major_grid = [64.,64.], minor_grid = [8.,8.],
major_grid_color = np.array([0.0, 0.0, 0.0, 0.75]),
minor_grid_color = np.array([0.0, 0.0, 0.0, 0.25]),
major_tick_color = np.array([0.0, 0.0, 0.0, 1.0]),
minor_tick_color = np.array([0.0, 0.0, 0.0, 1.0]),
major_grid_width = 1.0,
minor_grid_width = 1.0,
major_tick_size = np.array([10.0,10.0]),
minor_tick_size = np.array([ 5.0, 5.0]),
major_tick_width = 1.5,
minor_tick_width = 1.00,
major_dash_pattern='dotted',
major_dash_phase = 0.0,
major_dash_caps = ('round','round'),
minor_dash_pattern='dotted',
minor_dash_phase = 0.0,
minor_dash_caps = ('round','round') ):
V, I, _ = self.bake()
U = np.zeros(1, self.utype)
U['translate'] = translate
U['scale'] = scale
U['rotate'] = rotate
U['major_grid'] = major_grid
U['minor_grid'] = minor_grid
U['major_tick_size'] = major_tick_size
U['minor_tick_size'] = minor_tick_size
U['major_grid_color'] = major_grid_color
U['minor_grid_color'] = minor_grid_color
U['major_tick_color'] = major_tick_color
U['minor_tick_color'] = minor_tick_color
U['major_grid_width'] = major_grid_width
U['minor_grid_width'] = minor_grid_width
U['major_tick_width'] = major_tick_width
U['minor_tick_width'] = minor_tick_width
U['size'] = size
U['offset'] = offset
U['zoom'] = zoom
U['antialias'] = antialias
if self.dash_atlas:
dash_index, dash_period = self.dash_atlas[major_dash_pattern]
U['major_dash_phase'] = major_dash_phase
U['major_dash_index'] = dash_index
U['major_dash_period'] = dash_period
U['major_dash_caps'] = ( self.caps.get(major_dash_caps[0], 'round'),
self.caps.get(major_dash_caps[1], 'round') )
dash_index, dash_period = self.dash_atlas[minor_dash_pattern]
U['minor_dash_phase'] = minor_dash_phase
U['minor_dash_index'] = dash_index
U['minor_dash_period'] = dash_period
U['minor_dash_caps'] = ( self.caps.get(minor_dash_caps[0], 'round'),
self.caps.get(minor_dash_caps[1], 'round') )
Collection.append(self,V,I,U)
G = np.empty((1024,4), dtype='f4')
G = G.ravel().view(self.gtype)
self._gbuffer.append(G)
index = len(self._gbuffer)
self._gbuffer_shape = [index,4*1024]
self.update_gbuffer(index-1)