Three quarters of this function are repeated lines of code. It could be more efficient if it applied the logic to each point in the rectangle automatically. This would also, in theory, allow you to check if a ball is intersecting with a corner of a polygon with an arbitrary number of sides rather than just the hard-coded rectangle.
https://github.com/TheKrunch/arbitPong/blob/7a22115216c361f383d02d7ecbda2ce48545d97c/scripts.js#L189-L235
Three quarters of this function are repeated lines of code. It could be more efficient if it applied the logic to each point in the rectangle automatically. This would also, in theory, allow you to check if a ball is intersecting with a corner of a polygon with an arbitrary number of sides rather than just the hard-coded rectangle. https://github.com/TheKrunch/arbitPong/blob/7a22115216c361f383d02d7ecbda2ce48545d97c/scripts.js#L189-L235