mapbox / mapbox/wagyu

Return early if original polygons don't require fixing

Open
#98 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
197
Forks
37
PR merge metrics
No merged PRs in 30d

Description

In context of https://github.com/mapbox/mapbox-gl-native/issues/15268: if the original polygons are correct, there is no need to provide result that reorders original and return true.
Client then constructs another container, copying and casting all returned to domain specific type... e.g
https://github.com/mapbox/mapbox-gl-native/blob/273ad436fb4d2a18c6749bd4e40fa56546e9285c/src/mbgl/tile/geometry_tile_data.cpp#L51

In context of wagyu code, bookkeeping the dirty state would enable return statement after correct_topology:

```
template
bool execute(clip_type cliptype,
mapbox::geometry::multi_polygon& solution,
fill_type subject_fill_type,
fill_type clip_fill_type) {

if (minima_list.empty()) {
return false;
}

ring_manager manager;

build_hot_pixels(minima_list, manager);

execute_vatti(minima_list, manager, cliptype, subject_fill_type, clip_fill_type);

correct_topology(manager);

build_result(solution, manager, reverse_output);

return true;
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the execute function shown in the issue and inspect correct_topology, build_result, and the ring/minima bookkeeping around them. Compare the behavior with the linked geometry_tile_data.cpp caller. Done means already-correct original polygons can return without rebuilding or reordering the result, while cases requiring fixing still produce the existing result and return value.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.