Thanks Mikael,
You are right, in this simple case, your solution avoid the problem, and is applicable in some of my cases (I have to rethink the code). Thanks for the proposition ! But in others cases this is not possible (I think). Imagine I wish to do a « partial moon » from the two circles in my minimal example (see bottom right of the attached pdf): |
test.pdf
Description: Adobe PDF document
newcircleA := circleA cutbefore P1 cutafter P2 .. reverse(circleB cutbefore P1 cutafter P2) .. cycle; I need 10 points to define the shape, but as my connections are duplicated, I have 12 points. The solution (I thought) would be to use the « & » operator : newcircleA := circleA cutbefore P1 cutafter P2 & reverse(circleB cutbefore P1 cutafter P2) & cycle ; But this does not work (same reason as before: "! Paths don't touch; `&' will be changed to `..'."). The compete minimal code (if somebody wants to plus with it) is here : % ——————————————————————— \startMPpage path circleA , circleB ; pair P[]; defaultscale := 0.4 ; circleA := fullcircle scaled 1in randomized 3 ; circleB := fullcircle scaled 1in randomized 3 shifted(0.3in,0.3in) ; draw circleA withcolor blue ; draw circleB withcolor red ; P[1] := circleA intersectionpoint circleB ; dotlabel.lft("$P_1$",P[1]) ; dotlabel.rt("$\blue\tfx P_0^A$",point 0 of circleA) ; P[2] := reverse(circleA) intersectionpoint circleB ; dotlabel.rt("$P_2$",P[2]) ; dotlabel.rt("$\red\tfx P_0^B$",point 0 of circleB) ; path newcircleA , newcircleB ; % newcircleA := (circleA cutbefore P1 cutafter P2 ) & (P2 -- P1) & cycle ; % previous line gives an error : % "! Paths don't touch; `&' will be changed to `..'." newcircleA := circleA cutbefore P1 cutafter P2 -- (P2 -- P1) -- cycle ; newcircleA := newcircleA xshifted 2in ; draw newcircleA withcolor darkgreen ; newcircleB := (circleB cutafter P1) -- (P1 -- P2) -- (circleB cutbefore P2 ) & cycle ; newcircleB := newcircleB xshifted 2in ; draw newcircleB withcolor black ; drawpoints newcircleA ; drawpointlabels newcircleA ; % Mikael solution newcircleA := circleA cutbefore P1 cutafter P2 -- cycle ; newcircleA := newcircleA yshifted -1.5in ; draw newcircleA withcolor darkgreen ; drawpoints newcircleA ; drawpointlabels newcircleA ; % partial moon newcircleA := circleA cutbefore P1 cutafter P2 .. reverse(circleB cutbefore P1 cutafter P2) .. cycle; % & (reverse(circleB) cutbefore P2 cutafter P1) & cycle; newcircleA := newcircleA shifted(2in,-1.5in) ; draw newcircleA withcolor magenta ; drawpoints newcircleA ; drawpointlabels newcircleA ; \stopMPpage % ——————————————————————— Thanks for any help ! Fabrice.
|
___________________________________________________________________________________ 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 ___________________________________________________________________________________