map floats between 0 and 1 to colorvector

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/seamanj/article/details/86485330


[vertices1, faces1] = read_mesh('dog6.obj');
[vertices1, faces1] = check_face_vertex(vertices1, faces1);


X = vertices1(1,:);

color = (X - min(X))./  (max(X) - min(X));
color = color';

colormap jet(256);
cm = colormap;
colorID = sum( color > repmat(0:1/length(cm(:,1)):1, num_vertices,1), 2 );
colorID = bsxfun(@max, colorID, 1);

options = [];
options.face_vertex_color = cm(colorID, :);

my_plot_mesh(vertices1, faces1, options);
shading interp; 
material([0.4 0.8 0]);

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/seamanj/article/details/86485330