8
edits
Andrefaupel (talk | contribs) |
|||
Line 132: | Line 132: | ||
==Group B== | ==Group B== | ||
'''EMIR GENC''' | |||
[[File:HEXA_WHITE.png]] | |||
[[File:HEXA_BLACK.png]] | |||
void setup() { | |||
size(500, 500); | |||
} | |||
void draw() { | |||
if (mousePressed) { | |||
background(0); | |||
} else { | |||
background(255); | |||
} | |||
noFill(); | |||
float o=40; | |||
float p=15; | |||
for (int x=0; x<500; x+=2*o+2*o*sin (PI/6)) { | |||
for (int y=0; y<500; y+=2*o*cos (PI/6)) { | |||
drawHexagon(x, y, p); | |||
drawHexagon(x+o+o*sin(PI/6), y+o*cos(PI/6), p); | |||
} | |||
} | |||
for (int x=0; x<500; x+=2*o+2*o*sin (PI/6)) { | |||
for (int y=0; y<500; y+=2*o*cos (PI/6)) { | |||
drawHexagon(x, y, o); | |||
drawHexagon(x+o+o*sin(PI/6), y+o*cos(PI/6), o); | |||
} | |||
} | |||
} | |||
void drawHexagon(float x, float y, float radius) { | |||
if (mousePressed) { | |||
stroke(255); | |||
} else { | |||
stroke(0); | |||
} | |||
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(); | |||
} | |||
'''Dhora Tego''' | '''Dhora Tego''' |
edits