Change face colors of tetrahedron mesh
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Sean de Wolski
on 18 Apr 2012
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 Comments
More Answers (1)
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!