Am 06.10.2013 00:37, schrieb Hans Hagen: > 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 >
Thanks for the explanation. I think I have understood the scheme (but I might be wrong, because this doesn't help me with my example). Where is the starting point['20 20'] in the returned example path? Same is true for the first control point ['20 190.34']. Either I'm missing something, or the returned path data is incomplete. Peter ___________________________________________________________________________________ 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 ___________________________________________________________________________________