Exemple #1
0
  /*======== public void drawPolygons() ==========
  Inputs:  EdgeMatrix pm
           Color c
  Returns:

  Go through the point matrix as if it were a polygon matrix
  Call drawline in batches of 3s to create triangles.

  04/16/12 22:05:02
  jdyrlandweaver
  ====================*/
  public void drawPolygons(EdgeMatrix pm, Color c) {

    Random rndm = new Random();

    Color rndmColor;
    float r, g, b;

    if (pm.getLastCol() < 3) return;

    for (int i = 0; i < pm.getLastCol() - 2; i += 3) {

      if (pm.calculateDot(i) > 0) {

        r = rndm.nextFloat();
        g = rndm.nextFloat();
        b = rndm.nextFloat();

        rndmColor = new Color(r, g, b);

        scanLine(pm, i, rndmColor);
      }
    }
  }