google / google/s2geometry

Documentation example code invalid for latest library version

Open
#628 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.7k
Forks
357
Avg merge
11h 4m
Merged PRs (30d)
1

Description

From https://s2geometry.io/devguide/s2shapeindex.html:
```
void TestContainment(const vector& points,
const vector& polygons) {
MutableS2ShapeIndex index;
for (auto polygon : polygons) {
index.Add(absl::make_unique(polygon));
}
auto query = MakeS2ContainsPointQuery(&index);
for (const auto& point: points) {
for (S2Shape* shape : query.GetContainingShapes(point)) {
S2Polygon* polygon = polygons[shape->id()];
... do something with (point, polygon) ...
}
}
}
```

This code does not compile for several reasons:
- `GetContainingShapes` now returns `std::vector`
- There is no `id()` function in `S2Shape` (removed in this commit: https://github.com/google/s2geometry/commit/84bfd2c5a7f38d46d48422b50f051e8be6a18f83)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.