Measurement of distance with the nanoscale precise imaging by rapid beam oscillation method