Tag Info

New answers tagged

1

Here is a solution that allows plain Metapost to use HSV colours. prologues := 3; outputtemplate := "%j%c.eps"; vardef hsv_color(expr h,s,v) = % following wikipedia article on "HSL and HSV" save chroma, hh, x, m; chroma = v*s; hh = h/60; x = chroma * (1-abs(hh mod 2 - 1)); m = v - chroma; if hh < 1: (chroma,x,0)+(m,m,m) ...


2

Here's an attempt in Metapost. The picture shows d=2, d=3, d=4, and d=6. It was easier to compute and store the ratios than fiddle about doing them in MP each time. Obviously it does not work for d<2, and for d>8 you basically get a completely black disc. prologues := 3; outputtemplate := "%j%c.eps"; ratio2 = 0.78540 ; ratio3 = 0.52360 ; ...


2

It is not difficult to change the radius of the inner circle to be a function of \N. I left it constant as I am so lazy to search for such a function right now. Static version \documentclass[pstricks,border=12pt]{standalone} \usepackage{multido} \begin{document} \makeatletter \def\N{12}\degrees[\N] \begin{pspicture}[dimen=m,linejoin=1](-5,-5)(5,5) ...


2

Metapost is a declarative graphics language; the program describes the image but is not the image itself. You have to compile the mp file to produce the mps file which pdftex includes. Depending on your OS, something like this should do it: mpost image.mp This will produce a file image.1, which you rename image.mps to include it with pdftex. (There are ...


4

In Metapost, you can shade an annulus by filling the outer circle with the shade and then filling the inner circle with the background. Here's an attempt at your figure, which might give you a starting point. prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); path c, d, r, h; p = 89; q = 34; c = fullcircle xscaled p yscaled q; d = c scaled ...


3

Convention is for each module to prevent itself from being interpreted multiple times using a guard at the top of the module. User code and other modules load external modules as required. A guard can be implemented by declaring a variable or macro and then testing for its existence using the known operator. If it exists before it has been declared, the ...


12

Our TikZers getting lazy I guess. This can't get away without a TikZ answer :P Same idea but using decorations (over and over again). \documentclass[tikz]{standalone} \usetikzlibrary{decorations.pathmorphing,decorations.markings,calc} \begin{document} \begin{tikzpicture} \shadedraw[thick,top color=gray!10,bottom color=gray, postaction=decorate, ...


18

Here's an attempt in Metapost. Using the direction x of y macro to find the required angle of reflection. Here's what you get with r=0: And with r=0.33: prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); path base, ray[]; u = 5mm; r=0.33; base = (-6u,0) for x=-5.8u step 0.2u until 5.8u: -- (x,r*normaldeviate) endfor -- (6u,0); draw ...



Top 50 recent answers are included