2

Does anyone know of a python library that can interpolate between two lines. For example, given the two solid lines below, I would like to produce the dashed line in the middle. In other words, I'd like to get the centreline. The input is a just two numpy arrays of coordinates with size N x 2 and M x 2 respectively.

enter image description here

Edit: so the suggested duplicate seems to be a promising way to approach this. However, it assumes that there is an outer and inner curve with respect to a single origin (0,0). I believe this algorithm would fail in examples such as the one below:

enter image description here

Furthermore, I'd like to know if someone has written a function for this in some optimized python library. Although optimization isn't exactly a necessary.

jlcv
  • 1,688
  • 5
  • 21
  • 50
  • 2
    You can triangulate the zone between the curves and join the midpoints of the zigzagging edges. (Unfortunately, I cannot post a figure as the question was - IMO unduely - closed.) –  Nov 26 '17 at 09:40
  • "The input is a just a numpy array of coordinates with size N x 2." <- You mean that's the input for just one of the lines? So you have _two_ NumPy arrays of shape `(N, 2)`? Do they both have the same `N`? – Mark Dickinson Nov 26 '17 at 09:59
  • Dang, should I repost this question...? And yeah there are two NumPy arrays sorry. I should mention that they are different in size, so one is `(N, 2)` and the other is `(M, 2)`. – jlcv Nov 26 '17 at 20:57

0 Answers0