updated to use point on edge from mathutils.