vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
556 stars 93 forks source link

Why the width of the green line of pattern named "c" is greater than "b" although all of them are 0.5bp? #241

Closed justonlyasy closed 2 years ago

justonlyasy commented 3 years ago

My code,

settings.outformat="pdf";
import patterns;
picture sixpointedstars(pen fillpen=currentpen,pen drawpen=currentpen)
{
picture tiling;
path g=polygon(6);
pair[] A;
for (int i=0;i<6;++i) A.push(reflect(point(g,i),point(g,i+1))*(0,0));
filldraw(tiling,point(g,0)--A[0]--point(g,1)--A[1]--point(g,2)--A[2]--
point(g,3)--A[3]--point(g,4)--A[4]--point(g,5)--A[5]--cycle,fillpen,drawpen);
return tiling;
}

size(10cm);

add("b",scale(8)*sixpointedstars(red,green+0.5bp),(3,3),(3,3));
add("c",scale(8)*sixpointedstars(red,green+0.5bp),(1,1),(1,1));

filldraw(unitcircle,pattern("b"),black+0.5bp);
filldraw(shift(3,0)*scale(2)*shift(-0.5,-0.5)*unitsquare,pattern("b"),black+0.5bp);

filldraw(shift(0,-3)*unitcircle,pattern("c"),black+0.5bp);
filldraw(shift(0,-3)*shift(3,0)*scale(2)*shift(-0.5,-0.5)*unitsquare,pattern("c"),black+0.5bp);

shipout(bbox(2mm,Fill(white)));

How to get the same width of the green line for both?

johncbowman commented 2 years ago

For the record, here's a more minimal example that shows something is definitely wrong with patterns (using gs 9.55.0):

settings.outformat="pdf";
import patterns;
picture sixpointedstars(pen drawpen=currentpen)
{
picture tiling;
path g=polygon(6);
pair[] A;
for(int i=0; i<6; ++i) A.push(reflect(point(g,i),point(g,i+1))*(0,0));
draw(tiling,point(g,0)--A[0]--point(g,1)--A[1]--point(g,2)--A[2]--
point(g,3)--A[3]--point(g,4)--A[4]--point(g,5)--A[5]--cycle,drawpen);
return tiling;
}

add("b",sixpointedstars(green));
add("c",sixpointedstars(green));

path g=scale(20)*shift(-0.5,-0.5)*unitsquare;

filldraw(shift(30,0)*g,pattern("b"));
filldraw(g,pattern("c"));