% bart.mf by Raymond Chen (rjc@math.princeton.edu) % Bart Simpson. pictureof(Bart, 24u#, 24u#, 0); pickup thinpen; localpath eye_left, eye_right; eye_right = superellipse( (16.6u, 11.5u), (14u, 13.7u), (11.5u, 11u), (13.5u, 9u), .7); draw eye_right; localpath nose; nose = preclip((15u, 10u).. (17.5u, 10.8u){right} ... (20u, 9.7u){down} ... (16.7u, 8.2u){left}, eye_right); draw nose; localpath dimple; z1d = (12.8u, 6.3u); z2d = (12.2u, 5.2u); dimple = z1d{(z2d-z1d) rotated dimple_depth}.. {(z2d-z1d) rotated -dimple_depth}z2d; draw dimple; labels(1d, 2d); localpath mouth; mouth = prepostclip( (18u, 9u).. tension infinity and 3.. (19.6u, 5.3u) .. (19u, 5u){left} .. (14.3u, 5u) .. (12u, 6.2u), nose, dimple); draw mouth; eye_left = prepostclip( (18u, 9.7u){right}.. (20u, 12.2u){up}.. (18u, 14.2u){left}.. {down}(15.5u, 12u), nose, eye_right); draw eye_left; % The spikes of the hair are equally spaced along a path. % (Which means they really aren't equally spaced, since speed % along a path is nonconstant. But that's good, because % that introduces variability.) % % n is two less than the number of spikes atop Bart's head. Although % you can choose any value you want, the official Bart has 9 spikes, % so you should set n to 7. % localpath hair_top, hair_bot; local(numeric)(bumpiness, n); bumpiness = 5; n = 7; z0h = (18.3u, 13u); z3h = (8.8u, 5.5u); z1h = (15.5u, 22u); z2h = (4u, 18.6u); z4h = (8.5u, 3.8u); hair_top = z1h{(z2h-z1h) rotated -bumpiness} .. {(z2h-z1h) rotated bumpiness}z2h; z1h' = z1h - 2u * (z1h-z0h) / length(z1h-z0h); z2h' = z2h - (2u * (z2h-z3h) / length(z2h-z3h)) rotated 10; hair_bot = z1h'{(z2h-z1h) rotated -bumpiness} .. {(z2h-z1h) rotated bumpiness}z2h'; % What we want is for the valleys to be equally spaced, but 50% % further from the ends. numeric t[]; % The following wild macro makes t0 ... t[n] equally spaced. for i = 1 upto 2n: t[i] - t[i-1] = endfor % and we make them 50% further from the far endpoints 0 and 1. .6(t0 - 0) = .6(1 - t[2n]); % But we allow the points to vary randomly, so it doesn't look % too computerized. localpath hair; hair = preclip(z0h --- z1h --- for i = 0 upto n-1: point t[2i] of hair_bot shifted (kemptness*(normaldeviate, normaldeviate)) --- point t[2i+1] of hair_top shifted (kemptness*(normaldeviate, normaldeviate)) --- endfor point t[2n] of hair_bot --- z2h .. tension infinity and 1 .. z3h{down} .. z4h, eye_left); draw hair; numeric t; localpath ear; ear = (9.5u, 8.9u) .. (8u, 7.5u) ..(9.3u, 6.5u); erase fill ear .. cycle; draw ear; drawtau( (8.5u, 7.8u), (9.5u, 8.2u), (9.1u, 7u), (9.1u, 8.3u) ); % chin and neck z.chin = (14.4u, 2u); draw preclip( (17u, 5u){down} .. (16u, 4u){left} .. {(-1/2, -2)}z.chin, mouth); % Bart's shirt z1s = (x4h - 1.2u, 0u); z2s = z4h + (-.5u, -.8u); z3s = z.chin + (.2u, -.2u); z4s = (x.chin + .3u, 0u); draw z1s .. {z2s-z1s}z2s .. {dir -45}z4h .. (12u, 1.8u){right} ... z.chin & flex(z.chin, z3s, z4s); labels(1s, 2s, 4h); eyepos(Bart, 13.5u#, 11.2u#, 17.5u#, 12u#); endpicture;