docstr: compute the distance from point to a line
  ys: coordinates in the first axis
  xs: coordinates in the second axis
  point_1, point_2: (x, y), the end of the line
docstr_tok: ["compute","the","distance","from","point","to","a","line","ys",":","coordinates","in","the","first","axis","xs",":","coordinates","in","the","second","axis","point_1",",","point_2",":","(","x",",","y",")",",","the","end","of","the","line"]
code: def _distance(self, xs, ys, point_1, point_2):
      """
      compute the distance from point to a line
      ys: coordinates in the first axis
      xs: coordinates in the second axis
      point_1, point_2: (x, y), the end of the line
      """
      height, width = xs.shape[:2]
      square_distance_1 = np.square(xs - point_1[0]) + np.square(
          ys - point_1[1]
      )
      square_distance_2 = np.square(xs - point_2[0]) + np.square(
          ys - point_2[1]
      )
      square_distance = np.square(point_1[0] - point_2[0]) + np.square(
          point_1[1] - point_2[1]
      )
  
      cosin = (
          square_distance - square_distance_1 - square_distance_2
      ) / (2 * np.sqrt(square_distance_1 * square_distance_2))
      square_sin = 1 - np.square(cosin)
      square_sin = np.nan_to_num(square_sin)
      result = np.sqrt(
          square_distance_1
          * square_distance_2
          * square_sin
          / square_distance
      )
  
      result[cosin < 0] = np.sqrt(
          np.fmin(square_distance_1, square_distance_2)
      )[cosin < 0]
      # self.extend_line(point_1, point_2, result)
      return result
  
file_path: PaddleOCR/ppocr/data/imaug/make_border_map.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import cv2
  import pyclipper
  from shapely.geometry import Polygon
  import sys
  import warnings
label_desc: Use image node_id 4 for calling the MakeBorderMap obj's underlying member method code with example usage: obj._distance(xs, ys, point_1, point_2) and returns: result