Exemplo n.º 1
0
def grdview(volume, world2grid=None):
    with py_util.py2_temporary_directory() as d:
        gpath = d + '/g.grd'
        # Dummy world2grid:
        file_util.write_grd(gpath, volume, world2grid=world2grid)
        cmd = '%s/grdview %s' % (path_util.gaps_path(), gpath)
        sp.check_output(cmd, shell=True)
Exemplo n.º 2
0
def _gapsview(d,
              msh=None,
              pts=None,
              grd=None,
              world2grid=None,
              grid_threshold=0.0,
              camera='default'):
    """Interactively views a mesh, pointcloud, and/or grid at the same time."""
    assert msh is not None or pts is not None or grd is not None
    mpath = ''
    ppath = ''
    gpath = ''
    init_camera = _setup_cam(camera)
    if msh is not None:
        mpath = d + '/m.ply'
        file_util.write_mesh(mpath, msh)
        mpath = ' ' + mpath
        log.info('Mpath: %s' % mpath)
    ppath = _make_pts_input_str(d, pts)
    if grd is not None:
        gpath = d + '/g.grd'
        file_util.write_grd(gpath, grd, world2grid=world2grid)
        gpath = ' ' + gpath + ' -grid_threshold %0.6f' % grid_threshold
    cmd = '%s/gapsview%s%s%s%s' % (path_util.gaps_path(), mpath, ppath, gpath,
                                   init_camera)
    log.info(cmd)
    sp.check_output(cmd, shell=True)
Exemplo n.º 3
0
def ptsview(pts, mesh=None, camera='fixed'):
    """Interactively visualizes a pointcloud alongside an optional mesh."""
    with py_util.py2_temporary_directory() as d:
        ptspath = _make_pts_input_str(d, pts, allow_none=False)
        init_camera = _setup_cam(camera)
        mshpath = ''
        if mesh:
            mshpath = d + '/m.ply'
            file_util.write_mesh(mshpath, mesh)
            mshpath = ' ' + mshpath
        cmd = '%s/ptsview %s%s%s' % (path_util.gaps_path(), ptspath, mshpath,
                                     init_camera)
        log.info(cmd)
        sp.check_output(cmd, shell=True)
Exemplo n.º 4
0
def mshview(mesh, camera='fixed'):
    """Interactively views a mesh."""
    with py_util.py2_temporary_directory() as d:
        init_camera = _setup_cam(camera)
        if not isinstance(mesh, list):
            mesh = [mesh]
        assert len(mesh) <= 4
        mshpath = ''
        for m, c in zip(mesh, ['m', 'n', 'o', 'p']):
            lpath = f'{d}/{c}.ply'
            mshpath += f' {lpath}'
            file_util.write_mesh(lpath, m)
        cmd = '%s/mshview %s%s' % (path_util.gaps_path(), mshpath, init_camera)
        log.info(cmd)
        sp.check_output(cmd, shell=True)