# node positions pos = np.array( [ [0,0,0], [10,10,10] ], dtype = np.float32) siz = np.array( [ [1.0, 1.0 ]], dtype = np.float32 ) col = np.array( [ [255,0,0,255], [0,255,0,255]], dtype = np.ubyte) edg = np.array( [ [0,1]], dtype = np.uint32 ) aff = np.eye(4, dtype = np.float32) aff[:3,3] = [0,0,0] nlabs = {0 : { 'label' : 'Node 1', 'size' : 20, 'font' : 'Times New Roman', 'color' : ( 255, 0, 0, 255 ) }, 1 : { 'label' : 'Node 2'} } cu = AttributeNetwork(affine = aff, node_position = pos, node_size = siz, node_color = col, node_label = nlabs, edge_connectivity = edg) wi.add_actor_to_world(cu) run() #cu.start() #w.delete(cu)
bigpos = np.zeros((d * len(pos), 3), dtype=np.float32) bigpar = np.zeros((d * len(parents)), dtype=np.float32) print bigpar.shape off = 0 offpar = 0 poslen = len(pos) parlen = len(parents) for i in range(d): pos2 = pos.copy() # spread in xy plane pos2[:, 0] = pos2[:, 0] + (randn() - 0.5) * s pos2[:, 1] = pos2[:, 1] + (randn() - 0.5) * s bigpos[off:off + poslen, :] = pos2.copy() bigpar[offpar:offpar + parlen] = parents + off print "offset", off print bigpos print "bigpar,", bigpar[offpar:offpar + parlen] off += poslen offpar += parlen # create an globaltopology array treeregion = TreeRegion(vertices=pos2, connectivity=parents) window.add_actor_to_world(treeregion) fos.run()
print bigpar.shape off = 0 offpar = 0 poslen = len(pos) parlen = len(parents) for i in range(d): pos2 = pos.copy() # spread in xy plane pos2[:,0] = pos2[:,0] + (randn()-0.5)*s pos2[:,1] = pos2[:,1] + (randn()-0.5)*s bigpos[off:off+poslen,:] = pos2.copy() bigpar[offpar:offpar+parlen] = parents + off print "offset", off print bigpos print "bigpar,", bigpar[offpar:offpar+parlen] off += poslen offpar += parlen # create an globaltopology array treeregion = TreeRegion(vertices = pos2, connectivity = parents ) window.add_actor_to_world(treeregion) fos.run()