xxxxxxxxxx
34
function addPerpendicularBisector(p1, p2) {
p1 = points[p1];
p2 = points[p2];
let index = circles.length;
addCircle(p1, p2, invisible);
addCircle(p2, p1, invisible);
let intersection = intersect(circles[index + 1], circles[index + 2]);
index = points.length;
addPoint(intersection[0].x, intersection[0].y, invisible);
addPoint(intersection[1].x, intersection[1].y, invisible);
addLine(points[index + 1], points[index + 2]);
}
function drawShape(ps) {
push();
fill(red(yellow), green(yellow), blue(yellow), 64);
beginShape();
for (let p of ps) {
vertex(points[p].x, points[p].y);
}
endShape(CLOSE);
pop();
}
function drawAngle(ps) {
let aHeading = createVector(points[ps[0]].x - points[ps[1]].x, points[ps[0]].y - points[ps[1]].y).heading();
let cHeading = createVector(points[ps[2]].x - points[ps[1]].x, points[ps[2]].y - points[ps[1]].y).heading();
push();
stroke(yellow);
strokeWeight(4);
fill(red(yellow), green(yellow), blue(yellow), 64);
arc(points[ps[1]].x, points[ps[1]].y, 75, 75, aHeading, cHeading, PIE);
pop();
}