Useful functions - sample 07 - to be or not no be inside a concave shape

I want to help people coding in ‪#‎javascript‬ ‪#‎HTML5‬ ‪#‎CSS3‬ so I have decided to solve
problems they can encounter with interactive samples.

The problem : You have a concave shape and you need to know if a given point is inside of
it or outside. You need to decompose the shape into tiny triangles. If the point is inside
one of them then it means the point is in the shape. The decomposition is more difficult than
with a convex shape but I 've found an algorithm you can use.

The sample : Dots are randomly moving and bouncing and I use the previous method to create
random concave shapes with them. I use a method to decompose each shape on tiny triangles
I have also found a way to know if the dots in the list of the border are given in a clockwise
sense of rotation. If the mouse is inside, the shape is colored in yellow and this special triangle
that prove it turns purple.

Click here for more content