[metapost] MetaPost 1.901 announcement

Daniel H. Luecking luecking at uark.edu
Fri Apr 11 21:11:18 CEST 2014


Taco wrote:

>to confuse matters even more, a single combined helper function is 
>used for both arclength and arctime, where a variable set to a fake 
>‘infinity’ value is used to differentiate the use cases. 

The combining of arctime and arclength in a single function is actually 
very natural. The only way to compute the time when a given length is 
reached is to compute lengths of subpaths and home in on the time. 
A workable, but very inefficient approach would be to call the 
arclength function N times to get the arctime to accuracy 2^{-N}.

But since the arclength recursion is always performed first on the first 
segment of a subdivided path, the code for each segment has access to 
the arclength up the beginning of the current sub-segment. Thus, one 
need only call arclength once, stopping it when it is determined that the 
target length has been reached to sufficient accuracy, and returning the 
current time.

I had to do something like that in metafont code and ended up 
(re)discovering this for myself.

Dan
-- 
Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
Fayetteville, Arkansas




More information about the metapost mailing list