
Schets met roterende ellipsen en driehoeken terug naar de inleiding
De schets maakt gebruik van objectmethodes van de superclass, "Vormen" en objecten van de subclasses "Drieh_nh", en "Ellips".
De rechthoekige driehoek heeft als basis 2*n en als hoogte n, zie rechthoekige driehoeken
De gelijkbenige driehoek heeft als basis n en als hoogte 2*n , zo zijn de hoogten van de driehoeken gelijk aan de stalen van de ellipsen
de roterende ellipsen en driehoeken
Vormen cirkel1; Vormen cirkel2; Vormen cirkel3;
Vormen drieh2nh3; Vormen drieh2nh1; Vormen drieh2nh2;
void setup() {
// fullScreen();
size(780,560);
float x = width/2;
float y = height/2;
float n = height/5;
cirkel1 = new Ellips(n, n*2, 3, x-n, y, 45, color(#DE905C, 100));
cirkel2 = new Ellips(n, n*2, 1, x+n, y,-45, color(#DE905C, 100));
drieh2nh1 = new Drieh_nh(n*2, n*2, 5, x-n, y, 45, color(0,255,0, 100));
drieh2nh2 = new Drieh_nh(n*2, n*2 ,1, x+n, y,-45, color(0,255,0, 100));
cirkel3 = new Ellips(n, n, 0, x, y, 0, color(#DE905C, 100));
drieh2nh3 = new Drieh_nh(n*2, n, 6, x, y,180, color(255,29,0,100));
}
void draw() {
background(#E6FBFF);
cirkel3.display();
drieh2nh3.display();
cirkel1.display();
drieh2nh1.display();
cirkel2.display();
drieh2nh2.display();
cirkel1.dpRotLi(cirkel1);
drieh2nh1.dpRotRe(drieh2nh1);
drieh2nh2.dpRotLi(drieh2nh2);
cirkel2.dpRotRe(cirkel2);
}
void keyPressed() {
if (key == 's') {
noLoop();
}
if (key == 'r') {
loop();
}
}