From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: passvariable(); path problem
Date: Sun, 06 Oct 2013 00:37:54 +0200 [thread overview]
Message-ID: <525094C2.2030402@wxs.nl> (raw)
In-Reply-To: <525035C2.9000402@gmx.net>
On 10/5/2013 5:52 PM, Peter Rolf wrote:
> I played around with it, but I have problems to understand the format of
> the returned path.
>
> Example:
> % --------
> \setuppagenumber[state=stop]
>
> \starttext
> \nopdfcompression
>
> \startMPpage
> path p;
> p:= (20,20){up} .. {down}(200,100);
> passvariable("path",p);
> draw p ;
> \stopMPpage
>
> \ctxlua{inspect{metapost.variables["path"]}}
> \stoptext
> % -------
>
> The PDF code of the path is (mainly)
>
> 20.000000 20.000000 m
> 20.000000 190.342880 200.000000 184.016693 200.000000 100.000000 c
>
> "path" contains
>
> table={
> {
> { 200, 100, 200, 184.0167, 200, 100 },
> },
> }
>
> The end point and the second control point are the same, as in the PDF
> code. But how do I calculate the starting point and the first control
> point from the returned values?
something
local prev = nil
for i=1,#path do
local current = path[i]
if not prev then
print(current[1],current[2],"m")
else
print(prev[5],prev[6],prev[3],prev[4],current[1],current[2],"c")
end
prev = current
end
-- close last to first if needed
> And is the type of operation (line, curve,..) given by the number of
values?
by analyzing using thresholds (one can just use "c" always, as "l" is an
optimization)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2013-10-05 22:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-04 12:52 Peter Rolf
2013-10-04 14:15 ` Hans Hagen
2013-10-04 14:47 ` Peter Rolf
2013-10-04 14:59 ` Peter Rolf
2013-10-05 15:52 ` Peter Rolf
2013-10-05 22:37 ` Hans Hagen [this message]
2013-10-06 13:05 ` Peter Rolf
2013-10-06 15:06 ` Hans Hagen
2013-10-07 8:48 ` Peter Rolf
2013-10-07 9:47 ` luigi scarso
2013-10-07 10:03 ` Hans Hagen
2013-10-07 11:02 ` Peter Rolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=525094C2.2030402@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).