Sprinkler

Back to still page

4C: Read RK pp. 147 to 200. Gather visual elements from at least three of your previous assignments, and create a 'welded image'. Each of the visual elements should be in a separate Command (or multiple Commands). Include comments to explain your choices and the resulting composition.



//This is a sprinkler.  I picked the myLine function because it makes
//lines that are both black and white.  This way when I divided the
//screnn, it would show up on both sides.  I like the welding effect that
// results from the lines and dots bridging from black to white.
antialias 1
command dotline x1 x2 m b  p
{
   set y1 (m*x1 + b)
   set y2 (m*x2 + b)
   pen p
   line x1 y1 x2 y2
}

command MyLine x1
{
   repeat m 1 5
   {
      set lastx x1
      repeat a 1 20
      {
         dotline lastx (lastx + a) m 0 ((a%2)*100)
         set lastx (lastx + a)
      }
   }
}
command fill x1 x2
{
   repeat b 1 100
   {
      line x1 b x2 b
   }
}
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 curve x1 y1 x2 y2 xinc yinc n p
{
   repeat a 1 n
   {
      pen p
      line x1 (y2+yinc) (x2+xinc) y1
      set x2 (x2+xinc)
      set y2 (y2+yinc)
   }
}
command mytriangle x1 x2
{
   repeat a x1 x2
   {
      pen ((a-55)*4)
      line 40 100 a 60
   }
}
command dot x y size color
{
   repeat b 1 size
   {
      repeat a 1 size
      {
         set [(x + a -1) (y + b -1)] color
      }
   }
}
paper 100
pen 0
fill 40 100
MyLine 0
triangle 20 10 85 20 75 40
pen 100
triangle 22 12 87 22 77 42
curve 100 100 80 100 1 -1 20 100
curve 100 0 80 0 1 1 20 100
//mytriangle 65 85

dot 50 70 2 100
dot 23 33 1 0
dot 38 52 5 0
dot 39 53 2 100
dot 65 90 3 100