Пример #1
0
def render_to_file(filename, mesh):
    bounds = mesh[0]["dat"].GetBounds()
    scale = max(bounds[1] - bounds[0], bounds[3] - bounds[2],
                bounds[5] - bounds[4]) / 2
    v = viewer.Viewer(mesh, size=RESOLUTION)
    v.filename = os.path.join(filename)
    v.set_camera(position=(0, 0, 100), parallel_scale=scale)
    v.render()
Пример #2
0
def plot_curves(curves):
    data = []
    for group in curves.values():
        for curve in group:
            curve_balls = sampledata.create_balls(curve, 1, color=(1, 0, 0))
            data = data + curve_balls
    v = viewer.Viewer(data, size=RESOLUTION)
    v.filename = os.path.join(OUTPUTFOLDER, "all_points.png")
    v.render()
Пример #3
0
def viewer_demo():
    mesh = sampledata.load_obj(os.path.join(DATAFOLDER,
                                            "13_IVsin_miku_EM.obj"))
    ls = sampledata.load_sl_balls(os.path.join(DATAFOLDER, "13 IV z GOMu.asc"),
                                  None, 1, (0, 1, 0))
    sls = sampledata.load_sl_balls(
        os.path.join(DATAFOLDER, "13 IV z GOMu.asc"), 30, 2)
    data = ls + sls + [dict(dat=mesh, col=(1, 1, 1))]
    v = viewer.Viewer(data, size=RESOLUTION)
    render(v)
Пример #4
0
 def _show_vdata_in_viewer(self, vdata, filename, opts, res):
     v = viewer.Viewer(vdata, size=res)
     _mkbasedir_if_not_exist(filename)
     v.filename = filename
     if 'camera' in opts:
         v.set_camera(position=opts['camera']['position'],
                      focal_point=opts['camera']['focal_point'],
                      parallel_scale=opts['camera']['parallel_scale'],
                      view_up=opts['camera']['view_up'])
     v.render()
Пример #5
0
def visualization_generator_demo():
    mesh = sampledata.load_obj(os.path.join(DATAFOLDER,
                                            "13_IVsin_miku_EM.obj"))
    for sl_count in [5, 10, 20, 30, 40]:
        sls = sampledata.load_sl_balls(
            os.path.join(DATAFOLDER, "13 IV z GOMu.asc"), sl_count, 2)
        v = viewer.Viewer(sls + [dict(dat=mesh, col=(1, 1, 1))],
                          size=RESOLUTION)
        v.filename = os.path.join(OUTPUTFOLDER,
                                  "screenshot_sl%03d.png" % sl_count)
        render(v)