Skip to content

Commit

Permalink
Add S2Polygon::InitToSnapped(..., SnapFunction) (google#152)
Browse files Browse the repository at this point in the history
This was declared, but accidentally not defined.

Reimplement InitToSnapped(..., level) using the SnapFunction overload.
  • Loading branch information
jmr authored Oct 16, 2020
1 parent 98f4352 commit fccae08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/s2/s2polygon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -992,9 +992,14 @@ void S2Polygon::InitFromBuilder(const S2Polygon& a, S2Builder* builder) {
}
}

void S2Polygon::InitToSnapped(const S2Polygon& polygon,
const S2Builder::SnapFunction& snap_function) {
S2Builder builder{S2Builder::Options(snap_function)};
InitFromBuilder(polygon, &builder);
}

void S2Polygon::InitToSnapped(const S2Polygon* a, int snap_level) {
S2Builder builder{S2Builder::Options(S2CellIdSnapFunction(snap_level))};
InitFromBuilder(*a, &builder);
InitToSnapped(*a, S2CellIdSnapFunction(snap_level));
}

void S2Polygon::InitToSimplified(const S2Polygon& a,
Expand Down

0 comments on commit fccae08

Please sign in to comment.