Reduce number of points in line

前端 未结 8 2108
Happy的楠姐
Happy的楠姐 2020-12-05 11:38

I\'m searching for algorithms to reduce the LOD of polylines, lines (looped or not) of nodes. In simple words, I want to take hi-resolution coastline data and be able to re

8条回答
  •  自闭症患者
    2020-12-05 11:53

    In regards to culebron's answer, is the recursive call correct? From what I understand, RDP breaks up a a line into two different lines: start to max, and max to end.

    But looking at the call, where pos is the index of the max dist in the list...

    return (ramerdouglas(line[:pos + 2], dist) + 
            ramerdouglas(line[pos + 1:], dist)[1:])
    

    is instead doing start to max+1, max+1 to end. Shouldn't it be...

    return (ramerdouglas(line[:pos + 1], dist) + 
            ramerdouglas(line[pos:], dist)[1:])
    

提交回复
热议问题