The line is not dashed, it's just rendered like that. With the three
module, Asymptote produces raster output rather than vector output. You can increase the resolution (and slow down the time it takes to do the rendering) with the -render
option. The default value is 2 for eps
output. Your drawing looks better on my system, if I turn the viewing angle slightly and compile with asy -render 7
. Here it is using
currentprojection=perspective(1,-1,1/2);
and converted using OSX Preview to png
at 142 pixels per inch.
If you would rather have proper vector output, then you should probably use pstricks
, which does 3D very well (although most of the documentation is only in French). Metapost is another alternative that produces vector PostScript but there's no standard approach to 3D. You could try mp3d or mp-solid, but for something as simple as your tetrahedron however all you need is a routine to project a 3D point to a 2D one. Like this:
prologues := 3;
outputtemplate := "%j%c.eps";
vardef pp(expr xx,yy,zz) =
_x := yy*cosd(theta) - xx*sind(theta);
_y := zz*cosd(phi) - yy*sind(theta)*sind(phi) - xx*cosd(theta)*sind(phi);
_z := 12 - zz*sind(phi) - yy*sind(theta)*cosd(phi) - xx*cosd(theta)*cosd(phi);
1000*(_x/_z, _y/_z)
enddef;
theta := 288; % rotation of viewpoint
phi := 18; % elevation of viewpoint
beginfig(1);
z0 = pp(0,0,0);
z1 = pp(-sqrt(3)/2, -1/2, 0);
z2 = pp(+sqrt(3)/2, -1/2, 0);
z3 = pp(0,1,0);
z4 = pp(0,0,sqrt(2));
draw z1--z2--z3--cycle;
draw z0 -- z4 withcolor .67 red;
draw z1 -- z4 dashed evenly scaled .7;
draw z2 -- z4 dashed evenly scaled .7;
draw z3 -- z4 dashed evenly scaled .7;
dotlabel.lft (btex $x_1$ etex, z1);
dotlabel.rt (btex $x_2$ etex, z2);
dotlabel.ulft(btex $x_3$ etex scaled .8, z3);
dotlabel.top (btex $x_4$ etex, z4);
dotlabel.rt (btex $B_3$ etex, z0) withcolor .67 red;
endfig;
end.
The advantages are (a) it's very simple and fast and (b) it's proper vector output, so there are no jagged edges. But that's about it; PSTricks or Asymptote will do a better job at more or less every other aspect of 3D drawing.
Best Answer
TikZ provides a
mindmapping
library for that purpose. Examples: