[metapost] polygonal pen bugs

Boguslaw Jackowski jacko at bop.com.pl
Wed Jun 19 13:10:50 CEST 2013


A "pendant" to Stephan Hennig's report: slightly modified
Stephan's example tested against the newest MP (1.803;
the same results have been obtained for both Windows and Linux)
with and without double precision (suffixes
"scaled" and "double", respectively).

Cheers -- Jacko

-- 
BOP s. c.
ul. Bora-Komorowskiego 24, 80-377 Gdansk, Poland
tel./fax (+48 58) 553 46 59
bop at bop.com.pl, http://www.bop.com.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqx-1.803-scaled-1.pdf
Type: application/pdf
Size: 4560 bytes
Desc: 
URL: <http://tug.org/pipermail/metapost/attachments/20130619/2b0c217a/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqx-1.803-double-1.pdf
Type: application/pdf
Size: 4584 bytes
Desc: 
URL: <http://tug.org/pipermail/metapost/attachments/20130619/2b0c217a/attachment-0001.pdf>
-------------- next part --------------
outputtemplate := "%j-" & mpversion & if string numbersystem: "-" & numbersystem & fi "-%c.mps";

%%% setup test paths
path p[];
p1 := (0,0){up}..{down}(100,0);% half circle
p2 := ((0,0)--(100,0)) shifted 50down;% horizontal line
p3 := (origin..(100bp,0){up}..cycle) shifted 150down;% loop
p4 := (origin..(100bp,0){down}..cycle) shifted 300down;% loop

%%% captions describing linecap
string lncap[];
lncap[butt] := "butt";
lncap[rounded] := "rounded";
lncap[squared] := "squared";

%%% polygonal test pen
pen mypen;
mypen := pensquare scaled 10;

beginfig(1);
  numeric i;
  pickup mypen;
  i := 0;
  for cap = butt, rounded, squared:
    % linecap
    linecap := cap;
    % draw paths
    draw p1 shifted (150i*right);
    draw p2 shifted (150i*right);
    draw p3 shifted (150i*right);
    draw p4 shifted (150i*right);
    %draw label
    label.bot(lncap[cap], origin shifted (150i, 100));
    i := i + 1;
  endfor
endfig;
end


More information about the metapost mailing list