classes "BezierCub" , "BezierQuadr" , "BezierQuadrCub"                                   terug naar de inleiding

"BezierCub"                 naar de Bezier cubic curve constructor creator

 

 
 //De constructor 
class BezierCub extends Curven{ 
  constructor(xa1,ya1, xa2,ya2,  //ankerpunten a1 en a2 
              xc1,yc1, xc2,yc2,  //controlepunten c1 en c2 
              c) 
{ 
  super(xa1,ya1, xa2,ya2,  //ankerpunten a1 en a2 
              xc1,yc1, xc2,yc2)  //controlepunten c1 en c2 
               
   this.xa1 = xa1; this.ya1 = ya1; this.xa2 = xa2; this.ya2 = ya2; //a1 en a2 
   this.xc1 = xc1; this.yc1 = yc1; this.xc2 = xc2; this.yc2 = yc2;//c2, en c2 
   this.c = c; 
 
} 
 
display() { 
   fill(this.c); 
beginShape(); 
   vertex(this.xa1, this.ya1); //eerste ankerpunt 
   //quadraticVertex werkt alleen met WEBGL 
   bezierVertex(this.xc1, this.yc1, this.xc2, this.yc2,this.xa2, this.ya2);  //eerste controlepunt en tweede ankerpunt 
   endShape(CLOSE); 
  } 
}
 

class  "BezierQuadr"           naar de Bezier quadratic curve constructor creator

 

//De constructor functie 
class BezierQuadr extends Curven{ 
  constructor(xa1,ya1, xa2,ya2,  //ankerpunten a1 en a2 
              xc1,yc1,          //controlepunten c1, 
              c) 
 { 
super(xa1,ya1, xa2,ya2,  //ankerpunten a1 en a2 
            xc1,yc1,)         //controlepunten c1, 
 
   this.xa1 = xa1; this.ya1 = ya1; this.xa2 = xa2; this.ya2 = ya2; //a1 en a2 
   this.xc1 = xc1; this.yc1 = yc1; //c1 
   this.c = c; 
} 
 
display() { 
   fill(this.c); 
   beginShape(); 
    vertex(this.xa1, this.ya1); //eerste ankerpunt 
   //quadraticVertex werkt alleen met WEBGL 
    quadraticVertex(this.xc1, this.yc1, this.xa2, this.ya2);  //eerste controlepunt en tweede ankerpunt 
   endShape(CLOSE); 
  } 
}
 

class  "BezierQuadrCub"   naar de Bezier quadratic cubic curve constructor creator

 

 
 

class BezierQuadrCub extends Curven { 
  constructor(xa1,ya1, xa2,ya2, xa3, ya3,  //ankerpunten a1,a2,en a3 
              xc1,yc1, xc2,yc2, xc3, yc3,  //controlepunten c1, c2 en c3 
              c) 
 { 
  super(xa1,ya1, xa2,ya2, xa3, ya3,  //ankerpunten a1,a2,en a3 
              xc1,yc1, xc2,yc2, xc3, yc3)  //controlepunten c1, c2 en c3 
 
   this.xa1 = xa1; this.ya1 = ya1; //a1 
   this.xc1 = xc1; this.yc1 = yc1; this.xa2 = xa2; this.ya2 = ya2;  //c1 en a2 
   this.xc2 = xc2; this.yc2 = yc2; this.xc3 = xc3; this.yc3 = yc3; this.xa3 = xa3; this.ya3 = ya3;  //c2, c3 en a3 
   this.c = c; 
} 
 
display() { 
   fill(this.c); 
beginShape(); 
   vertex(this.xa1, this.ya1); //eerste ankerpunt 
   //quadraticVertex werkt alleen met WEBGL 
   quadraticVertex(this.xc1,this.yc1, this.xa2,this.ya2);  //eerste controlepunt en tweede ankerpunt 
   bezierVertex(this.xc2, this.yc2, this.xc3, this.yc3, this.xa3, this.ya3);  //tweede en derde controlepunt en derde ankerpunt 
 endShape(CLOSE); 
 } 
}