def random_balls(): os = np.random.rand(30).reshape((-1, 3)) rs = np.random.rand(10) / 5 cs = (np.random.rand(10) * 255).astype(np.uint8) cs = myvi.linear_color('jet')[cs] / 255 vts, fs, ns, cs = myvi.build_balls(os, rs, cs) manager = myvi.Manager() manager.add_obj('balls', vts, fs, ns, cs) manager.show('Random Balls Demo')
def ball_ring(): os = np.random.rand(30).reshape((-1,3)) rs = np.random.rand(10)/7 cs = (np.random.rand(10)*255).astype(np.uint8) cs = myvi.linear_color('jet')[cs]/255 vts_b, fs_b, ns_b, cs_b = myvi.build_balls(list(os), list(rs), list(cs)) vts_l, fs_l, ns_l, cs_l = myvi.build_line(os[:,0], os[:,1], os[:,2], list(cs)) manager = myvi.Manager() manager.add_surf('balls', vts_b, fs_b, ns_b, cs_b) line = manager.add_surf('line', vts_l, fs_l, ns_l, cs_l) line.set_style(mode='grid') manager.show('Balls Ring Demo')
def balls_with_mark(): os = np.random.rand(30).reshape((-1, 3)) rs = np.random.rand(10) / 7 cs = (np.random.rand(10) * 255).astype(np.uint8) cs = myvi.linear_color('jet')[cs] / 255 vts_b, fs_b, ns_b, cs_b = myvi.build_balls(os, rs, cs) cont = ['ID:%s' % i for i in range(10)] vtss, fss, pps, h, color = myvi.build_marks(cont, os, rs, 0.05, (1, 1, 1)) manager = myvi.Manager() manager.add_surf('balls', vts_b, fs_b, ns_b, cs_b) line = manager.add_mark('line', vtss, fss, pps, h, color) line.set_style(mode='grid') manager.show('Balls Mark Demo')