My approach is to calculate two tangent vectors parallel to axis X and Y respectively. Then calculate the cross product to find the normal vector.
The tangent vector is given by the line that crosses the middle point on the two nearest segments as is shown in the following picture.
I was wondering whether there is a more direct calculation, or less expensive in terms of CPU cycles.