def scramble_colors(): global C, viewer, RGBcolors for p in range(2): R = igl.eigen.MatrixXi() igl.randperm(C[p].maxCoeff() + 1, R) C[p] = igl.slice(R, igl.eigen.MatrixXi(C[p])) HSV = igl.eigen.MatrixXd(C[p].rows(), 3) HSV.setCol(0, 360.0 * C[p].castdouble() / C[p].maxCoeff()) HSVright = igl.eigen.MatrixXd(HSV.rows(), 2) HSVright.setConstant(1.0) HSV.setRightCols(2, HSVright) igl.hsv_to_rgb(HSV, RGBcolors[p]) viewer.data.set_colors(RGBcolors[facetwise])
def scramble_colors(): global C, viewer, RGBcolors for p in range(2): R = igl.eigen.MatrixXi() igl.randperm(C[p].maxCoeff() + 1, R) C[p] = igl.slice(R, igl.eigen.MatrixXi(C[p])) HSV = igl.eigen.MatrixXd(C[p].rows(), 3) HSV.setCol(0, 360.0 * C[p].castdouble() / C[p].maxCoeff()) HSVright = igl.eigen.MatrixXd(HSV.rows(), 2) HSVright.setConstant(1.0) HSV.setRightCols(2, HSVright) igl.hsv_to_rgb(HSV, RGBcolors[p]) viewer.data().set_colors(RGBcolors[facetwise])