Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low-level handling of degenerate polygons #45

Closed
rhattersley opened this issue Sep 21, 2012 · 1 comment · Fixed by #545
Closed

Low-level handling of degenerate polygons #45

rhattersley opened this issue Sep 21, 2012 · 1 comment · Fixed by #545

Comments

@rhattersley
Copy link
Member

Projection._project_polygon() is rather unhelpfully converting degenerate polygons (such as those produced by matplotlib.contourf) into global extent.
e.g.
Polygon([(20, 20), (20, 20), (20, 20), (20, 20)])
Polygon([(20, 20), (20, 20), (20, 20.1), (20, 20)])

Whilst it's easy to filter these out in the MPL integration layer, ideally the low level re-projection code should be able to deal with them.

@pelson
Copy link
Member

pelson commented Oct 15, 2014

Actually, it turns out that many of the most common clipping algorithms don't handle degenerate polygons (d3 suffers from this problem too: d3/d3#2025). Essentially, the cutting operation can be seen as an extension of a clip (you keep both sides instead of just one side), so picking an algorithm which handles degeneracies is critical. The truth is though, we could just as well pre-process degenerate "polygons" and either remove them entirely, or convert them to lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants