classes "Bezier3Cub" , "Bezier3Quadr" , "BezierQuadrCubQuadr" terug naar de inleiding
"Bezier3Cub" naar de Bezier cubic cubic cubic curve constructor creator
class Bezier3Cub extends Curven {
constructor(xa1,ya1, xa2,ya2, xa3, ya3, xa4, ya4, //ankerpunten a1,a2,en a3
xc1,yc1, xc2,yc2, xc3, yc3,
xc4,yc4, xc5, yc5, xc6, yc6, //controlepunten c1, c2 en c3
c)
{
super(xa1,ya1, xa2,ya2, xa3, ya3, xa4, ya4) //ankerpunten a1,a2,en a3 gaan naar de supeclass
this.xa1 = xa1; this.ya1 = ya1; this.xa2 = xa2; this.ya2 = ya2; //a1 en a2
this.xa3 = xa3; this.ya3 = ya3; this.xa4 = xa4; this.ya4 = ya4; //a3 en a4
this.xc1 = xc1; this.yc1 = yc1; this.xc2 = xc2; this.yc2 = yc2; this.xc3 = xc3; this.yc3 = yc3; //c1, c2 en c3
this.xc4 = xc4; this.yc4 = yc4; this.xc5 = xc5; this.yc5 = yc5; this.xc6 = xc6; this.yc6 = yc6; //c4 , c5 en c6
this.c = c;
}
display() {
fill(this.c);
beginShape();
vertex(this.xa1, this.ya1); //eerste ankerpunt
//eerste en tweede controlepunt en tweede ankerpunt
bezierVertex(this.xc1,this.yc1, this.xc2, this.yc2, this.xa2,this.ya2);
//derde en vierde controlepunt en derde ankerpunt
bezierVertex(this.xc3, this.yc3, this.xc4, this.yc4, this.xa3, this.ya3);
//vijfde en zesde controlepunt en vierde ankerpunt
bezierVertex(this.xc5, this.yc5, this.xc6, this.yc6, this.xa4, this.ya4);
endShape(CLOSE);
}
}
class "Bezier3Quadr" naar de bezier quadratic quadratic quadratic constructor creator
class Bezier3Quadr extends Curven {
constructor(xa1,ya1, xa2,ya2, xa3,ya3, xa4,ya4, //ankerpunten a1, a2, a3, a4
xc1,yc1, xc2,yc2, xc3,yc3, //controlepunt c1, c2, c3
c)
{
super(xa1,ya1, xa2,ya2, xa3,ya3, xa4,ya4) //ankerpunten a1, a2, a3, a4 gaan naar de superclass
this.xa1 = xa1; this.ya1 = ya1; this.xa2 = xa2; this.ya2 = ya2; //a1 en a2
this.xa3 = xa3; this.ya3 = ya3; this.xa4 = xa4; this.ya4 = ya4; //a3 en a4
this.xc1 = xc1; this.yc1 = yc1; this.xc2 = xc2; this.yc2 = yc2; //c1 en c2
this.xc3 = xc3; this.yc3 = yc3; //c3
this.c = c;
}
display() {
fill(this.c);
beginShape();
vertex(this.xa1, this.ya1); //eerste ankerpunt
quadraticVertex(this.xc1, this.yc1, this.xa2, this.ya2); //eerste controlepunt en tweede ankerpunt
quadraticVertex(this.xc2, this.yc2, this.xa3, this.ya3); //tweede controlepunt en derde ankerpunt
quadraticVertex(this.xc3, this.yc3, this.xa4, this.ya4); //derde controlepunt en vierde ankerpunt
endShape(CLOSE);
}
}
class "BezierQuadrCubQuadr" naar de Bezier quadratic cubic quadratic curve constructor creator
lass BezierQuadrCubQuadr extends Curven {
constructor (xa1, ya1, xa2, ya2, xa3, ya3, xa4, ya4, //ankerpunten a1,a2, a3 en a4
xc1, yc1, xc2, yc2, xc3, yc3, xc4, yc4, c) //controlepunten c1, c2 c3 en c4
{
super(xa1,ya1, xa2,ya2, xa3, ya3, xa4, ya4) //ankerpunten a1,a2,a3 en a4 gaan naar de superclass
this.xa1 = xa1; this.ya1 = ya1; this.xa2 = xa2; this.ya2 = ya2;
this.xa3 = xa3; this.ya3 = ya3; this.xa4 = xa4; this.ya4 = ya4;
this.xc1 = xc1; this.yc1 = yc1; this.xc2 = xc2; this.yc2 = yc2;
this.xc3 = xc3; this.yc3 = yc3; this.xc4 = xc4; this.yc4 = yc4;
this.c = c;
}
display() {
fill(this.c);
beginShape();
vertex(this.xa1, this.ya1); //eerste ankerpunt
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
quadraticVertex(this.xc4, this.yc4, this.xa4, this.ya4); //vierde controlepunt en vierde lichtblauwe ankerpunt
endShape(CLOSE);
}
}