MATLAB Answers

How to put names on the six faces of a cube so that they do not disappear in the cube?

5 views (last 30 days)
Kees Roos
Kees Roos on 25 Jul 2016
Commented: Kees Roos on 25 Jul 2016
Vertices = [0 0 0; 1 0 0; 1 1 0; 0 1 0; 0 0 1; 1 0 1; 1 1 1; 0 1 1];
Faces = [1 2 6 5; 2 3 7 6; 3 4 8 7; 4 1 5 8; 1 2 3 4; 5 6 7 8]
h = patch('Vertices',Vertices,'Faces',Faces, 'FaceVertexCData',hsv(6),'FaceColor','flat')
view(3); axis square
for k = 1:6, text(mean(Vertices(Faces(k,:),1)), ... mean(Vertices(Faces(k,:),2)), ... mean(Vertices(Faces(k,:),3)), ... num2str(k), 'Fontsize',44) end return

  0 Comments

Sign in to comment.

Answers (1)

Thorsten
Thorsten on 25 Jul 2016
help text

  5 Comments

Show 2 older comments
Kees Roos
Kees Roos on 25 Jul 2016
Thanks again. I was looking for a solution of my problem with patch(...,'FaceAlpha',1). Is there no way to achieve this?
Stephen Cobeldick
Stephen Cobeldick on 25 Jul 2016
@Kees Roos: Rather than placing the text on the cube surface, you could specify the location of the text a little further away from the center of the cube. Then the cube will not interfere with the text.

Sign in to comment.