def representative_to_nrosy(V, F, R, N, Y): B1 = igl.eigen.MatrixXd() B2 = igl.eigen.MatrixXd() B3 = igl.eigen.MatrixXd() igl.local_basis(V, F, B1, B2, B3) Y.resize(F.rows(), 3 * N) for i in range(0, F.rows()): x = R.row(i) * B1.row(i).transpose() y = R.row(i) * B2.row(i).transpose() angle = np.arctan2(y, x) for j in range(0, N): anglej = angle + np.pi * float(j) / float(N) xj = float(np.cos(anglej)) yj = float(np.sin(anglej)) Y.setBlock(i, j * 3, 1, 3, xj * B1.row(i) + yj * B2.row(i))
def representative_to_nrosy(V, F, R, N, Y): B1 = igl.eigen.MatrixXd() B2 = igl.eigen.MatrixXd() B3 = igl.eigen.MatrixXd() igl.local_basis(V, F, B1, B2, B3) Y.resize(F.rows() * N, 3) for i in range(0, F.rows()): x = R.row(i) * B1.row(i).transpose() y = R.row(i) * B2.row(i).transpose() angle = atan2(y[0], x[0]) for j in range(0, N): anglej = angle + 2 * pi * j / float(N) xj = cos(anglej) yj = sin(anglej) Y.setRow(i * N + j, xj * B1.row(i) + yj * B2.row(i))
# Contrain one face b = igl.eigen.MatrixXd([[0]]).castint() bc = igl.eigen.MatrixXd([[1, 0, 0]]) # Create a smooth 4-RoSy field S = igl.eigen.MatrixXd() igl.comiso.nrosy(V, F, b, bc, igl.eigen.MatrixXi(), igl.eigen.MatrixXd(), igl.eigen.MatrixXd(), 4, 0.5, X1, S) # Find the orthogonal vector B1 = igl.eigen.MatrixXd() B2 = igl.eigen.MatrixXd() B3 = igl.eigen.MatrixXd() igl.local_basis(V, F, B1, B2, B3) X2 = igl.rotate_vectors(X1, igl.eigen.MatrixXd.Constant(1, 1, pi / 2), B1, B2) gradient_size = 50 iterations = 0 stiffness = 5.0 direct_round = False # Always work on the bisectors, it is more general igl.compute_frame_field_bisectors(V, F, X1, X2, BIS1, BIS2) # Comb the field, implicitly defining the seams igl.comb_cross_field(V, F, BIS1, BIS2, BIS1_combed, BIS2_combed) # Find the integer mismatches
# Contrain one face b = igl.eigen.MatrixXi([[0]]) bc = igl.eigen.MatrixXd([[1, 0, 0]]) # Create a smooth 4-RoSy field S = igl.eigen.MatrixXd() igl.comiso.nrosy(V, F, b, bc, igl.eigen.MatrixXi(), igl.eigen.MatrixXd(), igl.eigen.MatrixXd(), 4, 0.5, X1, S) # Find the the orthogonal vector B1 = igl.eigen.MatrixXd() B2 = igl.eigen.MatrixXd() B3 = igl.eigen.MatrixXd() igl.local_basis(V, F, B1, B2, B3) X2 = igl.rotate_vectors(X1, igl.eigen.MatrixXd.Constant(1, 1, pi / 2), B1, B2) gradient_size = 50 iterations = 0 stiffness = 5.0 direct_round = False # Always work on the bisectors, it is more general igl.compute_frame_field_bisectors(V, F, X1, X2, BIS1, BIS2) # Comb the field, implicitly defining the seams igl.comb_cross_field(V, F, BIS1, BIS2, BIS1_combed, BIS2_combed) # Find the integer mismatches