I assume there's no "--" between "reverse" and "fullcircle scaled 1cm" :)
Well, my example is too simple. Actually, I was trying to draw a
treble clef, and when there're too many intersection points (caused
by the -- operator to join every path together) the output is not
so good, kind of like an even-odd-fill.
Anyway, I wrote a macro trying to handle it, but it's still weird for
me.
===================================================
def getridof(expr mypath) =
save p, q, r, l, Oringin, Mode , MagicPoint ;
pair Oringin ; Oringin := center mypath ;
pair MagicPoint ;
numeric Mode ; Mode := 0 ;
path p[], q[], l ;
q0 := mypath ;
q1 := llcorner currentpicture -- lrcorner currentpicture ;
q2 := lrcorner currentpicture -- urcorner currentpicture ;
q3 := urcorner currentpicture -- ulcorner currentpicture ;
q4 := ulcorner currentpicture -- llcorner currentpicture ;
for i=1 upto 4 :
q[i+4] := q[i] ;
endfor
q11 := llcorner currentpicture -- Oringin ;
q12 := lrcorner currentpicture -- Oringin ;
q13 := urcorner currentpicture -- Oringin ;
q14 := ulcorner currentpicture -- Oringin ;
for i=1 upto 4 :
p[i] := q[i] for j=1 upto 3 : -- q[i+j] endfor ;
endfor
if (((llcorner currentpicture -- Oringin) intersectiontimes mypath)
= (-1,-1)) :
if (((lrcorner currentpicture -- Oringin) intersectiontimes
mypath) = (-1,-1)) :
if (((urcorner currentpicture -- Oringin) intersectiontimes
mypath) = (-1,-1)) :
Mode := 4 ;
else :
Mode := 3 ;
fi
else :
Mode := 2 ;
fi
else :
Mode := 1 ;
fi
l = q[10+Mode] cutafter mypath ;
MagicPoint = point length(l) of l ;
p0 := p[Mode]--l--(q0 cutbefore MagicPoint)--(q0 cutafter
MagicPoint)--(reverse l)--cycle ;
clip currentpicture to p0 ;
draw p0 withcolor cyan ;
enddef ;
===================================================
If I use
===================================================
path p[] ;
p1 = fullcircle scaled 10 cm ;
p2 = reverse fullcircle scaled 1cm shifted (2cm,2cm) ;
p3 = reverse fullcircle scaled 1.5cm shifted (2cm,-2cm) ;
p4 = reverse fullcircle scaled 1.75cm shifted (-2cm,2cm) ;
fill p1 ;
getridof(p2) ;
getridof(p3) ;
getridof(p4) ;
===================================================
then only p2 was cut off, you can change the order and only the first path
can be handled.
If I use pa[] as the path variables rather than p[], that would be fine.
I don't know why, I mean I've used the "save" operator.
On Wed, Jun 24, 2009 at 4:21 PM, Wolfgang
Schuster
fill fullcircle scaled 2cm -- reverse -- fullcircle scaled 1cm -- cycle ;
Wolfgang
___________________________________________________________________________________ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------