Skip to content

Instantly share code, notes, and snippets.

@kuzemkon
Created October 26, 2014 21:48
Show Gist options
  • Save kuzemkon/0b460ddead097b521e73 to your computer and use it in GitHub Desktop.
Save kuzemkon/0b460ddead097b521e73 to your computer and use it in GitHub Desktop.
float[] x = new float[10];
float[] y = new float[10];
float r=50;
void setup() {
size(600,600);
}
void draw() {
background(255);
noFill();
stroke(0);
x[0]=mouseX;
y[0]=mouseY;
for (int i=1; i<6; i++) {
x[i]=x[i-1]+r*cos(i*(PI/3));
y[i]=y[i-1]+r*sin(i*(PI/3));
}
beginShape();
for (int i=0; i<6; i++) {
vertex(x[i],y[i]);
}
endShape(CLOSE);
for (int i=0; i<3; i++) {
line(x[i],y[i],x[i+3],y[i+3]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment