Function getSegmentMidPoint