Dear knights,

I spent a few hours today with MetaPost and MetaFun, my first serious stab at Meta in many years, so I'm a virtual newbie (used PSTricks back in the LaTeX days). I am trying to basically duplicate the attached pdf graphic and need help with the following:

1. This code is pretty naive; how can I make it more efficient? Eg, can I make a global "scaled 1cm" declaration instead of repeating it so many times?

2. ConTeXt's alignment mechanism apparently does not work in MetaPost (alignment is commented); is there a workaround? ragged left needed for some labels.

3. What is the most efficient way to get labels to follow the diagonals as in the attached pdf?

Any tips/trick will be appreciated!

Best
Idris
====================================
% output=pdf interface=en

\setupcolors[state=start]

\starttext

\noheaderandfooterlines

\startuseMPgraphic{square}

picture p ; p := dashpattern(on 1mm off 1mm) ;

label bot(btex %\hbox to 1.5cm
                {%\startalignment[left]
                \vbox{\hsize=1.2cm
                \ssxx\setupinterlinespace
                (0,0,0,0) \crlf
                Light \crlf
                Condensed
                Small \crlf
                Sans~Serif}
                %\stopalignment
                }
                etex, (-1.2cm,0)) ;

draw (origin -- (0,5) -- (5,5) -- (5,0) -- cycle)
scaled 1cm withcolor .625red ;

%draw ((2,1) -- (2,6) -- (7,6) -- (7,1) -- cycle)
%scaled 1cm withcolor .625red ;

draw ((2,6) -- (7,6))
scaled 1cm withcolor .625red ;

draw ((7,6) -- (7,1))
scaled 1cm withcolor .625red ;

draw ((2,6) -- (2,5))
scaled 1cm withcolor .625red ;

draw ((2,5) -- (2,1))
scaled 1cm withcolor .625red dashed p withpen pencircle scaled 0.4pt;

draw ((2,1) -- (5,1))
scaled 1cm withcolor .625red dashed p withpen pencircle scaled 0.4pt;

draw ((5,1) -- (7,1))
scaled 1cm withcolor .625red ;

draw ((0,5) -- (2,6))
scaled 1cm withcolor .625red ;

draw ((5,5) -- (7,6))
scaled 1cm withcolor .625red ;

draw ((5,0) -- (7,1))
scaled 1cm withcolor .625red ;

draw (origin -- (2,1 ))
scaled 1cm withcolor .625red dashed p withpen pencircle scaled 0.4pt;

\stopuseMPgraphic

\startuseMPgraphic{2squares}

draw (origin -- (0,5) -- (5,5) -- (5,0) -- cycle)
scaled 1cm withcolor .625red ;

draw ((2,1) -- (2,6) -- (7,6) -- (7,1) -- cycle)
scaled 1cm withcolor .625red ;

draw ((0,5) -- (2,6))
scaled 1cm withcolor .625red ;

draw ((5,5) -- (7,6))
scaled 1cm withcolor .625red ;

draw ((5,0) -- (7,1))
scaled 1cm withcolor .625red ;

draw (origin -- (2,1 ))
scaled 1cm withcolor .625red ;

draw ((10,0) -- (10,-5) -- (15,-5) -- (15,0) -- cycle)
scaled 1cm withcolor .625red ;

draw ((12,1) -- (12,-4) -- (17,-4) -- (17,1) -- cycle)
scaled 1cm withcolor .625red ;

draw ((10,0) -- (12,1))
scaled 1cm withcolor .625red ;

draw ((10,-5) -- (12,-4))
scaled 1cm withcolor .625red ;

draw ((15,-5) -- (17,-4))
scaled 1cm withcolor .625red ;

draw ((15,0) -- (17,1 ))
scaled 1cm withcolor .625red ;

% map square to square

picture p ; p := dashpattern(on 1mm off 1mm) ;

draw ((0,5) -- (10,0))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((2,6) -- (12,1))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((0,0) -- (10,-5))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((2,1) -- (12,-4))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((5,5) -- (15,0))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((7,6) -- (17,1))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((5,0) -- (15,-5))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((7,1) -- (17,-4))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

\stopuseMPgraphic

\midaligned{\useMPgraphic{square}}

\hbox{}\blank[5*big]

\useMPgraphic{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/

Attachment: mm_design.pdf
Description: Adobe PDF document

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to