code: def overlap(origins, vectors, params):
      
      # copy inputs and make sure shape is correct
      origins = np.array(origins).reshape((2, 3))
      vectors = np.array(vectors).reshape((2, 3))
      params = np.array(params).reshape((2, 2))
  
      if tol.strict:
          # convert input to parameters before flipping
          # to make sure we didn't screw it up
          truth = parameters_to_segments(origins,
                                         vectors,
                                         params)
  
      # this function only works on parallel lines
      dot = np.dot(*vectors)
      assert np.isclose(np.abs(dot), 1.0, atol=.01)
  
      # if two vectors are reversed
      if dot < 0.0:
          # reverse direction vector
          vectors[1] *= -1.0
          # negate parameters
          params[1] *= -1.0
  
      if tol.strict:
          # do a check to make sure our reversal didn't
          # inadvertently give us incorrect segments
          assert np.allclose(truth,
                             parameters_to_segments(origins,
                                                    vectors,
                                                    params))
  
      # merge the parameter ranges
      ok, new_range = interval.intersection(*params)
  
      if not ok:
          return 0.0, np.array([])
  
      # create the overlapping segment pairs (2, 2, 3)
      segments = np.array([o + v * new_range.reshape((-1, 1))
                           for o, v in zip(origins, vectors)])
      # get the length of the new range
      length = new_range.ptp()
  
      return length, segments
docs: Find the overlap of two parallel line segments.
  
      Parameters
      ------------
      origins : (2, 3) float
         Origin points of lines in space
      vectors : (2, 3) float
         Unit direction vectors of lines
      params : (2, 2) float
         Two (start, end) distance pairs
  
      Returns
      ------------
      length : float
         Overlapping length
      overlap : (n, 2, 3) float
         Line segments for overlapping distance