Here is what I am trying to draw that in LaTeX.
Asked
Active
Viewed 363 times
1 Answers
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:
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.
Thruston
- 42,268
-
1An 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-3dplotis 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 '16 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 '16 at 12:26
-
-
There's a
filldrawcommand. Can you use that with asurfaceor only apath? – cfr Feb 23 '16 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 '16 at 18:24
-
-
I think none of above answers are good. The quality of drawing is too weak for even a report. – Mohammad Feb 24 '16 at 01:44
-
I think the jaggies you see are because I've rendered the PDF produced by Asymptote at a fairly low resolution for pasting here. Asymptote does "proper" three dimensional rendering so that the lines get smaller in the background etc. You can adjust it to make any desired quality you need, but you need to read the documentation carefully to get it right. Why don;t you do some experiments to see what you can get? – Thruston Feb 24 '16 at 15:27
-
-
I tried to use above example using texstudio. I called the package. Studio compliled the code without errors but it did not draw in pdf file. It was blank. What I am missing here. – Aschoolar Jun 16 '18 at 18:17


diagramsor something package-neutral might be better as you didn't specify any package. Buttikz-pgfis closer thanword;). – cfr Feb 23 '16 at 04:02