MATLAB Answers

Make faces of cube transparent

18 views (last 30 days)
monkey_matlab
monkey_matlab on 22 Sep 2017
Answered: Jan on 22 Sep 2017
Hello,
I have made a 3D cube but would like to have the faces appear transparent. How do I go about doing that? Thanks.
Here is my code:
vert = [0 0 0;1 0 0;1 1 0;0 1 0;0 0 1;1 0 1;1 1 1;0 1 1];
fac = [1 2 6 5;2 3 7 6;3 4 8 7;4 1 5 8;1 2 3 4;5 6 7 8];
patch('Vertices',vert,'Faces',fac,...
'FaceVertexCData',hsv(6),'FaceColor','flat')
view(3)
axis vis3d
rotate3d
xlabel('x')
ylabel('y')
zlabel('z')

  0 Comments

Sign in to comment.

Accepted Answer

Jan
Jan on 22 Sep 2017
patch('Vertices',vert,'Faces',fac,...
'FaceVertexCData',hsv(6),'FaceColor','flat', ...
'FaceAlpha', 0.5); % <== Add this

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags

Products