function rotateAround(p1, p2,angle,dist) {
for(let i =0; i<p1.length; i++) {
let dx = p2[i].x + Math.cos(angle) * dist;
let dy = p2[i].y + Math.sin(angle) * dist;
p1[i].x = dx;
p1[i].y = dy;
}
}
Managed to find a way around this using arrays.