A hack'n'slay game written in haskell (http://sebastiandev.net/blog/)

#8Normal vector for game shapes

It would be really nice to have a function that takes a shape and a point and returns a normal vector from the point onto the shape (if it exists).

For a circle this is trivial. If the point is P and the center of the circle is M we can just return (M - P), but this is not true for polygons. Luckily we only have convex polygons.

Check out the Data.Geometry.Types module for more info.