Pixel art still life.  An old piece I did years ago in school.

Pixel art still life.  An old piece I did years ago in school.

Sliding LED lights array (left to right then starts over).

Sliding LED lights array (left to right then starts over).

Trying out the “Network Lamp” code from the “Getting Started with Arduino” book.  I’m starting to get the hang of Arduino.

Trying out the “Network Lamp” code from the “Getting Started with Arduino” book.  I’m starting to get the hang of Arduino.

Hexagon WebCam Filter test
Although very tricky, I’ve managed to write the Processing code for a webcam filter comprised of hexagons.  The code could do with a a lot of improving but you can find it below:
import processing.video.*;int hexagonSize = 10; float a, b, e;int i = 1;int j = 1;int k = 1;Capture video;void setup() {  size(840, 640);  e = hexagonSize;  b = hexagonSize / 2;  a = sqrt((e * e) - (b * b));  background(0);  video = new Capture(this, 40, 50, 30);}void draw() {    if (video.available()) {    video.read();  }    video.loadPixels();  for (k = 1; k <= ((height/(2 * a)) +1); k++) {     for (j = 1; j <= 2; j++) {      for (i = 1; i <= ((width/(3 * e)) +3); i++) {        color c = video.pixels[j + i + k * video.width];        fill(c);        noStroke();        drawHexagon(a, b, e);                translate(e * 3, 0);      }      translate(-(i * e * 3), 0);      translate(e + b, a);    }    translate(3 * e, 0);  }}void drawHexagon(float a, float b, float e) {  beginShape();  vertex(-b, -a);  vertex(b, -a);  vertex(e, 0);  vertex(b, a);  vertex(-b, a);  vertex(-e, 0);  endShape(CLOSE);}

Hexagon WebCam Filter test

Although very tricky, I’ve managed to write the Processing code for a webcam filter comprised of hexagons.  The code could do with a a lot of improving but you can find it below:

import processing.video.*;

int hexagonSize = 10;
float a, b, e;
int i = 1;
int j = 1;
int k = 1;

Capture video;

void setup() {
  size(840, 640);
  e = hexagonSize;
  b = hexagonSize / 2;
  a = sqrt((e * e) - (b * b));
  background(0);
  video = new Capture(this, 40, 50, 30);
}

void draw() {
 
  if (video.available()) {
    video.read();
  }
 
  video.loadPixels();
  for (k = 1; k <= ((height/(2 * a)) +1); k++) {
    for (j = 1; j <= 2; j++) {
      for (i = 1; i <= ((width/(3 * e)) +3); i++) {
        color c = video.pixels[j + i + k * video.width];
        fill(c);
        noStroke();
        drawHexagon(a, b, e);
       
        translate(e * 3, 0);
      }
      translate(-(i * e * 3), 0);
      translate(e + b, a);
    }
    translate(3 * e, 0);
  }
}

void drawHexagon(float a, float b, float e) {
  beginShape();
  vertex(-b, -a);
  vertex(b, -a);
  vertex(e, 0);
  vertex(b, a);
  vertex(-b, a);
  vertex(-e, 0);
  endShape(CLOSE);
}