correct possible division by zero when determining the orientation of a middle marker