Re: Problem with showing paths
luigi scarso <[email protected]> Fri, 21 Jan 2022 09:20:33 +0100
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <CAG5iGsC93ONk71BbDUHtqGt7e_8o2XpAXFkcs1qxAZV9P5Nauw@mail.gmail.com> |
On Fri, Jan 21, 2022 at 8:43 AM Laurence Finston <[email protected]> wrote: > For a particular application, I'm calling MP from within a program via a > pipe and I want to read the output and use it for setting variables in my > application. The intention is to use "point x of <path>" to take a path of > length n and convert it into an equivalent path of length n*m where m is > some whole number > 1 (within reason). > > The problem is the way the lines in the output of "show" are broken: The > lines are fairly short (max. 80 characters, including the newline) and the > x- and y-coordinates of the points can be broken across two lines, which > makes parsing unnecessarily difficult. yes, it is a "feature". We have to deal with it. > > It would also be nice to limit the number of decimal places for the > coordinates, by rounding or even by truncating. > > not with "double" but with "decimal" and "binary" we have numberprecision: if numbersystem="decimal": numberprecision:=6; fi if numbersystem="binary": numberprecision:=6; fi decimal and binary are slower than double, btw. As a workaround, I've written a macro to write the data I need to a file > (see attachment), but it would be nicer if "show" could be used instead. > > I think this is the right way, not a workaround: write your data to a file , post-process the file with, for example, perl. -- luigi -- http://tug.org/metapost/