igl.cotmatrix(V, F, L) igl.slice(L, vin, vin, L_in_in) igl.slice(L, vin, b, L_in_b) # Dirichlet boundary conditions from z-coordinate bc = igl.eigen.MatrixXd() Z = V.col(2) igl.slice(Z, b, bc) # Solve PDE solver = igl.eigen.SimplicialLLTsparse(-L_in_in) Z_in = solver.solve(L_in_b * bc) # slice into solution igl.slice_into(Z_in, vin, Z) # Alternative, short hand mqwf = igl.min_quad_with_fixed_data() # Linear term is 0 B = igl.eigen.MatrixXd() B.setZero(V.rows(), 1) # Empty constraints Beq = igl.eigen.MatrixXd() Aeq = igl.eigen.SparseMatrixd() # Our cotmatrix is _negative_ definite, so flip sign igl.min_quad_with_fixed_precompute(-L, b, Aeq, True, mqwf) igl.min_quad_with_fixed_solve(mqwf, B, bc, Beq, Z)
igl.cotmatrix(V,F,L) igl.slice(L,vin,vin,L_in_in) igl.slice(L,vin,b,L_in_b) # Dirichlet boundary conditions from z-coordinate bc = igl.eigen.MatrixXd() Z = V.col(2) igl.slice(Z,b,bc) # Solve PDE solver = igl.eigen.SimplicialLLTsparse(-L_in_in) Z_in = solver.solve(L_in_b*bc) # slice into solution igl.slice_into(Z_in,vin,Z) # Alternative, short hand mqwf = igl.min_quad_with_fixed_data() # Linear term is 0 B = igl.eigen.MatrixXd() B.setZero(V.rows(),1); # Empty constraints Beq = igl.eigen.MatrixXd() Aeq = igl.eigen.SparseMatrixd() # Our cotmatrix is _negative_ definite, so flip sign igl.min_quad_with_fixed_precompute(-L,b,Aeq,True,mqwf) igl.min_quad_with_fixed_solve(mqwf,B,bc,Beq,Z)
igl.readOFF(TUTORIAL_SHARED_PATH + "decimated-knight.off", V, F) # Sort barycenters lexicographically BC = igl.eigen.MatrixXd() sorted_BC = igl.eigen.MatrixXd() igl.barycenter(V, F, BC) I = igl.eigen.MatrixXi() J = igl.eigen.MatrixXi() # sorted_BC = BC(I,:) igl.sortrows(BC, True, sorted_BC, I) # Get sorted "place" from sorted indices J.resize(I.rows(), 1) # J(I) = 1:numel(I) igl.slice_into(igl.coloni(0, I.size() - 1), I, J) # Pseudo-color based on sorted place C = igl.eigen.MatrixXd() igl.jet(J.castdouble(), True, C) # Plot the mesh with pseudocolors viewer = igl.viewer.Viewer() viewer.data.set_mesh(V, F) viewer.data.set_colors(C) viewer.launch()
F = igl.eigen.MatrixXi() igl.readOFF(TUTORIAL_SHARED_PATH + "decimated-knight.off", V, F) # 100 random indices into rows of F I = igl.eigen.MatrixXi() igl.floor((0.5 * (igl.eigen.MatrixXd.Random(100, 1) + 1.) * F.rows()), I) # 50 random indices into rows of I J = igl.eigen.MatrixXi() igl.floor((0.5 * (igl.eigen.MatrixXd.Random(50, 1) + 1.) * I.rows()), J) # K = I(J); K = igl.eigen.MatrixXi() igl.slice(I, J, K) # default green for all faces # C = p2e(np.array([[0.4,0.8,0.3]])).replicate(F.rows(),1) C = igl.eigen.MatrixXd([[0.4, 0.8, 0.3]]).replicate(F.rows(), 1) # Red for each in K R = igl.eigen.MatrixXd([[1.0, 0.3, 0.3]]).replicate(K.rows(), 1) # C(K,:) = R igl.slice_into(R, K, 1, C) # Plot the mesh with pseudocolors viewer = igl.glfw.Viewer() viewer.data().set_mesh(V, F) viewer.data().set_colors(C) viewer.launch()
igl.readOFF(TUTORIAL_SHARED_PATH + "decimated-knight.off", V, F) # 100 random indices into rows of F I = igl.eigen.MatrixXi() igl.floor((0.5 * (igl.eigen.MatrixXd.Random(100, 1) + 1.) * F.rows()), I) # 50 random indices into rows of I J = igl.eigen.MatrixXi() igl.floor((0.5 * (igl.eigen.MatrixXd.Random(50, 1) + 1.) * I.rows()), J) # K = I(J); K = igl.eigen.MatrixXi() igl.slice(I, J, K) # default green for all faces # C = p2e(np.array([[0.4,0.8,0.3]])).replicate(F.rows(),1) C = igl.eigen.MatrixXd([[0.4, 0.8, 0.3]]).replicate(F.rows(), 1) # Red for each in K R = igl.eigen.MatrixXd([[1.0, 0.3, 0.3]]).replicate(K.rows(), 1) # C(K,:) = R igl.slice_into(R, K, 1, C) # Plot the mesh with pseudocolors viewer = igl.glfw.Viewer() viewer.data().set_mesh(V, F) viewer.data().set_colors(C) viewer.launch()