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

improve round line joins for semi-transparent lines #1359

Merged
merged 1 commit into from Jul 8, 2015
Merged

Conversation

ansis
Copy link
Contributor

@ansis ansis commented Jul 6, 2015

Round line joins used to be drawn by adding a semicircle cap to the end of each segment. This looked fine for opaque lines not for semi-transparent lines.

This changes the triangulation so that round line joins don't overlap with segments. The gap between segments is filled with small triangles that look like pie slices. The edge of the round linejoin is made up of many short straight lines that look round at the sizes we draw lines.

Since sharp angles are infrequent, this does not significantly affect the total number of triangles created.

Joins for angles that are really sharp are still drawn with overlap.

screen shot 2015-07-06 at 2 03 56 pm

@kkaefer want to review?

ansis added a commit to mapbox/mapbox-gl-test-suite that referenced this pull request Jul 6, 2015
ansis added a commit to mapbox/mapbox-gl-native that referenced this pull request Jul 6, 2015
mapbox/mapbox-gl-js#1359

Round line joins used to be drawn by adding a semicircle cap to the end
of each segment. This looked fine for opaque lines not for
semi-transparent lines.

This changes the triangulation so that round line joins don't overlap
with segments. The gap between segments is filled with small triangles
that look like pie slices. The edge of the round linejoin is made up of
many short straight lines that look round at the sizes we draw lines.

Since sharp angles are infrequent, this does not significantly affect
the total number of triangles created.

Joins for angles that are really sharp are still drawn with overlap.
@kkaefer
Copy link
Contributor

kkaefer commented Jul 6, 2015

Looks good. It'd be cool to get tests that check the created buffers for a few edge cases and make sure that the algorithm in native produces the same results.

@incanus
Copy link
Contributor

incanus commented Jul 6, 2015

Get it? Edge cases...

@jfirebaugh
Copy link
Contributor

Nice!

Round line joins used to be drawn by adding a semicircle cap to the end
of each segment. This looked fine for opaque lines not for
semi-transparent lines.

This changes the triangulation so that round line joins don't overlap
with segments. The gap between segments is filled with small triangles
that look like pie slices. The edge of the round linejoin is made up of
many short straight lines that look round at the sizes we draw lines.

Since sharp angles are infrequent, this does not significantly affect
the total number of triangles created.

Joins for angles that are really sharp are still drawn with overlap.
@ansis
Copy link
Contributor Author

ansis commented Jul 8, 2015

I added an extra render test but I'll skip testing buffers directly for now.

@ansis ansis deleted the round-join branch July 8, 2015 11:07
ansis added a commit to mapbox/mapbox-gl-native that referenced this pull request Jul 8, 2015
mapbox/mapbox-gl-js#1359

Round line joins used to be drawn by adding a semicircle cap to the end
of each segment. This looked fine for opaque lines not for
semi-transparent lines.

This changes the triangulation so that round line joins don't overlap
with segments. The gap between segments is filled with small triangles
that look like pie slices. The edge of the round linejoin is made up of
many short straight lines that look round at the sizes we draw lines.

Since sharp angles are infrequent, this does not significantly affect
the total number of triangles created.

Joins for angles that are really sharp are still drawn with overlap.
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

Successfully merging this pull request may close these issues.

None yet

4 participants