Terrain curve to array of points
问题 In my 2D game I'm using graphic tools to create nice, smooth terrain represented by black color: Simple algorithm written in java looks for black color every 15 pixels, creating following set of lines (gray): As you can see, there's some places that are mapped very bad, some are pretty good. In other case it would be not necessary to sample every 15 pixels, eg. if terrain is flat. What's the best way to covert this curve to set of points [lines], using as little points as possible? Sampling