示例#1
0
def show_all_particles(this, faustId, nParticles, s):
    """
    @params: this, a dpmp object
    @params: faustId, ID of the faust scan, only used for the filename of the picture
    @params: nParticles, how many particles to show
    @params: step, only used for the filename of the picture
    """
    ms = [
        Mesh(v=this.scanMesh.v,
             f=this.scanMesh.f).set_vertex_colors('firebrick')
    ]
    for i in range(0, nParticles):
        for part in this.body.partSet:
            P = particles.particle_to_points(this, this.b[part]['x'][:, i],
                                             part)
            ms.append(
                Mesh(v=P, f=this.body.partFaces[part]).set_vertex_colors(
                    this.body.colors[part]))

    mv = MeshViewer()
    #mv.set_background_color(np.array([1.0, 1.0, 1.0]))
    mv.set_static_meshes(ms)
    time.sleep(4)
    mv.save_snapshot('particles_' + faustId + '_' + str(s) + '.png',
                     blocking=True)
示例#2
0
def show_mesh(this, P, dbstop=False, mesh=None, scan=None, filename=None, Pwo=None):
    # P is a list of parts

    mv = MeshViewer()
    #mv.set_background_color(np.array([1.0, 1.0, 1.0]))
    ms = [Mesh(v=P[part], f=this.partFaces[part]).set_vertex_colors('light blue')  for part in this.partSet]

    if mesh is not None:
        ms2 = [Mesh(v=mesh[part], f=this.partFaces[part]).set_vertex_colors('SeaGreen') for part in this.partSet]
        ms = ms + ms2
    if scan is not None:
        s = [Mesh(v=scan.v, f=scan.f).set_vertex_colors('firebrick')]
        ms = ms + s
    if Pwo is not None:
        ms2 = [Mesh(v=Pwo[part], f=this.partFaces[part]).set_vertex_colors('turquoise3') for part in this.partSet]
        ms = ms + ms2

    mv.set_static_meshes(ms)
    if filename is not None:
        time.sleep(1)
        mv.save_snapshot(filename, blocking=True)

    if dbstop:
        import pdb
        pdb.set_trace()
    else:
        time.sleep(4)
示例#3
0
文件: dpmp_3D.py 项目: JinlongYANG/sp
def show_all_particles(this, faustId, nParticles, s):
    """
    @params: this, a dpmp object
    @params: faustId, ID of the faust scan, only used for the filename of the picture
    @params: nParticles, how many particles to show
    @params: step, only used for the filename of the picture
    """
    ms = [Mesh(v=this.scanMesh.v, f=this.scanMesh.f).set_vertex_colors('firebrick')]
    for i in range(0, nParticles):
        for part in this.body.partSet:
            P = particles.particle_to_points(this, this.b[part]['x'][:,i], part)
            ms.append(Mesh(v=P, f=this.body.partFaces[part]).set_vertex_colors(this.body.colors[part]))

    mv = MeshViewer()
    #mv.set_background_color(np.array([1.0, 1.0, 1.0]))
    mv.set_static_meshes(ms)
    time.sleep(4)
    mv.save_snapshot('particles_'+faustId+'_'+str(s)+'.png', blocking=True)
示例#4
0
def show_mesh(this,
              P,
              dbstop=False,
              mesh=None,
              scan=None,
              filename=None,
              Pwo=None):
    # P is a list of parts

    mv = MeshViewer()
    #mv.set_background_color(np.array([1.0, 1.0, 1.0]))
    ms = [
        Mesh(v=P[part], f=this.partFaces[part]).set_vertex_colors('light blue')
        for part in this.partSet
    ]

    if mesh is not None:
        ms2 = [
            Mesh(v=mesh[part],
                 f=this.partFaces[part]).set_vertex_colors('SeaGreen')
            for part in this.partSet
        ]
        ms = ms + ms2
    if scan is not None:
        s = [Mesh(v=scan.v, f=scan.f).set_vertex_colors('firebrick')]
        ms = ms + s
    if Pwo is not None:
        ms2 = [
            Mesh(v=Pwo[part],
                 f=this.partFaces[part]).set_vertex_colors('turquoise3')
            for part in this.partSet
        ]
        ms = ms + ms2

    mv.set_static_meshes(ms)
    if filename is not None:
        time.sleep(1)
        mv.save_snapshot(filename, blocking=True)

    if dbstop:
        import pdb
        pdb.set_trace()
    else:
        time.sleep(4)