Say I have a 2D surface defined with the use of bitmap.
I want to use this bitmap for collision detection (white color is where object can move freely, with black I mark the walls).
How can I numerically calculate the surface normal vector at given point?
For example, in the attached picture, how can I calculate the surface normal vector for the red point?