Useful functions - sample 02 - how to circumscribe points

I want to help people coding in ‪#‎javascript‬ ‪#‎HTML5‬ ‪#‎CSS3‬ so I have decided to solve
problems they can encounter, create functions ready to be used and illustrate the point
with interactive samples.

The problem : You want to draw a polygone that circumscribes points you are working with
in order to have a shape containing all of them. In the code of the page you can find a
method I found. They are many ways to optimize it but it works fine in real time if you
handle a few points.

The sample : Twenty balls are moving and bouncing randomly. They are the points we need to
circumscribe. I added the mouse as one of them so you can check the effects on the borders.

Click here for more content