
\documentclass[border=10pt,pstricks,12pt]{standalone}
\begin{document}
\begin{pspicture}[showgrid](0,0)(3,3)
\pscircle*[linecolor=gray!20](1.5,1.5){1.5}
\pscircle[fillstyle=crosshatch*](1,2){1}
\pscircle[hatchcolor=gray,hatchsep=5pt,hatchwidth=.5pt,fillstyle=dots*](2,1){1}
\end{pspicture}
\end{document}
TikZ에는 이라는 옵션이 있고 crosshatch dots
Asymptote에는 TikZ와 동일합니다 hatch(1.5mm,dotted+...)
. 그것은 다음을 의미합니다dotted in line
보시다시피 출력 이미지가 별로 좋지 않습니다! 그렇다면 dotted in line
PSTricks에 vlines,hlines,crosshatch 등을 추가하려면 어떻게 해야 합니까 ?
Asymptote로 이 그림을 그리고 있는데 다음과 같은 실수가 있습니다.
// asy -f pdf <name>.asy
import math;
import patterns;
unitsize(1cm);
defaultpen(1);
pair C1=(-3,0),C2=(2.5,0);
real r=4;
path EllipseA=scale(.75,.55)*circle(C1,r);
path EllipseB=scale(.5,.35)*circle(C2,r);
add("fillA",hatch(1.5mm,red));
add("AinterB",crosshatch(2mm,green));
add("fillB",hatch(1.5mm,dotted+blue+1.5bp));//
fill(EllipseA,pattern("fillA"));
fill(EllipseB,pattern("fillB"));
picture AinterB;
fill(AinterB,EllipseA,white);
fill(AinterB,EllipseA,pattern("AinterB"));
clip(AinterB,EllipseB);
add(AinterB);
draw(EllipseA^^EllipseB);
label("$C$",C1,dir(180),UnFill);
label("$D$",C2,UnFill);
label("$E$",(0,0),UnFill);
pair A=point(EllipseA,1.25),B=point(EllipseB,.5);
label("$A$",A,6N);
label("$B$",shift(.2,0)*B,6N);
label("$G$",(0,2),9N); // dot((0,1));
draw(A--shift(0,.6)*A);
draw(B--shift(.2,.7)*B);
draw(shift(-2.5,.75)*(0,1)--shift(-.5,2)*(0,1));
draw(shift(.2,0)*(0,1)--shift(0,2)*(0,1));
draw(shift(1.5,0)*(0,1)--shift(.5,2)*(0,1));
add(shift(-6,-3)*grid(10,7,1bp+dotted));
shipout(bbox(5mm,white));
add("fillB",hatch(1.5mm,dotted+blue+1.5bp));//
1.5mm를 1.2로 바꾸면 동일한 출력을 얻습니다 . 1.5mm를 1.75mm 또는 2mm로 바꾸면 다음과 같은 실제 출력이 표시됩니다.
그렇다면 왜 다른가요? 이는 점근선(Asymptote)의 함수 또는...
답변1
Asymptote의 이상한 행동에 대하여
Asymptote에 버그가 있는 것 같습니다. hatch
와 의 매개변수 사이의 어떤 조건 하에서 주기성 문제라고 생각합니다 dotted
. 동작은 점선을 클리핑한 다음 타일링 및 클리핑을 통해 패턴을 추가하는 것입니다. 그런데 왜 단순한 패턴에서는 이런 문제가 발생하지 않는지 모르겠습니다 line
. 여기에 해결 방법이 있습니다. 펜 과 같은 새 펜을 정의하는 것으로 충분 dotted
하지만 다음을 추가하면 됩니다 offset
.pen mdotted=linetype(new real[] {0,4},offset=.5);
import math;
import patterns;
unitsize(1cm);
defaultpen(1);
pair C1=(-3,0),C2=(2.5,0);
real r=4;
path EllipseA=scale(.75,.55)*circle(C1,r);
path EllipseB=scale(.5,.35)*circle(C2,r);
add("fillA",hatch(1.5mm,red));
add("AinterB",crosshatch(2mm,green));
pen mdotted=linetype(new real[] {0,4},offset=.5);
add("fillB",hatch(1.5mm,mdotted+blue+1.5bp));//
fill(EllipseA,pattern("fillA"));
fill(EllipseB,pattern("fillB"));
picture AinterB;
fill(AinterB,EllipseA,white);
fill(AinterB,EllipseA,pattern("AinterB"));
clip(AinterB,EllipseB);
add(AinterB);
draw(EllipseA^^EllipseB);
label("$C$",C1,dir(180),UnFill);
label("$D$",C2,UnFill);
label("$E$",(0,0),UnFill);
pair A=point(EllipseA,1.25),B=point(EllipseB,.5);
label("$A$",A,6N);
label("$B$",shift(.2,0)*B,6N);
label("$G$",(0,2),9N); // dot((0,1));
draw(A--shift(0,.6)*A);
draw(B--shift(.2,.7)*B);
draw(shift(-2.5,.75)*(0,1)--shift(-.5,2)*(0,1));
draw(shift(.2,0)*(0,1)--shift(0,2)*(0,1));
draw(shift(1.5,0)*(0,1)--shift(.5,2)*(0,1));
add(shift(-6,-3)*grid(10,7,1bp+dotted));
shipout(bbox(5mm,white));
그리고 그 결과
이슈 추가해요https://github.com/Vectorgraphics/asymptote/issues/133
답변2
PostScript 채우기 패턴에서 점선 펜을 사용하려면 펜 너비와 선 길이 조정에 대한 Asymptote의 자동 크기 조정을 비활성화해야 합니다.
import patterns;
unitsize(1cm);
pen dotted=linetype(new real[] {0,4},offset=1,scale=false,adjust=false);
add("fillA",hatch(1.5mm,red+1.5bp+opacity(0.5)));
add("fillB",hatch(1.5mm,blue+1.5bp+dotted));
fill(unitcircle,pattern("fillA"));
fill(unitcircle,pattern("fillB"));