3

enter image description here

Here is what I am trying to draw that in LaTeX.

9
  • What do you have? Why do you want to draw it in LaTeX? It is not great for 3D.
    – cfr
    Feb 23, 2016 at 4:00
  • @ Arun Debray, what does mean? I found that you wanted to bring attentions to my questions. Correct?
    – Mohammad
    Feb 23, 2016 at 4:00
  • The question was edited because you'd tagged it incorrectly. Now it has a relevant tag. Or, at least, a potentially relevant one. diagrams or something package-neutral might be better as you didn't specify any package. But tikz-pgf is closer than word ;).
    – cfr
    Feb 23, 2016 at 4:02
  • As I was saying ... ;).
    – cfr
    Feb 23, 2016 at 4:03
  • 5
    Some people take exception to questions of the form "Please draw this for me". You will get more help if you post some code showing what you have tried and give a minimal working example.
    – user30471
    Feb 23, 2016 at 6:30

1 Answer 1

7

For 3D graphics, Asymptote is probably the best of the LaTeX-friendly graphics programming languages. I am a beginner at Asymptote, but 15 minutes with Charles Staat's tutorial produced this:

enter image description here

And here's the program that produced it.

import three;

size3(100,100,100);
currentprojection = perspective(10,7,4);

surface i  = shift(-1/2,-1/2,-1/2) * unitcube;
path3[] ii = shift(-1/2,-1/2,-1/2) * unitbox;
surface o  = scale3(2) * i;
path3[] oo = scale3(2) * ii;

draw(i, red+opacity(0.5));
draw(o, grey+opacity(0.3));

draw(ii);
draw(oo);

I've no idea if this is good style, and I'm sure there must be a better way to draw the edges of a surface. The tutorial explains how to add labels.

EDIT: There is indeed a better way to draw the edges of a surface; all you have to do is pass a second colour to the draw command.

draw(i, red+opacity(0.5),black);
draw(o, white+opacity(0.3),black);

Then there is no need for the unitbox objects.

10
  • 1
    An external programme is definitely superior for 3D. Except for maybe pstricks, which I am not sufficiently familiar with to say one way or another. But TikZ really isn't good for 3D.... (Which is to say, you can make stunning stuff but neither easily nor flexibly, although tikz-3dplot is definitely helpful. But it is having to work so hard to fake something which Asymptote seems to handle easily.) Your '15 minutes' comment almost persuades me even I could learn to use it a little ;).
    – cfr
    Feb 23, 2016 at 12:20
  • @cfr - yes I keep thinking the same thing, but Metapost always lures me back... Charles Staats' work on the Asymptote tutorial is first class (although still incomplete).
    – Thruston
    Feb 23, 2016 at 12:26
  • I started to learn Metapost but then discovered TikZ....
    – cfr
    Feb 23, 2016 at 12:32
  • There's a filldraw command. Can you use that with a surface or only a path?
    – cfr
    Feb 23, 2016 at 12:34
  • 1
    @cfr, see updated answer - all you need is to pass a second colour - simple, but not very obvious to this novice!
    – Thruston
    Feb 23, 2016 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.