ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* couple of metafun questions
@ 2006-08-02 10:25 Thomas A. Schmitz
  2006-08-02 21:56 ` Mojca Miklavec
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas A. Schmitz @ 2006-08-02 10:25 UTC (permalink / raw)


Hi all,

I'm experimenting with some metafun code and positional graphics to  
produce a nice illustration for an article. There's some basic  
questions I haven't been able to solve (and I remember that I  
couldn't solve them before but found workarounds, but this time it  
looks like I'm stuck):

1. Is it possible to have a MPpositiongraphics anchored to more than  
two positions? Like
draw position1 -- position2 .. position3 ?



2. Related to 1.: Is it right that you can't anchor more than 1  
MPpositiongraphic to one anchor? If I have:

drawsomething position1 -- position2

I can't then say

drawsomething position1 .. position3

but must work around by reversing

drawsomething position3 .. position1



3. Is it possible to get a line/arrow dashed in two different colors,  
like red and blue?

Sorry if these are silly questions, but I just dabble into metafun!

Thanks, and best

Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: couple of metafun questions
  2006-08-02 10:25 couple of metafun questions Thomas A. Schmitz
@ 2006-08-02 21:56 ` Mojca Miklavec
  2006-08-03  9:38   ` Thomas A. Schmitz
  0 siblings, 1 reply; 3+ messages in thread
From: Mojca Miklavec @ 2006-08-02 21:56 UTC (permalink / raw)


On 8/2/06, Thomas A. Schmitz wrote:
>
> 3. Is it possible to get a line/arrow dashed in two different colors,
> like red and blue?

Just out of curiosity I tried the following:

picture dp;
draw dashpattern(on 2 off 6) scaled 5pt withcolor blue;
draw dashpattern(off 4 on 2 off 2) scaled 5pt withcolor red;
dp := currentpicture;

draw origin--(5cm,0) dashed dp;

But of course "! Picture is too complicated to use as a dash pattern."
So you have to draw the path twice with different color and pattern
(you can write a macro for it of course if you need it often).

beginfig(1);
	pickup pencircle scaled 2pt;
	picture dp[];
	dp[1] := dashpattern(on 2 off 6) scaled 3pt;
	dp[2] := dashpattern(off 4 on 2 off 2) scaled 3pt;

	path p;	p := (origin .. (2,1) .. (3,-1) .. (5,0)) scaled 3cm;

	draw p dashed dp[1] withcolor blue;
	draw p dashed dp[2] withcolor red;
endfig;
end.

Mojca

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: couple of metafun questions
  2006-08-02 21:56 ` Mojca Miklavec
@ 2006-08-03  9:38   ` Thomas A. Schmitz
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas A. Schmitz @ 2006-08-03  9:38 UTC (permalink / raw)



On Aug 2, 2006, at 11:56 PM, Mojca Miklavec wrote:

> So you have to draw the path twice with different color and pattern
> (you can write a macro for it of course if you need it often).
>
> beginfig(1);
> 	pickup pencircle scaled 2pt;
> 	picture dp[];
> 	dp[1] := dashpattern(on 2 off 6) scaled 3pt;
> 	dp[2] := dashpattern(off 4 on 2 off 2) scaled 3pt;
>
> 	path p;	p := (origin .. (2,1) .. (3,-1) .. (5,0)) scaled 3cm;
>
> 	draw p dashed dp[1] withcolor blue;
> 	draw p dashed dp[2] withcolor red;
> endfig;
> end.
>
> Mojca


Mojca,

thanks so much, this works and does exactly what I want! For the rest  
of my questions: I've decided to go for an embedded staticMPfigure  
instead of MPpositiongraphic, so I can manage. But I'd still be  
curious if these things are possible or not. Anyways, thanks a lot!

Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-03  9:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-02 10:25 couple of metafun questions Thomas A. Schmitz
2006-08-02 21:56 ` Mojca Miklavec
2006-08-03  9:38   ` Thomas A. Schmitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).