Beispiel #1
0
def calcRotTranses(mNames):

    frt = np.eye(4, 4)

    rts = makeRtVec(frt)

    for i in xrange(start_frame,end_frame - 1):


        m1 = m3d.model3d_plus()
        m2 = m3d.model3d_plus()

        m1.read_ply(mNames % i)
        m2.read_ply(mNames % (i + 1))

        rt = calcRotTrans(m1,m2)

        if i == start_frame:
            numRt = rt.dot(frt)
            #print numRt
        else:
            numRt = rt.dot(numRt)
            #print numRt

        rts = np.hstack((rts, makeRtVec(numRt)))

    return rts
def deformMesh(rigid,mesh):
    rm = m3d.model3d_plus()
    v,f = mesh.returnVF()
    rv = deform_vertex(rigid,v)
    rm.input_data(rv,f)

    return rm
Beispiel #3
0
def deformMesh(rigid, mesh):
    rm = m3d.model3d_plus()
    v, f = mesh.returnVF()
    rv = deform_vertex(rigid, v)
    rm.input_data(rv, f)

    return rm
def apply_distance(distance,mesh):
    dtemp2 = restoreGlobalDisList(mesh.solves, distance) #local -> global
    newdist = restore_p2p_distace(dtemp2,mesh) #face2face dist -> p2p dist
    newver = apply_distance_vertex(newdist,mesh.vertexes) # apply dist

    remesh = md.model3d_plus()
    remesh.input_data(newver,mesh.faces)

    return remesh
Beispiel #5
0
def test5():

    red = mut.makeRed(1000)
    path = "./data/restore-pass-comp9"
    mut.mkdir_p(path)
    for i in xrange(1000):
        m1 = m3d.model3d_plus()
        m1.read_ply("./pcacolors-comp9/restore/ply/resotre%04d.ply" % i)
        m1.write_color_ply(path + "/restore%04d.ply" % i, red)
Beispiel #6
0
def test5():

    red = mut.makeRed(1000)
    path = './data/restore-pass-comp9'
    mut.mkdir_p(path)
    for i in xrange(1000):
        m1 = m3d.model3d_plus()
        m1.read_ply("./pcacolors-comp9/restore/ply/resotre%04d.ply" % i)
        m1.write_color_ply(path + '/restore%04d.ply' % i, red)
Beispiel #7
0
def apply_distance(distance, mesh):
    dtemp2 = restoreGlobalDisList(mesh.solves, distance)  #local -> global
    newdist = restore_p2p_distace(dtemp2, mesh)  #face2face dist -> p2p dist
    newver = apply_distance_vertex(newdist, mesh.vertexes)  # apply dist

    remesh = md.model3d_plus()
    remesh.input_data(newver, mesh.faces)

    return remesh
def test():

    t = m3d.model3d_plus()

    t.read_ply("./data/move/move00-shape.ply")

    t.calc_all()
    print "f,no",t.f_normals
    row,col = t.f_normals.shape
    print "num" ,col
Beispiel #9
0
def test():

    t = m3d.model3d_plus()

    t.read_ply("./data/move/move00-shape.ply")

    t.calc_all()
    print "f,no", t.f_normals
    row, col = t.f_normals.shape
    print "num", col
Beispiel #10
0
def checkParam():
    m1 = m3d.model3d_plus()
    m1.read_ply('./data/cloth4ply/mrshape/ball0030.ply')
    rt = np.loadtxt('./pcalearn-comp3/learn/skip0040Param.txt')

    print rt
    mat,mat44 = vec2mat(rt)
    print mat44

    mr = mut.deformMesh(mat44,m1)
    mr.write_ply('defframe40,ply')

    m39 = m3d.model3d_plus()
    m40 = m3d.model3d_plus()
    m39.read_ply('./data/cloth4ply/mrshape/ball0039.ply')
    m40.read_ply('./data/cloth4ply/mrshape/ball0040.ply')
    rot = calcRotTrans(m1,m40)

    mr2 = mut.deformMesh(rot,m1)
    mr2.write_ply('defframe40-.ply')