line-simplification: Just a copy of mbostock's code.