header drieh nh90
 
 De driehoeken in de draaipunten met h1 = 2*n
 
Driehoek met 90 graden hoek  "Drieh_nh90".                            terug naar de inleiding
argumenten van de constructor:
1) n = basis,  2)  h1 = hoogte, 3) lr = 1 schuine zijde --> rechts, lr = 0 schuine zijde --> links, 4) draaipunten 0 t/m6, 5) x positie, 6) y positie, 7) hoek, 8) kleur
 
 
 

class Drieh_nh90 extends Vormen {  
   
  Drieh_nh90(float n_, float h1_, int lr_, int d_, float x_, float y_, float hoek_, color c1_) {   
 super();   
 n  = n_;   
 h1 = h1_;  
 lr = lr_; 
 d  = d_;  
 x  = x_;   
 y  = y_;   
 hoek = hoek_;   
 c1 = c1_;     
 }  
   
void display() {   
 fill(c1);   
 pushMatrix();   
 translate(x, y);   
 rotate(radians(hoek));   
 beginShape();  
 if (d == 0 && lr == 0) {vertex(-n/4,h1/4);vertex(-n/4,-3*h1/4);vertex(3*n/4,h1/4);}  
 if (d == 1 && lr == 0) {vertex(0,0);vertex(0,-h1);vertex(n,0);}    
 if (d == 2 && lr == 0) {vertex(0,h1/2);vertex(0,-h1/2);vertex(n,h1/2);}   
 if (d == 3 && lr == 0) {vertex(0,h1);vertex(0,0);vertex(n,h1);}   
 if (d == 4 && lr == 0) {vertex(-n/2,h1/2);vertex(-n/2,-h1/2);vertex(n/2,h1/2);}   
 if (d == 5 && lr == 0) {vertex(-n,0);vertex(-n,-h1);vertex(0,0);}    
 if (d == 6 && lr == 0) {vertex(-n/2,0);vertex(-n/2,-h1);vertex(n/2,0);}  
 if (d == 0 && lr == 1) {vertex(-3*n/4,h1/4);vertex(n/4,-3*h1/4);vertex(n/4,h1/4);}    
 if (d == 1 && lr == 1) {vertex(0,0);vertex(n,-h1);vertex(n,0);}   
 if (d == 2 && lr == 1) {vertex(-n/2,h1/2);vertex(n/2,-h1/2);vertex(n/2,h1/2);}  
 if (d == 3 && lr == 1) {vertex(-n,h1);vertex(0,0);vertex(0,h1);}  
 if (d == 4 && lr == 1) {vertex(-n,h1/2);vertex(0,-h1/2);vertex(0,h1/2);}    
 if (d == 5 && lr == 1) {vertex(-n,0);vertex(0,-h1);vertex(0,0);}     
 if (d == 6 && lr == 1) {vertex(-n/2,0);vertex(n/2,-h1);vertex(n/2,0);}  
 endShape(CLOSE);   
 popMatrix();   
}   
}
animatie met 12 driehoeken met 90 graden hoeken,  De animatie is omgezet in p5.js.   ga naar de animatie in fullscreen
De animatie maakt ook gebruik van objectmethodes van de superclass  ¬®Vormen¬®.
 
Om het ruitjespapier  te tonen maakt de schets gebruik van de  "Ruitjes"  class

Met de methode dpAan(); (line 47) worden de draaipunten als rode puntjes getoond.  De methode staat in de superclass  "Vormen

toetsfuncties
toetsen 1 t/m 0 verandering draaipunten
toets "a" inschakelen ruitjespapier met draaipunten
toets "u" uitschakelen ruitjespapier
toets "s" stopt de rotaties, ieder overige toets start de rotaties
toets "d" downloaden van een afbeelding van de animtie (animatie is in p5.js)

 

Vormen[] drieh = new Vormen[12]; 
 
 int dp1 = 1; int dp2 = 2;
 int dp3 = 3; int dp4 = 4; int dp5 = 5;
boolean aan = false; 
Ruitjes ruitjespap; 
 void setup() {  
  fullScreen(); 
  size(780, 560);  
  float x = width/2;  
  float y = height/2;  
  float n = height/10; 
  ruitjespap = new Ruitjes(n,x,y); 
  drieh[0] = new Drieh_nh90(n, 3*n, 1, dp4, x-3*n, y-3*n/2, 90, color(44, 240, 215, 100));  
  drieh[1] = new Drieh_nh90(n, 3*n, 0, dp2, x+3*n, y-3*n/2,-90, color(44, 240, 74, 100));   
  drieh[2] = new Drieh_nh90(n, 3*n, 0, dp2, x-3*n, y+3*n/2, 90, color(44, 240, 74, 100));    
  drieh[3] = new Drieh_nh90(n, 3*n, 1, dp4, x+3*n, y+3*n/2,-90, color(44, 240, 215, 100));    
  drieh[4] = new Drieh_nh90(n, 3*n, 1, dp3, x,     y-n/2,   90, color(240, 201, 44, 100));    
  drieh[5] = new Drieh_nh90(n, 3*n, 0, dp3, x,     y-n/2,  -90, color(255, 126, 126, 100));    
  drieh[6] = new Drieh_nh90(n, 3*n, 0, dp3, x,     y+n/2,   90, color(255, 126, 126, 100));  
  drieh[7] = new Drieh_nh90(n, 3*n, 1, dp3, x,     y+n/2,  -90, color(240, 201, 44, 100));    
  drieh[8] = new Drieh_nh90(n, 2*n, 1, dp5, x,     y-n/2,    0, color(244, 255, 126, 100));    
  drieh[9] = new Drieh_nh90(n, 2*n, 0, dp1, x,     y-n/2,    0, color(216, 155, 247, 100));      
  drieh[10] = new Drieh_nh90(n, 2*n, 0, dp1, x,    y+n/2,  180, color(216, 155, 247, 100));  
  drieh[11] = new Drieh_nh90(n, 2*n, 1, dp5, x,    y+n/2, -180, color(244, 255, 126, 100));   
}  
  
void draw() {  
  background(#E6FBFF); 
 //  ruitjespap.display();
  for (int i = 0; i < 12; i++) 
{ 
  drieh[i].display(); 
} 
 
  if (key == 's') {
}
 else
{
  drieh[0].dpRotRe(drieh[0]); 
  drieh[1].dpRotLi(drieh[1]); 
  drieh[3].dpRotRe(drieh[3]); 
  drieh[2].dpRotLi(drieh[2]); 
  drieh[8].dpRotLi(drieh[8]); 
  drieh[9].dpRotRe(drieh[9]); 
  drieh[10].dpRotRe(drieh[10]); 
  drieh[11].dpRotLi(drieh[11]); 
}
   if (key == 'a' || aan ) { 
     ruitjespap.display(); 
     for (int i = 0; i < 12; i++) 
   { 
      drieh[i].dpAan(); 
   } 
    aan = true;
  }
   if (key == 'u') {aan = false;}
}  
 
void keyPressed() {
  if (key == '1') { 
   dp1 = 1; dp2 = 2; dp3 = 3; dp4 = 4; dp5 = 5;
   setup();
  }      
   
  if (key == '2') {          
      dp1 = 3; dp2 = 1; dp3 = 3; dp4 = 5; dp5 = 3;
    setup();     
  }
  
  if (key == '3') {          
      dp1 = 1; dp2 = 3; dp3 = 3; dp4 = 3; dp5 = 5; 
    setup();     
  } 
  
   if (key == '4') {          
      dp1 = 1; dp2 = 2; dp3 = 0; dp4 = 4; dp5 = 1; 
    setup();     
  } 
  
  if (key == '5') {          
     dp1 = 3; dp2 = 3; dp3 = 1; dp4 = 3; dp5 = 3; 
    setup();     
  } 
  
  if (key == '6') {          
   dp1 = 2; dp2 = 2; dp3 = 3; dp4 = 4; dp5 = 6; 
    setup();     
  } 
  
   if (key == '7') {          
     dp1 = 0; dp2 = 0; dp3 = 4; dp4 = 0; dp5 = 0; 
    setup();     
  } 
  
   if (key == '8') {          
     dp1 = 2; dp2 = 2; dp3 = 5; dp2 = 6; dp5 = 2; 
    setup();     
  } 
   if (key == '9') {          
      dp1 = 6; dp2 = 6; dp3 = 6; dp4 = 2; dp5 = 2; 
    setup();  
    
  } 
   if (key == '0') {          
     dp1 = 2; dp2 = 4; dp3 = 2; dp4 = 4; dp5 = 3; 
    setup();   
  } 
}

 

drieh nh90 06

 

 

 

 

 

drieh nh90 14