Cinematica directa de un pantografo

<script language=”javascript”>
cenx = 100;
ceny = 100;
//angulos de las articulaciones
a = 0;
b = 0;
//Largo de los segmentos
l1 = 70;
l2 = 30;
function setup() { 
    createCanvas(200, 200);
    sliderA = createSlider(0, 100, 50);
    sliderB = createSlider(0, 100, 50);
}
function draw(){
    background(100);
    fill(0);
    text(“Pantografo”,10,10);
    a = 6.28*sliderA.value()/100;
    b = 6.28*sliderB.value()/100+a-3.14;
    stroke(0,0,200);
    strokeWeight(3);
    line(cenx, ceny, cenx + l1*cos(a), ceny + l1*sin(a));
    line(cenx + l1*cos(a), ceny + l1*sin(a), cenx + l1*cos(a) + l2*cos(b), ceny + l1*sin(a) + l2*sin(b));
    textSize(8);
    fill(255, 220,0);
    strokeWeight(0);
    text(“a = ” + a, 20, 160);
    text(“b = ” + b, 20, 170);
    x = cenx + l1*cos(a) + l2*cos(b);
    y = ceny + l1*sin(a) + l2*sin(b)
    text(“x = ” + x, 20, 180);
    text(“y = ” + y, 20, 190);
}
</script>