Useful functions - sample 01 - to be or not to be inside of a triangle

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 : Maybe sometimes you need to use triangles in your work and you want to
know if a point is inside or outside of one of them. You can check the code of this page
and you will find the function IsPointInsideOfTriangle(my_point, my_triangle) that will
give you the answer.

The sample : Three balls are moving and bouncing randomly. They are the 3 corners of a
triangle. (Mouse) is inside (ABC) if (a) is inside [BC] and (b) inside [AC] and that is
what I calculate in the function. When (mouse) is inside (ABC) I fill the yellow triangle
to prove the function works.

Click here for more content