
\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 tiene una opción llamada crosshatch dots
, Asymptote tiene la misma que TikZ hatch(1.5mm,dotted+...)
. Esto significa quedotted in line
¡Como veo, la imagen de salida no es muy buena! Entonces, ¿cómo puedo agregar dotted in line
vlines, hlines, crosshatch,... en PSTricks?
Estoy dibujando esta imagen con asíntota pero tengo el siguiente error:
// 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));
Mira add("fillB",hatch(1.5mm,dotted+blue+1.5bp));//
, si reemplazo 1,5 mm por 1,2, obtengo el mismo resultado; si reemplazo 1,5 mm por 1,75 mm o 2 mm, obtengo el resultado real de la siguiente manera:
Entonces, ¿por qué son diferentes? Es la función en asíntota o...
Respuesta1
Sobre el extraño comportamiento de la Asíntota
Parece que hay un error con la asíntota. Creo que es un problema de periodicidad bajo algunas condiciones entre el parámetro de hatch
y dotted
. El comportamiento es recortar una línea de puntos y luego colocar en mosaico y recortar para agregar el patrón. Pero no sé por qué ese problema no ocurre con line
un patrón simple. Aquí una solución. Es suficiente definir un nuevo bolígrafo como dotted
bolígrafo pero añadiendo un 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));
y el resultado
agrego un problemahttps://github.com/vectorgraphics/asymptote/issues/133
Respuesta2
Para utilizar un lápiz punteado en un patrón de relleno PostScript, es necesario desactivar la escala automática de Asíntota al ancho del lápiz y el ajuste de la longitud de la línea:
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"));