/*
Geoffrey Perez
lab 7
login: cs184-bn
SID: 12939491
used: BMRT then Renderman

variables:

dotradius:     size of the dots
dist:          distance between center of dots
b:             background color
dot:           color of dot

*/

surface
polkadot (float dotradius = .2, dist = .75;
	  color b = color(1,.2,.3), dot = color(1,1,1);)
{
  float x, y, od;

  od = mod(round(u / dist), 2);

  x = u - (round(u / dist) * dist);

  if (od == 1) {
	y = (v + (dist / 2)) - (round((v + (dist / 2)) / dist) * dist); }
  else {
	y = v - (round(v / dist) * dist); }

  if (((x * x) + (y * y)) <= (dotradius * dotradius)) {
  	Ci = dot; }
  else {
	Ci = b; }

}