Skip to content

improve round line joins for semi-transparent lines - #1359

Merged
ansis merged 1 commit into
masterfrom
round-join
Jul 8, 2015
Merged

ansis merged 1 commit into
masterfrom
round-join

Conversation

@ansis

@ansis ansis commented Jul 6, 2015

Copy link
Copy Markdown
Contributor

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

kkaefer commented Jul 6, 2015

Copy link
Copy Markdown
Member

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

incanus commented Jul 6, 2015

Copy link
Copy Markdown
Contributor

Get it? Edge cases...

@jfirebaugh

Copy link
Copy Markdown
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
ansis merged commit 8dc3fe5 into master Jul 8, 2015
@ansis ansis removed the in progress label Jul 8, 2015
@ansis

ansis commented Jul 8, 2015

Copy link
Copy Markdown
Contributor Author

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.

4 participants