add PointOnSegment routine