JSFiddle - React, Tailwind, and code Playground

by nilloc

JavaScript

function drawArm(startX, startY, endX, endY, segLength){
    var Circle_1 = new Circle(startX, startY, segLength);
    var Circle_2 = new Circle(endX, endY, segLength);
    
    noFill();
    
    /*
    strokeWeight(2);
    ellipse(Circle_1.x, Circle_1.y, Circle_1.r*2, Circle_1.r*2);
    ellipse(Circle_2.x, Circle_2.y, Circle_2.r*2, Circle_2.r*2);
    */
    
    var points = circleCircleIntersectionPoints(Circle_1, Circle_2);
    
    /*
    for(var i = 0; i<points.length; i++){
        strokeWeight(8);
        point(points[i].x, points[i].y);
    }
    */
    
    points.sort(function(a, b){
        return b.y - a.y;
    });
    
    line(startX, startY, points[0].x, points[0].y);
    line(endX, endY, points[0].x, points[0].y);
}

draw = function() {
    background(255, 255, 255);
    
    drawArm(50, 200, 200, 200, 100);
};