Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Conversation

@astojilj
Copy link
Contributor

@astojilj astojilj commented Aug 5, 2019

Restore point order in polygons after polygon fixup.

Algorithm setup and checking if polygon fixup is required would be as expensive as fixing it. So, we don't introduce another step checking if fixup is needed but continue running wagyu for all geojson and, make an attempt to restore original point order in rings, after wagyu. Having a change in starting point of rings caused a disparity between GL-JS and GL-native, visible in implementation of fill-extrusion pattern.

Fixes: #15268

@astojilj astojilj requested a review from flippmoke August 5, 2019 05:33
@astojilj astojilj self-assigned this Aug 5, 2019
@astojilj astojilj added Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS labels Aug 5, 2019
wagyu algorithm setup and checking if polygon fixup is required is expensive as much as fixing it - so we continue running wagyu for all geojson and, if attempt to restore original point order after wagyu.  Even with no polygon fixup, starting point in rings is changed.  This causes a disparity between GL-JS and GL-native, visible in implementation of fill-extrusion pattern.

Fixes: #15268
@astojilj astojilj force-pushed the astojilj-15286 branch 4 times, most recently from b884a94 to 0690b1b Compare August 6, 2019 12:43
return std::move(rings);
}

int i = 0;
Copy link
Contributor

@alexshalamov alexshalamov Aug 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::size_t, int overflows and [i++] would terminate


// Attempts to restore original point order in rings:
// see https://github.com/mapbox/mapbox-gl-native/issues/15268.
static GeometryCollection restorePointOrder(GeometryCollection&& rings, const GeometryCollection& originalRings) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeometryCollection rings and then just return, without move to avoid disabling NRVO


// Attempts to restore original point order in rings:
// see https://github.com/mapbox/mapbox-gl-native/issues/15268.
static GeometryCollection restorePointOrder(GeometryCollection&& rings, const GeometryCollection& originalRings) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nameless namespace instead of static


int i = 0;
for (auto& ring : rings) {
const auto originalRing = originalRings[i++];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto& ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[core] Sync fill-extrusion-pattern sides rendering with GL-JS implementation

3 participants