6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/simplify_rb.rb', line 6
def process(points, tolerance = 1, highest_quality = false)
raise ArgumentError.new('Points must be an array') unless points.is_a? Array
return points if points.length <= 1
symbolizer = Symbolizer.new
points = symbolizer.symbolize_keys(points) unless points.all? { |p| symbolizer.keys_are_symbols?(p.keys) }
sq_tolerance = tolerance * tolerance
points = simplify_radial_dist(points, sq_tolerance) unless highest_quality
simplify_douglas_peucker(points, sq_tolerance)
end
|