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

Cut inner ring from outer ring when edge is colinear #97

Closed
e-n-f opened this issue Oct 12, 2015 · 10 comments
Closed

Cut inner ring from outer ring when edge is colinear #97

e-n-f opened this issue Oct 12, 2015 · 10 comments

Comments

@e-n-f
Copy link
Contributor

e-n-f commented Oct 12, 2015

@springmeyer says that when mapnik-vt clips a polygon with a hole along a line that cuts through both the inner and outer ring, it turns it into a single ring with the hole cut out instead of two rings with a colinear edge, and that tippecanoe should do this too.

@e-n-f
Copy link
Contributor Author

e-n-f commented Oct 13, 2015

For what it's worth, geojson-vt doesn't do this, and leaves both rings on the edge, so if this is a requirement, it probably needs to do it too.

Example donut and as clipped by geojson-vt and (not yet merged to master) tippecanoe: https://gist.github.com/ericfischer/ea8e7c6545390871a705

cc @mourner @jakepruitt

@mourner
Copy link
Member

mourner commented Oct 13, 2015

@ericfischer do you mean there should be no degenerate edges at the top and the bottom in the example? This is what full clipping with StrictlySimple would do, although I don't think this is required for Earcut tessellation. "Artifacts" like this are not harmful and often expected on clipping algorithms like Sutherland-Hodgeman.

@e-n-f
Copy link
Contributor Author

e-n-f commented Oct 13, 2015

@mourner I am satisfied with the current (Sutherland-Hodgeman) behavior but got the impression from @springmeyer that StrictlySimple-style clipping to remove the degenerate edges was now required. @springmeyer can you clarify?

@mourner
Copy link
Member

mourner commented Oct 13, 2015

@ericfischer I mean, for guaranteed valid polygons, you have to run StrictlySimple-style clipping post-processing on all tiles. There's no point doing something specifically for the case above without addressing any other possible artifacts (mainly caused by simplification).

@e-n-f
Copy link
Contributor Author

e-n-f commented Oct 13, 2015

OK. But is strict simplicity for polygons now required, or isn't it?

@mourner
Copy link
Member

mourner commented Oct 13, 2015

@ericfischer it will be if we want to rip the benefits of much faster tessellation on both GL JS and GL Native.

@e-n-f
Copy link
Contributor Author

e-n-f commented Oct 13, 2015

Thanks @mourner. I'm changing tippecanoe now to use Clipper instead of my own clipping implementation.

@e-n-f
Copy link
Contributor Author

e-n-f commented Oct 13, 2015

Hmm. I am using Clipper with StrictlySimple now, and getting exactly the same result back: an outer polygon and inner hole, not two outer rings. I wonder how mapnik is seeing anything different.

@springmeyer
Copy link
Contributor

Hmm. I am using Clipper with StrictlySimple now, and getting exactly the same result back: an outer polygon and inner hole, not two outer rings. I wonder how mapnik is seeing anything different.

Okay, then perhaps I'm wrong. Let's lean on @jakepruitt to confirm exactly what mapnik-vt is producing.

@e-n-f
Copy link
Contributor Author

e-n-f commented Oct 20, 2015

Doing another StrictlySimple after simplifying and scaling produces two outer rings.

@e-n-f e-n-f closed this as completed Oct 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants