hi i have the following metapost picture: beginfig(2); path c; pair A, B; c := fullcircle scaled 2 cm; A := (origin--(3cm,2cm)) intersectionpoint subpath (0,2) of c; B := (origin--(-5cm,1cm)) intersectionpoint subpath (2,4) of c; draw c; draw origin--B; draw origin--A; endfig; how can I cut the the part of the path c between A and B, so that the result is like a cheese :) i made: path t; t := saucer cutafter A; c := c cutbefore B; now c and t is that what i want, but i it possible to cominte these two paths to one path. I think there is a more elegant way to do that...somethink like "subpath (B,A) of c" thanks for help severin -- +++ GMX - die erste Adresse für Mail, Message, More! +++ Getestet von Stiftung Warentest: GMX FreeMail (GUT), GMX ProMail (GUT) (Heft 9/03 - 23 e-mail-Tarife: 6 gut, 12 befriedigend, 5 ausreichend) Jetzt selbst kostenlos testen: http://www.gmx.net
thanks for your answer it works, but only with a "normal" circle. if the circle is xyscaled the same thing seems to bee much more complicate... here is the mp-code once again: beginfig(2); path c; pair A, B; c := fullcircle scaled 2 cm xyscaled(1.3,.8); A := (origin--(3cm,2cm)) intersectionpoint subpath (0,2) of c; B := (origin--(-5cm,1cm)) intersectionpoint subpath (2,4) of c; draw c; draw origin--B; draw origin--A; endfig; how can i clip the part of the path c between A and B in this case?? thanks for help severin
On Sun, 21 Sep 2003 21:24:04 +0200 (MEST) Severin Obertuefer
wrote: how can I cut the the part of the path c between A and B, so that the result is like a cheese :)
path cheese ; cheese := c rotated angle B ; cheese := cheese cutafter (origin--A) ;
Jens _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- +++ GMX - die erste Adresse für Mail, Message, More! +++ Getestet von Stiftung Warentest: GMX FreeMail (GUT), GMX ProMail (GUT) (Heft 9/03 - 23 e-mail-Tarife: 6 gut, 12 befriedigend, 5 ausreichend) Jetzt selbst kostenlos testen: http://www.gmx.net
On Mon, 22 Sep 2003 13:37:47 +0200 (MEST)
"Severin Obertuefer"
it works, but only with a "normal" circle. if the circle is xyscaled the same thing seems to bee much more complicate... here is the mp-code once again:
beginfig(2); path c; pair A, B; c := fullcircle scaled 2 cm xyscaled(1.3,.8); A := (origin--(3cm,2cm)) intersectionpoint subpath (0,2) of c; B := (origin--(-5cm,1cm)) intersectionpoint subpath (2,4) of c; draw c; draw origin--B; draw origin--A;
draw (c cutbefore B)--(c cutafter A) withcolor red ;
endfig;
Jens
that works!!
thanks for the hint
severin
----- Original Message -----
From: "Jens-Uwe Morawski"
On Mon, 22 Sep 2003 13:37:47 +0200 (MEST) "Severin Obertuefer"
wrote: it works, but only with a "normal" circle. if the circle is xyscaled the same thing seems to bee much more complicate... here is the mp-code once again:
beginfig(2); path c; pair A, B; c := fullcircle scaled 2 cm xyscaled(1.3,.8); A := (origin--(3cm,2cm)) intersectionpoint subpath (0,2) of c; B := (origin--(-5cm,1cm)) intersectionpoint subpath (2,4) of c; draw c; draw origin--B; draw origin--A;
draw (c cutbefore B)--(c cutafter A) withcolor red ;
endfig;
Jens _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
"Severin Obertuefer"
thanks for your answer
it works, but only with a "normal" circle. if the circle is xyscaled the same thing seems to bee much more complicate... here is the mp-code once again:
beginfig(2); path c; pair A, B; c := fullcircle scaled 2 cm xyscaled(1.3,.8); A := (origin--(3cm,2cm)) intersectionpoint subpath (0,2) of c; B := (origin--(-5cm,1cm)) intersectionpoint subpath (2,4) of c; draw c; draw origin--B; draw origin--A; endfig;
how can i clip the part of the path c between A and B in this case??
Isn't it easier to use arctime and the specify A and B as lengths instead of points? For example: A := 1cm; B := 1cm; draw subpath (arctime A of c, arctime (arclength c) - B of c) of c; The code is not tested. Regards, -- Emil Hedevang Lohse http://home.imf.au.dk/emil/ Alle spørgsmål er lige dumme. Og spørgsmålet "Kan ænder flyve?" er ikke dumt.
On Mon, 22 Sep 2003 13:37:47 +0200 (MEST)
"Severin Obertuefer"
it works, but only with a "normal" circle. if the circle is xyscaled the same thing seems to bee much more complicate...
additionally, a more general solution: %%% \setupoutput[pdftex] \setupcolors[state=start] \startMPinclusions vardef cutbetween (expr p,a,b)= if (xpart (p intersectiontimes a))> (xpart (p intersectiontimes b)): ((p cutbefore b) cutafter a) else: (p cutbefore b)--(p cutafter a) fi enddef; \stopMPinclusions \starttext \startMPpage save c, A, B ; path c, A, B; A := (origin--(3cm,2cm)) ; B := (origin--(-5cm,1cm)) ; draw B ; draw A ; c := fullcircle scaled 2cm xyscaled(1.3,.8) ; clip currentpicture to c ; draw c withpen pencircle scaled 1.4pt withcolor .7white ; drawarrow cutbetween(c,B,A) withcolor .7green ; drawarrow cutbetween(c,A,B) withcolor green ; c := reverse c xyscaled (0.3,0.9) ; draw c withpen pencircle scaled 1.4pt withcolor .7white ; drawarrow cutbetween(c,B,A) withcolor .7red ; drawarrow cutbetween(c,A,B) withcolor red ; \stopMPpage \stoptext %%% Jens
participants (4)
-
Emil Hedevang Lohse
-
Jens-Uwe Morawski
-
Severin Obertuefer
-
Severin Obertüfer