summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/asymptote/examples/venn3.asy
blob: 6118fab6e9af56afe8b7479cc44517152844ccd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
size(0,150);

pen colour1=red;
pen colour2=green;
pen colour3=blue;

real r=sqrt(3);

pair z0=(0,0);
pair z1=(-1,0);
pair z2=(1,0);
pair z3=(0,r);

path c1=circle(z1,r);
path c2=circle(z2,r);
path c3=circle(z3,r);

fill(c1,colour1);
fill(c2,colour2);
fill(c3,colour3);

picture intersection12;
fill(intersection12,c1,colour1+colour2);
clip(intersection12,c2);

picture intersection13;
fill(intersection13,c1,colour1+colour3);
clip(intersection13,c3);

picture intersection23;
fill(intersection23,c2,colour2+colour3);
clip(intersection23,c3);

picture intersection123;
fill(intersection123,c1,colour1+colour2+colour3);
clip(intersection123,c2);
clip(intersection123,c3);

add(intersection12);
add(intersection13);
add(intersection23);
add(intersection123);

draw(c1);
draw(c2);
draw(c3);

label("$A$",z1);
label("$B$",z2);
label("$C$",z3);