Exemplo n.º 1
0
def key_down(viewer,key,mod):
    global U, c
    
    if key == ord(' '):
        U = U.rightCols(k)

        # Rescale eigen vectors for visualization
        Z = bbd*0.5*U.col(c)
        C = igl.eigen.MatrixXd()
        igl.parula(U.col(c),False,C)
        c = (c+1)%U.cols()

        if twod:
            V.setcol(2,Z)

        viewer.data.set_mesh(V,F)
        viewer.data.compute_normals()
        viewer.data.set_colors(C)
        return True
def key_down(viewer, key, mod):
    global U, c

    if key == ord(' '):
        U = U.rightCols(k)

        # Rescale eigen vectors for visualization
        Z = bbd * 0.5 * U.col(c)
        C = igl.eigen.MatrixXd()
        igl.parula(U.col(c), False, C)
        c = (c + 1) % U.cols()

        if twod:
            V.setcol(2, Z)

        viewer.data.set_mesh(V, F)
        viewer.data.compute_normals()
        viewer.data.set_colors(C)
        return True
Exemplo n.º 3
0
PD2 = igl.eigen.MatrixXd()

PV1 = igl.eigen.MatrixXd()
PV2 = igl.eigen.MatrixXd()

igl.principal_curvature(V, F, PD1, PD2, PV1, PV2)

# Mean curvature
H = 0.5 * (PV1 + PV2)

viewer = igl.viewer.Viewer()
viewer.data.set_mesh(V, F)

# Compute pseudocolor
C = igl.eigen.MatrixXd()
igl.parula(H, True, C)

viewer.data.set_colors(C)

# Average edge length for sizing
avg = igl.avg_edge_length(V, F)

# Draw a blue segment parallel to the minimal curvature direction
red = igl.eigen.MatrixXd([[0.8, 0.2, 0.2]])
blue = igl.eigen.MatrixXd([[0.2, 0.2, 0.8]])

viewer.data.add_edges(V + PD1 * avg, V - PD1 * avg, blue)

# Draw a red segment parallel to the maximal curvature direction
viewer.data.add_edges(V + PD2 * avg, V - PD2 * avg, red)
PD2 = igl.eigen.MatrixXd()

PV1 = igl.eigen.MatrixXd()
PV2 = igl.eigen.MatrixXd()

igl.principal_curvature(V,F,PD1,PD2,PV1,PV2)

# Mean curvature
H = 0.5*(PV1+PV2)

viewer = igl.viewer.Viewer()
viewer.data.set_mesh(V, F)

# Compute pseudocolor
C = igl.eigen.MatrixXd()
igl.parula(H,True,C)

viewer.data.set_colors(C)

# Average edge length for sizing
avg = igl.avg_edge_length(V,F)

# Draw a blue segment parallel to the minimal curvature direction
red = igl.eigen.MatrixXd([[0.8,0.2,0.2]])
blue = igl.eigen.MatrixXd([[0.2,0.2,0.8]])

viewer.data.add_edges(V + PD1*avg, V - PD1*avg, blue)

# Draw a red segment parallel to the maximal curvature direction
viewer.data.add_edges(V + PD2*avg, V - PD2*avg, red)