Change face colors of tetrahedron mesh
1 次查看(过去 30 天)
显示 更早的评论
I'm working with tetrahedrons and would like to change the color of them depending on their deformation. I have been trying but haven't found a solution.
I simplied it and tried this:
h=tetramesh(Tes,Graficos);
Color=get(h,'CData');
h=tetramesh(Tes,Graficos,'CData',Color);
What I wanted to do is just to get the color properties of the tetramesh and then assign it again, just to see if it works. I though is should work, since the form of the output COLOR should be "pure".
The output color is an structure array with the number of elements equal to the number of tetrahedron and in each cell there is an array 4x1. Each cell represents the color of each of the 4 faces of the tetrahedron.
This doesn't work and an error appeas:
??? Error using ==> patch
Value must be double or float
Error in ==> tetramesh at 100
h(n)=patch(x1,x2,x3,[1 1 1 1]*c(n),'FaceAlpha', 0.9,...
Could anyone help me with this problem? Why even taking the output of tetramesh, then it doesn't accept it?
Thanks a lot.
Carlos
0 个评论
采纳的回答
Sean de Wolski
2012-4-18
what is:
class(x1)
class(x2)
class(x3)
class(c)
One of those will not be 'double' or 'single'. Convert that one to double using double().
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!