File:Hexagon dhora changes.JPG

File on Medien Wiki
Revision as of 17:09, 20 November 2014 by Dora (talk | contribs) (float r, g, b; void setup(){ size(500,500); background(255); } void draw(){ for(int x=0; x<500; x+=60+60*sin(PI/6)){ for(int y=0; y<500; y+=60*cos(PI/6)){ drawHexagon(x, y, 30); drawHexagon(x+30+30*sin(PI/6), y+30*cos(PI/6), 30); } } } void d)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Hexagon_dhora_changes.JPG(501 × 497 pixels, file size: 108 KB, MIME type: image/jpeg)

Summary

float r, g, b;

void setup(){

size(500,500); background(255);

}

void draw(){

for(int x=0; x<500; x+=60+60*sin(PI/6)){
for(int y=0; y<500; y+=60*cos(PI/6)){

drawHexagon(x, y, 30);
drawHexagon(x+30+30*sin(PI/6), y+30*cos(PI/6), 30);
}

} }

void drawHexagon(float x, float y, float radius) {

pushMatrix();
translate(x, y);
beginShape();
for (int i = 0; i < 6; i++) {
  pushMatrix();
  float angle = PI*i/3;
  vertex(cos(angle) * radius, sin(angle) * radius);
  popMatrix();
}
endShape(CLOSE);
popMatrix();

fill (mouseX, (mouseX+mouseY), mouseY);
ellipse ( x, y, 40, 40 );
rect ( x, y, 10, 10 );

}

Copyright status:

Source:

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:09, 20 November 2014Thumbnail for version as of 17:09, 20 November 2014501 × 497 (108 KB)Dora (talk | contribs)float r, g, b; void setup(){ size(500,500); background(255); } void draw(){ for(int x=0; x<500; x+=60+60*sin(PI/6)){ for(int y=0; y<500; y+=60*cos(PI/6)){ drawHexagon(x, y, 30); drawHexagon(x+30+30*sin(PI/6), y+30*cos(PI/6), 30); } } } void d

The following page uses this file:

Metadata