On 10/5/2021 4:58 PM, Thomas A. Schmitz via ntg-context wrote:

Hi all,

I hope the following example is not too convoluted:

\useMPlibrary [txt]

\define\EmpArrow{\getscaledglyph{1.6}{name:dejavumath}{\char"2B05}}

\setupbodyfont [ss,9pt]

\starttext

\startuseMPgraphic{empedocles}
%numeric a ; a = 6.56cm ;
%numeric b ; b = 1.1 ;
save S; path S[] ;
S[1] = fullcircle scaled 8cm rotated 306 ;
S[2] = S[1] scaled 1.1 ;
S[3] = S[1] scaled 1.23 ;
S[4] = S[1] scaled 1.3 ;
S[5] = S[1] scaled 1.43 ;
S[6] = S[1] scaled 1.5 ;
S[7] = S[1] scaled 1.6 ;
z[1] = point 1 along S[7] ;
z[2] = point 1 along S[1] ;
z[3] = point 0.1 along S[7] ;
z[4] = point 0.1 along S[1] ;
z[5] = point 0.2 along S[7] ;
z[6] = point 0.2 along S[1] ;
z[7] = point 0.3 along S[7] ;
z[8] = point 0.3 along S[1] ;
z[9] = point 0.4 along S[7] ;
z[10] = point 0.4 along S[1] ;
z[11] = point 0.5 along S[7] ;
z[12] = point 0.5 along S[1] ;
z[13] = point 0.6 along S[7] ;
z[14] = point 0.6 along S[1] ;
z[15] = point 0.7 along S[7] ;
z[16] = point 0.7 along S[1] ;
z[17] = point 0.8 along S[7] ;
z[18] = point 0.8 along S[1] ;
S[8] = z[1] -- z[2] ;
S[9] = z[3] -- z[4] ;
S[10] = z[5] -- z[6] ;
S[11] = z[7] -- z[8] ;
S[12] = z[9] -- z[10] ;
S[13] = z[11] -- z[12] ;
S[14] = z[13] -- z[14] ;
S[15] = z[15] -- z[16] ;
S[16] = z[17] -- z[18] ;
z[19] = S[3] intersection_point S[8] ;
z[20] = S[3] intersection_point S[16] ;
S[18] = S[3] cutbefore z[20] cutafter z[19] ;
z[21] = S[5] intersection_point S[8] ;
z[22] = S[5] intersection_point S[16] ;
S[19] = S[5] cutbefore z[22] cutafter z[21] ;
z[23] = S[12] intersection_point S[3] ;
S[20] = S[3] cutbefore z[20] cutafter z[23] ;
for i = 1 upto 16:
     draw S[i] withcolor 0.7white ;
endfor ;
draw z[23] -- z[20] withcolor red ;
draw S[20] withcolor blue ;
label.bot(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 20.000 = 0}"), z[10]) ; label.llft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 2.000}"), z[8]) ; label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 4.000}"), z[6]) ; label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 6.000}"), z[4]) ; label.ulft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 8.000}"), z[2]) ; label.urt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 12.000}"), z[18]) ; label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 14.000}"), z[16]) ; label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 16.000}"), z[14]) ; label.lrt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 18.000}"), z[12]) ; draw followtext(S[18], "\strut\hbox to 2em{\EmpArrow}\hskip2em RUHEPAUSE\hskip4em\strut") ; draw followtext(S[19], "\strut\hbox to 2em{\EmpArrow}EINHEIT (SPHAIROS)\hskip2em\strut") ;
\stopuseMPgraphic

\useMPgraphic{empedocles}

\stoptext

I have a big problem and some smaller questions, for those who are better at math and at metafun than I am:

1. The big problem: for the next followtext, I need the circular arc between points z[23] and z[20]. But however I place the cutbefore and cutafter, I don't get the proper part of the circle. I'm looking at the right intersection points, as the red line shows, but the blue line shows that I'm not getting the right section of the circle. How can I get this section into the path S[20]?

2. Math... :-) Is there a better way to define three circles that are at exactly the same distance than my naive "scaled 1.3" and "scaled 1.5"?

3. TeX and metafun: is there a better way to have the followtext exactly centered between the two circles rather than just fiddle with the scale factor?

4. Or is there a better approach to my problem altogether? I'm trying to reproduce an illustration from a book, so I'm very open to suggestions here. I looked at the example in the metafun manual chapter 10.4, but I'm not sure if using an overlay and multiple \followtokens would be easier. Especially since there is the scary remark "This definition is not the right one!" in this chapter without any further explanation.

I hope you all had a wonderful meeting last week. I was sad I couldn't come, I was in Paris for a conference, the first after 18 months, so I couldn't skip this one.
Because you know how to rotate and scale:

\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p              withpen pencircle scaled 1mm withcolor red ;
draw        point 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q              withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p              withpen pencircle scaled 1mm withcolor cyan ;
draw        point 0 of p withpen pencircle scaled 1mm withcolor magenta ;
q := p cutafter (point .3 along p) ;
q := q rotated 120 ;
drawarrow q              withpen pencircle scaled .5mm withcolor yellow ;
draw followtext(q, "\strut TEXT TWO") ;

% the real deal: best make a macro for this

p := fullcircle scaled 6cm ;
draw        point 0 of p withpen pencircle scaled 5mm withcolor blue ;
drawarrow p              withpen pencircle scaled 1mm withcolor red ;
a := (point eps of p) rotated 45 ;
draw a withpen pencircle scaled 2mm;
q := p cutafter a ;
q := q rotated 20 ;
drawarrow q              withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT TWO") ;

\stopuseMPgraphic

\useMPgraphic{empedocless}

So, just always start at point 0 and then just rotate the cutof piece over the angle that you want. The eps in the last case makes that we actually have a cut off piece (zero fails here).

So ... solution 4. best suits non math gurus (like you and me).

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to