Beispiel #1
0
  /*======== public void drawLines() ==========
  Inputs:  PointMatrix pm
  Color c
  Returns:
  calls drawLine so that it draws all the lines within PointMatrix pm
  ====================*/
  public void drawLines(EdgeMatrix pm, Color c) {

    for (int i = 0; i < pm.getLastCol() - 1; i += 2)
      drawLine(
          (int) pm.getX(i),
          (int) pm.getY(i),
          (int) pm.getZ(i),
          (int) pm.getX(i + 1),
          (int) pm.getY(i + 1),
          (int) pm.getZ(i + 1),
          c);
  }
Beispiel #2
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);
      }
    }
  }