Hi, Mojca, Aditya, Hans, and all the MP gurus, Thank you for all the help and advice.
On Fri, 30 Jun 2006 18:17:23 -0600, Mojca Miklavec <[EMAIL PROTECTED]> wrote: >> I did find the >> >> u := 1cm; >> z[1] = (2u,6u) ; >> >> method; is there another way, a macro perhaps? > > What about this one? > > save u; numeric u; u = 1cm; > > % point[x][y][z] x,y,z are coordinates (each one can be 1 or 2) > % put one point to a fix location > z111 = origin; > > % same y coordinate > y111 = y211; y121 = y221; y112 = y212; y122 = y222; > > % same x coordinate > x111 = x121; x112 = x122; x211 = x221; x212 = x222; > > % face > x211 - x111 = y121 - y111 = 5u; > > % define the diagonals (you could define other relations instead) > z112 - z111 = z122 - z121 = z212 - z211 = z222 - z221 = (2u,1u); > > But you could also define them using something like > > for i=0 upto 1: > for j=0 upto 1: > for k=0 upto 1: > z[i][j][k] = (i+k*something,j+k*somethingelse) scaled u; > endfor; > endfor; > endfor; > > I guess that you could draw the dashed lines by only clipping the path. > > Metapost is a magician. You almost never need to manually calculate > anything! Wow... Ok, following is my present, still naive code. What I would like to be able to do is 1) In the first figure [square], control the relation of the front and back face of the cube by a single parameter. So if I use z for the front face coordinates, I can use z' for the rear face and define z' as a function of z. Then the angle of the z111--z'111 diagonal wrt the x-axis will change, and the label for that axis will have to change as well. I've been manually calculating inverse tangents to do this but can it be done automatically? 2. In the second figure, to in addition control the distance between the 2 cubes by a single parameter without recalculating the dashed lines mapping the two. I only started yesterday but i can see that MetaPost is going to turn me into a junkie if I'm not careful :-) Any other suggestions for improving/streamlining this is greatly appreciated: I think it will make a nice example case for beginners/on the wiki when done! Best Idris =============meta-test.tex=========== % output=pdf interface=en \setuppapersize[letter][letter] \setupcolors[state=start] \setuppagenumbering[state=stop] \def\AXIS#1#2#3{(#1) Axis #2: {\bf #3}} \forceMPTEXcheck{LABELL} \forceMPTEXcheck{LABELR} \forceMPTEXcheck{LABELM} \startMPenvironment \ssxx\setupinterlinespace \stopMPenvironment \startMPinclusions vardef [EMAIL PROTECTED](expr s, p)= [EMAIL PROTECTED](textext("% \framed[width=1.5cm,align=left,frame=off,autowidth=force,strut=on]{" & s & "}"),p) enddef ; vardef [EMAIL PROTECTED](expr s, p)= [EMAIL PROTECTED](textext("% \framed[width=1.5cm,align=right,frame=off,autowidth=force,strut=on]{" & s & "}"),p) enddef ; vardef [EMAIL PROTECTED](expr s, p)= [EMAIL PROTECTED](textext("% \framed[align=middle,frame=off,autowidth=force,strut=on]{" & s & "}"),p) enddef ; picture p ; p := dashpattern(on 1mm off 1mm) ; \stopMPinclusions \startstaticMPfigure{square} u := 1.4cm; z[1] = origin ; z[2] = (0,5u) ; z[3] = (5u,5u) ; z[4] = (5u,0) ; z[5] = (2u,1.25u) ; z[6] = (2u,6.25u) ; z[7] = (7u,6.25u) ; z[8] = (7u,1.25u) ; z[9] = (2u,5u) ; z[10] = (5u,1.25u) ; z[11] = (2.5u,0) ; z[12] = (-.17u,1.2u) ; z[13] = (1u,0.15u) ; drawoptions(withcolor .625red withpen pencircle scaled 0.4pt) ; draw (z[1] -- z[2] -- z[3] -- z[4] -- cycle) ; draw (z[6] -- z[7]) ; draw (z[7] -- z[8]) ; draw (z[6] -- z[9]) ; draw (z[10] -- z[8]) ; draw (z[2] -- z[6]) ; draw (z[3] -- z[7]) ; draw (z[4] -- z[8]) ; drawoptions(withcolor .625red dashed p withpen pencircle scaled 0.4pt) ; draw (z[1] -- z[5]) ; draw (z[9] -- z[5]) ; draw (z[5] -- z[10]) ; drawoptions(withcolor black) ; LABELL.llft("(0,0,0,0) Light Condensed Small Sans~Serif", z[1]) ; LABELL.llft("(0,1,0,0) Light Extended Small Sans~Serif", z[2]) ; LABELR.lrt ("(1,1,0,0) Bold Extended Small Sans~Serif", z[3]) ; LABELR.lrt ("(1,0,0,0) Bold Condensed Small Sans~Serif", z[4]) ; LABELR.urt("(0,0,1,0) Light Condensed Large Sans~Serif", z[5]) ; LABELR.urt("(0,1,1,0) Light Extended Large Sans~Serif", z[6]) ; LABELR.urt("(1,1,1,0) Bold Extended Large Sans~Serif", z[7]) ; LABELR.urt("(1,0,1,0) Bold Condensed Large Sans~Serif", z[8]) ; LABELM.bot ("\AXIS{x}{1}{Weight}", z[11]); picture p; p := textext("\framed[align=middle,frame=off,autowidth=force,strut=on]% {\AXIS{y}{2}{Width}}"); p := p rotatedaround (z[12], 90) ; label.top(p,z[12]); picture p; p := textext("\AXIS{z}{3}{Optical Size}"); p := p rotatedaround (z[13], 32.005) ; % inv tan(1.5/2) label.top(p,z[13]); currentpicture := currentpicture scaled 0.9 ; \stopstaticMPfigure \startstaticMPfigure{2squares} u := 0.7cm; z[1] = origin ; z[2] = (0,5u) ; z[3] = (5u,5u) ; z[4] = (5u,0) ; z[5] = (2u,1.25u) ; z[6] = (2u,6.25u) ; z[7] = (7u,6.25u) ; z[8] = (7u,1.25u) ; z[11] = (10u,-2.5u) ; z[12] = (10u,2.5u) ; z[13] = (15u,2.5u) ; z[14] = (15u,-2.5u) ; z[15] = (12u,-1.25u) ; z[16] = (12u,3.75u) ; z[17] = (17u,3.75u) ; z[18] = (17u,-1.25u) ; z[19] = (3.125u,3.125u) ; z[20] = (13.125u,0.625u) ; z[21] = (5u,-1.25u) ; drawoptions(withcolor .625red withpen pencircle scaled 0.4pt) ; draw (z[1] -- z[2] -- z[3] -- z[4] -- cycle) ; draw (z[5] -- z[6] -- z[7] -- z[8] -- cycle) ; draw (z[1] -- z[5]) ; draw (z[2] -- z[6]) ; draw (z[3] -- z[7]) ; draw (z[4] -- z[8]) ; draw (z[11] -- z[12] -- z[13] -- z[14] -- cycle) ; draw (z[15] -- z[16] -- z[17] -- z[18] -- cycle) ; draw (z[11] -- z[15]) ; draw (z[12] -- z[16]) ; draw (z[13] -- z[17]) ; draw (z[14] -- z[18]) ; % map square to square drawoptions(withcolor .625red dashed p withpen pencircle scaled 0.4pt) ; draw (z[1] -- z[11]) ; draw (z[2] -- z[12]) ; draw (z[3] -- z[13]) ; draw (z[4] -- z[14]) ; draw (z[5] -- z[15]) ; draw (z[6] -- z[16]) ; draw (z[7] -- z[17]) ; draw (z[8] -- z[18]) ; % labels drawoptions(withcolor black) ; label (textext("Sans Serif"),z[19]) ; label (textext("Serif"),z[20]) ; picture p; p := textext("\AXIS{a}{4}{Serif}"); p := p rotatedaround (z[21], -14.036) ; label.bot(p,z[21]); currentpicture := currentpicture scaled 0.9 ; \stopstaticMPfigure \starttext \midaligned{\usestaticMPfigure[square]} \blank[2*big] \midaligned{\usestaticMPfigure[2squares]} \stoptext ===================================== -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context