0

The following code plots 3 cuboids, each with a label at the lower left vertex. The label is meant to be part of the cuboid object. Yet, since Text[] is used to display the label, the label "1" does not hide with cuboid #1 from the default view point.

Mathematica description of Text[] specifically calls out that

"Text is drawn in front of all other objects."

Is there a way to display labels truly with their respective objects, so that they show or hide with their respective objects?

centers = Table[{Cos[2 k], Sin[2 k], 0.5 k }, {k, 3}];  
setOfCuboids =
  Table[{Graphics3D[Cuboid[centers[[k]]]],
         Graphics3D[Text[k, centers[[k]]]]},
    {k, 1, 3}];  
Show[setOfCuboids]
Kuba
  • 136,707
  • 13
  • 279
  • 740

0 Answers0