Skip to content

Commit

Permalink
test for polygon simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
quidquid authored and teeparham committed May 18, 2015
1 parent b0443a3 commit d86e4e1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/geos_capi/tc_polygon.rb
Expand Up @@ -79,6 +79,18 @@ def test_union
end


def test_simplify
xys = [[0, 0], [5, 0], [10, 0], [10, 10], [5, 10.2], [0, 10], [0, 0]]
points = xys.collect { |x,y| @factory.point(x, y) }
poly = @factory.polygon(@factory.linear_ring(points))
simplified = poly.simplify(0.3)
new_points = simplified.exterior_ring.points
extra = new_points.reject { |p| [0, 10].include?(p.x) and [0, 10].include?(p.y) }
assert_equal 5, new_points.length, "Closed ring of the square should have 5 points"
assert_equal 0, extra.length , "Should only have x/y's on 0 and 10"
end


end

end
Expand Down

0 comments on commit d86e4e1

Please sign in to comment.