3

I've seen this post for 3D, but I cannot get this working in 2D.

Here is my code:

pair O1 = origin;
pair O2 = (1.5,0);
pair O3 = (1,-1);
pair C = (0.75,sqrt(7)/4);
pair F = (0.75,-sqrt(7)/4);
pair E = (1,0);
pair B = (0,-1);
pair D = (((1/20)*(25-2*sqrt(55))),((1/8)+(1/40)*(2*sqrt(55)-25)));
pair A = (((1/20)*(25+2*sqrt(55))),((1/8)+(1/40)*(-2*sqrt(55)-25)));

label("$C$",C,N);
label("$F$",F,E);
label("$E$",E,NE);
label("$B$",B,SW);
label("$D$",D,W);
label("$A$",A,SE);

draw(circle(O1,1));
draw(circle(O2,1));
draw(circle(O3,1));
draw(arc(O1,E,C),blue+linewidth(5));

I want to trace out a thick bold line along some of the intersections. Is there a way to do something like

draw(arc(center,coordinate1,coordinate2),linewidth(2));

to trace out a path? This is as opposed to specifying start and end angles. For instance,

draw(arc(O1,E,C),linewidth(2));
2
  • Your code is missing a size (or unitsize) operator. Add, say, size(300); in the beginning and you already have a thick blue arc EC. Or do you need something else?
    – g.kov
    Sep 13, 2013 at 2:18
  • My original code has a size operator. I only included the stuff for this venn-like diagram as there are other things going on as well. There is no arc being output, though... Sep 13, 2013 at 2:39

2 Answers 2

5

enter image description here

Yes, this is exactly the way to do it. Is this what you want?

// darcs.asy :
size(200);
// Drawing arc with coordinates in 2D in asymptote  

texpreamble("\usepackage{lmodern}");
pair O1 = (0,0);// origin;
pair O2 = (1.5,0);
pair O3 = (1,-1);
pair A = (((1/20)*(25+2*sqrt(55))),((1/8)+(1/40)*(-2*sqrt(55)-25)));
pair B = (0,-1);
pair C = (0.75,sqrt(7)/4);
pair D = (((1/20)*(25-2*sqrt(55))),((1/8)+(1/40)*(2*sqrt(55)-25)));
pair EE = (1,0);
pair F = (0.75,-sqrt(7)/4);

pen linePen=darkblue+1bp;
pen markPenA=red+3bp+opacity(0.8);
pen markPenB=green+3bp+opacity(0.8);


draw(circle(O1,1),linePen);
draw(circle(O2,1),linePen);
draw(circle(O3,1),linePen);
draw(arc(O1,EE,C),markPenA);
draw(arc(O1,C,EE),markPenB);

dot(new pair[]{A,B,C,D,EE,F},darkblue,UnFill);
label("$A$",A,SE);
label("$B$",B,SW);
label("$\,C$",C,N);
label("$D$",D,NW);
label("$E$",EE,NE);
label("$F$",F,E);

Note: names N,S,E,W,NE,NW,SE,SW predefined to be used in labels placements, so it is better to avoid redefinition and use, for example, EE instead of E.

2
  • If we were to add an arrow to the arcs, it would make them go counterclockwise. How can we make the arcs go clockwise?
    – WwW
    Dec 20, 2020 at 21:48
  • 1
    @Ashmit Dutta: Key words: BeginArrow, EndArrow, MidArrow, reverse, CW,CCW.
    – g.kov
    Dec 21, 2020 at 4:55
1

A simpler Asymptote code for very old question.

enter image description here

// http://asymptote.ualberta.ca/
unitsize(1cm);
real r=2;
path c1=circle((0,0),r);
path c2=circle((3,0),r);
path c3=circle((2,-2.5),r);
draw(c2^^c3);

pair A=intersectionpoints(c1,c2)[0]; 
pair B=intersectionpoints(c1,c3)[1]; 
path g=arc((0,0),A,B);
path h=arc((0,0),A,B,CW);
draw(g,blue+1pt);
draw(h,green+1pt);

dot("$A$",align=2N,A,red);
dot("$B$",align=SE,B,red);
shipout(bbox(5mm,invisible));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .