% buildcyclebug.mp % L. Nobre G. % 2006 beginfig(1); numeric squaregridstep, i, j, rotationanglestep, u, nx, ny; numeric rotationangle, horishift; path leftcirc, righcirc, basecirc; pen markpen; pair shiftvect; markpen = pencircle scaled 3pt; u = 10mm; squaregridstep = 2.1u; rotationanglestep = 5.5; nx = floor( 21cm / ( squaregridstep+1 ) ); ny = 2*floor( 29cm / ( squaregridstep+1 ) ); basecirc = fullcircle scaled u; for i=1 upto nx: horishift := (i/nx)*0.45u; for j=1 upto ny: rotationangle := j*rotationanglestep; shiftvect := squaregridstep*(i,0.5*j); leftcirc := basecirc rotated (2*rotationangle) shifted ( shiftvect+horishift*left ); righcirc := basecirc rotated rotationangle shifted ( shiftvect+horishift*right ); draw leftcirc withcolor 0.3white; draw righcirc withcolor 0.3white; draw buildcycle( leftcirc, reverse righcirc ) withcolor blue; draw point 0 of leftcirc withpen markpen; draw point 0 of righcirc withpen markpen; endfor; endfor; endfig; beginfig(2); path a, b, c; a = (159.49368,290.7048)..controls (159.29092,291.94003) and (158.9775,293.15451) ..(158.55756,294.33372)..controls (158.13393,295.5233) and (157.60364,296.6721) ..(156.97446,297.76695)..controls (156.33871,298.87321) and (155.6046,299.9199) ..(154.78215,300.89539)..controls (153.9502,301.88214) and (153.03125,302.79204) ..(152.03786,303.61603)..controls (151.0325,304.44995) and (149.95486,305.19261) ..(148.81863,305.83694)..controls (147.66982,306.48843) and (146.46558,307.03687) ..(145.22061,307.47765)..controls (143.96362,307.92268) and (142.66995,308.25626) ..(141.3548,308.47633)..controls (140.03023,308.698) and (138.68887,308.8037) ..(137.34593,308.79295)..controls (135.99751,308.78217) and (134.65259,308.65404) ..(133.32639,308.40996)..controls (131.99881,308.16563) and (130.69505,307.80605) ..(129.43005,307.33498)..controls (128.16791,306.86497) and (126.94911,306.28574) ..(125.78854,305.60234)..controls (124.63374,304.92235) and (123.5411,304.14188) ..(122.5243,303.26889)..controls (121.51508,302.4024) and (120.58455,301.44818) ..(119.74568,300.41588)..controls (118.91405,299.39249) and (118.17587,298.29651) ..(117.54193,297.1402)..controls (116.91396,295.99477) and (116.39084,294.79483) ..(115.98134,293.55438)..controls (115.57558,292.32524) and (115.28311,291.06154) ..(115.10854,289.77898)..controls (114.93536,288.5067) and (114.87895,287.22122) ..(114.94107,285.93872)..controls (115.0028,284.66422) and (115.18134,283.39806) ..(115.47398,282.15607)..controls (115.76532,280.91968) and (116.16852,279.71237) ..(116.67828,278.54889)..controls (117.18674,277.38843) and (117.79907,276.27635) ..(118.50629,275.22514)..controls (119.21288,274.17487) and (120.01135,273.18947) ..(120.89124,272.27943)..controls (121.77103,271.3695) and (122.72879,270.53844) ..(123.75226,269.79378)..controls (124.77632,269.04868) and (125.86238,268.39284) ..(126.9978,267.83188)..controls (128.13411,267.27048) and (129.3158,266.80612) ..(130.52983,266.44218)..controls (131.74399,266.07822) and (132.98631,265.81592) ..(134.24382,265.65674)..controls (135.50044,265.49768) and (136.76797,265.44212) ..(138.03372,265.49004)..controls (139.29755,265.53787) and (140.55539,265.68869) ..(141.79463,265.94131)..controls (143.03053,266.19325) and (144.24384,266.54561) ..(145.42241,266.99493)..controls (146.59683,267.44267) and (147.73291,267.98524) ..(148.81863,268.61847)..controls (149.90009,269.24919) and (150.9279,269.96771) ..(151.89061,270.76805)..controls (152.8493,271.56505) and (153.74008,272.44041) ..(154.5525,273.38608)..controls (155.36205,274.32838) and (156.09094,275.33714) ..(156.72955,276.40274)..controls (157.36655,277.46562) and (157.91138,278.58112) ..(158.35652,279.73755)..controls (158.8012,280.89273) and (159.14471,282.08438) ..(159.38153,283.29933)..controls (159.6187,284.51605) and (159.74791,285.75134) ..(159.7672,286.99081)..controls (159.78654,288.23448) and (159.69516,289.47742) ..cycle; b = (164.69388,283.76816)..controls (164.45602,285.2755) and (164.0816,286.75807) ..(163.57579,288.19778)..controls (163.06467,289.6526) and (162.42154,291.05757) ..(161.65623,292.39624)..controls (160.8809,293.75246) and (159.9834,295.03499) ..(158.97679,296.22963)..controls (157.95538,297.44182) and (156.82588,298.55852) ..(155.6046,299.56902)..controls (154.36432,300.59523) and (153.03438,301.50781) ..(151.63235,302.29881)..controls (150.2098,303.1014) and (148.71864,303.77567) ..(147.17755,304.31679)..controls (145.61667,304.86487) and (144.01057,305.27425) ..(142.37828,305.54321)..controls (140.73018,305.81479) and (139.06157,305.9422) ..(137.39133,305.92545)..controls (135.71124,305.9086) and (134.03581,305.74596) ..(132.38377,305.43983)..controls (130.7291,305.13322) and (129.1041,304.68382) ..(127.52728,304.09592)..controls (125.95447,303.5095) and (124.43553,302.7875) ..(122.98894,301.93604)..controls (121.55147,301.08994) and (120.191,300.11926) ..(118.92514,299.03305)..controls (117.6715,297.95732) and (116.51561,296.77249) ..(115.47398,295.49034)..controls (114.44432,294.22292) and (113.53049,292.86551) ..(112.74724,291.43265)..controls (111.97365,290.01747) and (111.3307,288.5346) ..(110.82997,287.0015)..controls (110.33537,285.48715) and (109.98169,283.9303) ..(109.77559,282.35062)..controls (109.5717,280.78786) and (109.51315,279.20952) ..(109.6024,277.63603)..controls (109.69093,276.07535) and (109.9245,274.52629) ..(110.29973,273.0088)..controls (110.67278,271.50015) and (111.18423,270.02914) ..(111.82713,268.61427)..controls (112.46806,267.20374) and (113.23691,265.855) ..(114.12129,264.5829)..controls (115.0049,263.31194) and (116.0003,262.12254) ..(117.09409,261.02722)..controls (118.18842,259.93134) and (119.37697,258.93388) ..(120.64404,258.04337)..controls (121.91309,257.15147) and (123.25624,256.37012) ..(124.65749,255.70496)..controls (126.06084,255.03879) and (127.51752,254.49147) ..(129.01158,254.06616)..controls (130.50682,253.64052) and (132.03445,253.3385) ..(133.57892,253.16093)..controls (135.1232,252.9834) and (136.6793,252.93085) ..(138.23209,253.003)..controls (139.78247,253.07506) and (141.32457,253.27116) ..(142.84367,253.58932)..controls (144.35844,253.90657) and (145.84552,254.34416) ..(147.29047,254.89853)..controls (148.72931,255.45056) and (150.1218,256.11664) ..(151.45383,256.89171)..controls (152.77919,257.66292) and (154.0404,258.53955) ..(155.22351,259.51508)..controls (156.4003,260.4854) and (157.49585,261.55034) ..(158.4969,262.70111)..controls (159.49316,263.84637) and (160.39235,265.07266) ..(161.18283,266.36856)..controls (161.97006,267.65913) and (162.64664,269.01411) ..(163.20195,270.42015)..controls (163.75612,271.82329) and (164.18744,273.27196) ..(164.48865,274.75021)..controls (164.7901,276.22968) and (164.96005,277.73294) ..(164.99524,279.2424)..controls (165.03055,280.75697) and (164.93001,282.27168) ..cycle; draw a; draw b; c = buildcycle( b, a ); show c; draw c withcolor green; pair sh, si; numeric sc; sh = (-150,-285); si = (-150,-290); sc = 10; draw a shifted sh scaled sc; draw b shifted si scaled sc; c := buildcycle( a shifted sh scaled sc, b shifted si scaled sc ); draw c withcolor green; endfig; end.