- define_pixels(xoffs, yoffs);
-
- pickup pencircle
- xscaled 0.50 reduced_slt
- yscaled 0.22 reduced_il
- rotated -35;
-
- lft za = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
- lft zb = (xoffs + 1.00 reduced_il, yoffs + 1.20 reduced_il);
- lft zc = (xoffs + 0.70 reduced_il, yoffs + 2.00 reduced_il);
- lft zd = (xoffs + 0.30 reduced_il, yoffs + 3.00 reduced_il);
- lft ze = (xoffs + 0.80 reduced_il, yoffs + 3.70 reduced_il);
- lft zf = (xoffs + 1.00 reduced_il, yoffs + 3.00 reduced_il);
- lft zg = (xoffs + 0.60 reduced_il, yoffs + 2.00 reduced_il);
- lft zh = (xoffs + 0.30 reduced_il, yoffs + 1.70 reduced_il);
- lft zi = (xoffs + 0.00 reduced_il, yoffs + 0.75 reduced_il);
- lft zj = (xoffs + 0.20 reduced_il, yoffs + 0.60 reduced_il);
-
- draw za{-1,2} .. zb .. zc .. zd .. ze .. zf .. zg .. zh .. zi .. zj;
-
- save za, zb, zc, zd, ze, zf;
- pair za, zb, zc, zd, ze, zf;
-
- pickup pencircle
- xscaled 0.75 reduced_slt
- yscaled 0.33 reduced_il
- rotated -35;
-
- lft za = (xoffs + 1.05 reduced_il, yoffs + 0.45 reduced_il);
- lft zb = (xoffs + 0.55 reduced_il, yoffs + 0.45 reduced_il);
- lft zc = (xoffs + 0.55 reduced_il, yoffs - 0.45 reduced_il);
- lft zd = (xoffs + 1.05 reduced_il, yoffs - 0.45 reduced_il);
- lft ze = (xoffs + 1.10 reduced_il, yoffs + 0.00 reduced_il);
- lft zf = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
-
- draw za .. zb .. zc .. zd .. {up}ze -- zf;
+
+ define_pixels (xoffs, yoffs);
+
+ save ellipse, paths, sub_path, outlines, sub_outlines, T;
+ path ellipse, paths[], sub_path, outlines[], sub_outlines[];
+ transform T;
+
+ T := identity xscaled 0.5 reduced_slt
+ yscaled 0.22 reduced_il
+ rotated -35;
+ pickup pencircle transformed T;
+ ellipse := fullcircle transformed T;
+
+ lft z1 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
+ lft z2 = (xoffs + 1.00 reduced_il, yoffs + 1.20 reduced_il);
+ lft z3 = (xoffs + 0.70 reduced_il, yoffs + 2.00 reduced_il);
+ lft z4 = (xoffs + 0.30 reduced_il, yoffs + 3.00 reduced_il);
+ lft z5 = (xoffs + 0.80 reduced_il, yoffs + 3.70 reduced_il);
+ lft z6 = (xoffs + 1.00 reduced_il, yoffs + 3.00 reduced_il);
+ lft z7 = (xoffs + 0.60 reduced_il, yoffs + 2.00 reduced_il);
+ lft z8 = (xoffs + 0.30 reduced_il, yoffs + 1.70 reduced_il);
+ lft z9 = (xoffs + 0.00 reduced_il, yoffs + 0.75 reduced_il);
+ lft z10 = (xoffs + 0.20 reduced_il, yoffs + 0.60 reduced_il);
+
+ paths1 := z1{-1, 2}
+ .. z2
+ .. z3
+ .. z4
+ .. z5
+ .. z6
+ .. z7
+ .. z8
+ .. z9
+ .. z10;
+
+ save dirs, s;
+ pair dirs[];
+
+ s := 1/4;
+
+ % we approximate `draw paths1'
+ for i = 1 step s until (length paths1 + 1):
+ dirs[i] := direction (i - 1) of paths1;
+ endfor;
+
+ outlines1 := get_subpath (ellipse, -dirs1, dirs1, z1)
+ for i = (1 + s) step s until (length paths1 + 1 - s):
+ .. get_subpoint (ellipse, dirs[i],
+ point (i - 1) of paths1)
+ endfor
+ .. get_subpath (ellipse, dirs10, -dirs10, z10)
+ for i = (length paths1 + 1 - s) step -s until (1 + s):
+ .. get_subpoint (ellipse, -dirs[i],
+ point (i - 1) of paths1)
+ endfor
+ .. cycle;
+
+ save len;
+
+ len := length outlines1;
+
+ sub_outlines1 := subpath (0,
+ floor (1/4 len)) of outlines1;
+ sub_outlines2 := subpath (floor (1/4 len),
+ floor (2/4 len)) of outlines1;
+ sub_outlines3 := subpath (floor (2/4 len),
+ floor (3/4 len)) of outlines1;
+ sub_outlines4 := subpath (floor (3/4 len),
+ len) of outlines1;
+
+ save times;
+ numeric times[];
+
+ (times12, times21) = sub_outlines1 intersectiontimes sub_outlines2;
+ (times13, times31) = sub_outlines1 intersectiontimes sub_outlines3;
+ (times42, times24) = sub_outlines4 intersectiontimes sub_outlines2;
+ (times43, times34) = sub_outlines4 intersectiontimes sub_outlines3;
+
+ T := identity xscaled 0.75 reduced_slt
+ yscaled 0.33 reduced_il
+ rotated -35;
+ pickup pencircle transformed T;
+ ellipse := fullcircle transformed T;
+
+ lft z21 = (xoffs + 1.05 reduced_il, yoffs + 0.45 reduced_il);
+ lft z22 = (xoffs + 0.55 reduced_il, yoffs + 0.45 reduced_il);
+ lft z23 = (xoffs + 0.55 reduced_il, yoffs - 0.45 reduced_il);
+ lft z24 = (xoffs + 1.05 reduced_il, yoffs - 0.45 reduced_il);
+ lft z25 = (xoffs + 1.10 reduced_il, yoffs + 0.00 reduced_il);
+ lft z26 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
+
+ paths2 := z21
+ .. z22
+ .. z23
+ .. z24
+ .. {up}z25
+ -- z26;
+
+ sub_path := subpath (0, 1) of paths2;
+
+ times1 = xpart (sub_outlines1 intersectiontimes sub_path);
+ times4 = xpart (sub_outlines4 intersectiontimes sub_path);
+
+ % we have to find the envelope intersections (if any)
+ save t;
+ numeric t[];
+
+ t1 = find_envelope_cusp (reverse ellipse,
+ subpath (1, 2) of paths2,
+ 1/256) + 1;
+ if t1 < 1:
+ t1 := 1;
+ t2 := 1;
+ else:
+ t2 = find_envelope_cusp (ellipse,
+ subpath (3, 4) of reverse paths2,
+ 1/256) + 3;
+ t2 := length paths2 - t2;
+ fi;
+
+ t3 = find_envelope_cusp (reverse ellipse,
+ subpath (2, 4 - epsilon) of paths2,
+ 1/256) + 2;
+ if t3 < 2:
+ t3 := 3;
+ t4 := 3;
+ else:
+ t4 = find_envelope_cusp (ellipse,
+ subpath (1 + epsilon, 3)
+ of reverse paths2,
+ 1/256) + 1;
+ t4 := length paths2 - t4;
+ fi;
+
+ fill subpath (times1 + s / 4, times13) of sub_outlines1
+ -- subpath (times31, infinity) of sub_outlines3
+ & subpath (0, times42) of sub_outlines4
+ -- subpath (times24, infinity) of sub_outlines2
+ & subpath (0, times34) of sub_outlines3
+ -- subpath (times43, times4 - s / 4) of sub_outlines4
+ -- cycle;
+ unfill subpath (times12, infinity) of sub_outlines1
+ & subpath (0, times21) of sub_outlines2
+ -- cycle;
+ fill subpath (times4 + s / 4, infinity) of sub_outlines4
+ & subpath (0, times1 - s / 4) of sub_outlines1
+ -- cycle;
+
+
+ % we approximate `draw paths2'
+ for i = 1 step s until (length paths2 - s):
+ dirs[i + 20] := direction (i - 1) of paths2;
+ endfor;
+
+ sub_outlines21 := get_subpath (ellipse, -dirs21, dirs21, z21)
+ for i = (1 + s) step s until (length paths2 - s):
+ .. get_subpoint (ellipse, dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor
+ .. get_subpath (ellipse, up, z26 - z25, z25);
+ sub_outlines22 := get_subpath (ellipse, z26 - z25, z25 - z26, z26)
+ -- get_subpoint (ellipse, z25 - z26, z25);
+ sub_outlines23 := get_subpoint (ellipse, down, z25)
+ for i = (length paths2 - s) step -s until (t4 + 1):
+ .. get_subpoint (ellipse, -dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor
+ .. get_subpoint (ellipse, -direction t4 of paths2,
+ point t4 of paths2);
+ sub_outlines24 := get_subpoint (ellipse, -direction t3 of paths2,
+ point t3 of paths2)
+ for i = (floor (t3 / s) * s + 1) step -s until (t2 + 1):
+ .. get_subpoint (ellipse, -dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor
+ .. get_subpoint (ellipse, -direction t2 of paths2,
+ point t2 of paths2);
+ sub_outlines25 := get_subpoint (ellipse, -direction t1 of paths2,
+ point t1 of paths2)
+ for i = (floor (t1 / s) * s + 1) step -s until (1 + s):
+ .. get_subpoint (ellipse, -dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor;
+
+ (times2223, times2322) = sub_outlines22 intersectiontimes sub_outlines23;
+ (times2324, times2423) = sub_outlines23 intersectiontimes sub_outlines24;
+ (times2425, times2524) = sub_outlines24 intersectiontimes sub_outlines25;
+
+ fill sub_outlines21
+ -- subpath (0, times2223) of sub_outlines22
+ -- subpath (times2322, times2324) of sub_outlines23
+ -- subpath (times2423, times2425) of sub_outlines24
+ -- subpath (times2524, infinity) of sub_outlines25
+ .. cycle;
+
+ labels (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ labels (21, 22, 23, 24, 25, 26);