Snake

back to still page

2C: Using DBN, create an image in the cubist spirit of "The Guitar" (p. 51). You should use at least 5 'command' definitions.



command quad xlt ylt xrt  yrt xrb yrb  xlb ylb
{
   line xlt ylt xrt yrt
   line xrt yrt xrb yrb
   line xrb yrb xlb ylb
   line xlb ylb xlt ylt
}

command triangle x1 y1 x2 y2 x3 y3
{
   quad x1 y1 x2 y2 x3 y3 x1 y1
}

command rectangle xlt ylt xrb yrb
{
   quad xlt ylt xrb ylt xrb yrb xlt yrb
}

command fillrect xlt ylt xrb yrb
{
   repeat  a ylt yrb
   {
      line xlt a xrb a
   }
}

command dot x y size
{
   repeat b 1 size
   {
      repeat a 1 size
      {
         set [(x + a -1) (y + b -1)] 0
      }
   }
}
paper 100
pen 0
triangle 10 20 38 12 34 22
quad 40 14 48 20 42 30 30 23
fillrect 38 39 49 28
rectangle 36 37 51 43
quad 40 36 50 44 37 63 27 56
quad 42 51 61 58 57 67 38 62
fillrect 55 76 67 60
quad 60 74 68 85 60 90 53 79
fillrect 65 88 77 80
fillrect 77 80 82 83
fillrect 77 85 82 88
dot 75 91 3