![]() |
![]() |
|
roterende Euclides terug naar de inleiding
De 4 driehoeken zijn gelijkzijdig, met zijden n en hoogte hn = sqrt(3*n*n/4);
bekijk de draaiende driehoeken
Vormen cirkel0; Vormen cirkel1;
Vormen drieh0; Vormen drieh1;
Vormen drieh2; Vormen drieh3;
void setup() {
// fullScreen();
size(960,540);
float x = width/2;
float y = height/2;
float n = height/3;
float hn = sqrt(3*n*n/4); //de hoogte van de gelijkzijdige driehoek
cirkel0 = new Ellips(n, n, 1, x-n/2, y, 0, color(#EAD61A, 50));
cirkel1 = new Ellips(n, n, 3, x+n/2, y, 0, color(#EAD61A, 50));
drieh0 = new Drieh_nh(n, hn, 1, x-n/2, y, 90, color(#1AEA22, 100));
drieh1 = new Drieh_nh(n, hn, 5, x+n/2, y,-90, color(#1ACDEA, 100));
drieh2 = new Drieh_nh(n, hn, 5, x-n/2, y,-270,color(#1ACDEA, 100));
drieh3 = new Drieh_nh(n, hn, 1, x+n/2, y,270, color(#1AEA22, 100));
}
void draw() {
background(#E6FBFF);
stroke(255, 0, 0);
line (width/2, 0, width/2, height);
line (0, height/2, width, height/2);
stroke(0);
cirkel0.display();
cirkel1.display();
drieh0.display();
drieh1.display();
drieh2.display();
drieh3.display();
drieh0.dpRotRe(drieh0);
drieh1.dpRotLi(drieh1);
drieh2.dpRotLi(drieh2);
drieh3.dpRotRe(drieh3);
}
void keyPressed() {
if (key == 's') {
noLoop();
}
if (key == 'r') {
loop();
}
}