drieh nh n

 

drieh nh na

 

 

 

 

 

 

 

 

 

 

 

 

 

drieh nh90lr 0

 

drieh nh90lr 1

header drieh nh

De draaipunten 0 t/m 6 van de driehoeken         terug naar de inleiding

 

classes  "Drieh_nh"  en   "Drieh_nh90"     

class  "Drieh_nh"              zie ook   "Drieh_nh" in processing

argumenten van de constructor:  1) lengte van de basis n,  2) hoogte h1,  3)  draaipunt d,  4)  x positie,  5) y positie,  6) hoek,  7) kleur c

 

 


class Drieh_nh extends Vormen { 
//constructor 1   2  3  4  5   6    7 
  constructor(n, h1, d, x, y, hoek, c) { 
   super(x, y, hoek); 
   this.x  = x; this.y  = y;  this.hoek = hoek; this.c  = c; 
   this.n  = n; this.h1 = h1; this.d = d; 
} 
 
display() { 
 fill(this.c); 
 push(); 
 translate(this.x, this.y); 
 rotate(radians(this.hoek)); 
 beginShape(); 
 if (this.d == 0) {vertex(-this.n/2, this.h1/2); vertex(0, -this.h1/2); vertex(this.n/2, this.h1/2);} 
 if (this.d == 1) {vertex(0, 0); vertex(this.n/2, -this.h1); vertex(this.n, 0);} 
 if (this.d == 2) {vertex(-this.n/4, this.h1/2); vertex(this.n/4, -this.h1/2); vertex(this.n*3/4, this.h1/2);} 
 if (this.d == 3) {vertex(-this.n/2, this.h1); vertex(0, 0); vertex(this.n/2, this.h1);} 
 if (this.d == 4) {vertex(-this.n*3/4, this.h1/2); vertex(-this.n/4, -this.h1/2); vertex(this.n/4, this.h1/2);} 
 if (this.d == 5) {vertex(-this.n, 0); vertex(-this.n/2, -this.h1); vertex(0, 0);} 
 if (this.d == 6) {vertex(-this.n/2, 0); vertex(0, -this.h1); vertex(this.n/2, 0);} 
 endShape(CLOSE); 
 pop(); 
  } 
} 

 

header drieh nh90

Class   "Drieh_nh90"                           zie ook "Drieh_nh90" in processing

argumenten van de constructor: 1) lengte van de basis n,  2) hoogte h1,  3) lr = 1 schuine zijde naar rechts, lr = 0 schuine zijde naar links,  4) draapunten d
                                                    5) x positie,  6) y positie,  7) hoek,  8) kleur c

 

 


class Drieh_nh90 extends Vormen { 
//constructor:1  2   3   4  5  6   7    8 
  constructor(n, h1, lr, d, x, y, hoek, c) { 
   super(x, y, hoek); 
   this.x  = x; this.y  = y;  this.hoek = hoek; this.c  = c; 
   this.n  = n; this.h1 = h1;   this.lr = lr;   this.d = d; 
 
 } 
 
display() { 
 fill(this.c); 
 push(); 
 translate(this.x, this.y); 
 rotate(radians(this.hoek)); 
 beginShape(); 
 if (this.d == 0 && this.lr == 0) {vertex(-this.n/4,this.h1/4);vertex(-this.n/4,-3*this.h1/4);vertex(3*this.n/4,this.h1/4);} 
 if (this.d == 1 && this.lr == 0) {vertex(0,0);vertex(0,-this.h1);vertex(this.n,0);} 
 if (this.d == 2 && this.lr == 0) {vertex(0,this.h1/2);vertex(0,-this.h1/2);vertex(this.n,this.h1/2);} 
 if (this.d == 3 && this.lr == 0) {vertex(0,this.h1);vertex(0,0);vertex(this.n,this.h1);} 
 if (this.d == 4 && this.lr == 0) {vertex(-this.n/2,this.h1/2);vertex(-this.n/2,-this.h1/2);vertex(this.n/2,this.h1/2);} 
 if (this.d == 5 && this.lr == 0) {vertex(-this.n,0);vertex(-this.n,-this.h1);vertex(0,0);} 
 if (this.d == 6 && this.lr == 0) {vertex(-this.n/2,0);vertex(-this.n/2,-this.h1);vertex(this.n/2,0);} 
 if (this.d == 0 && this.lr == 1) {vertex(-3*this.n/4,this.h1/4);vertex(this.n/4,-3*this.h1/4);vertex(this.n/4,this.h1/4);} 
 if (this.d == 1 && this.lr == 1) {vertex(0,0);vertex(this.n,-this.h1);vertex(this.n,0);} 
 if (this.d == 2 && this.lr == 1) {vertex(-this.n/2,this.h1/2);vertex(this.n/2,-this.h1/2);vertex(this.n/2,this.h1/2);} 
 if (this.d == 3 && this.lr == 1) {vertex(-this.n,this.h1);vertex(0,0);vertex(0,this.h1);} 
 if (this.d == 4 && this.lr == 1) {vertex(-this.n,this.h1/2);vertex(0,-this.h1/2);vertex(0,this.h1/2);} 
 if (this.d == 5 && this.lr == 1) {vertex(-this.n,0);vertex(0,-this.h1);vertex(0,0);} 
 if (this.d == 6 && this.lr == 1) {vertex(-this.n/2,0);vertex(this.n/2,-this.h1);vertex(this.n/2,0);} 
 endShape(CLOSE); 
 pop(); 
 } 
}