Do the same for interpolations:


Edit

                    threads.emplace_back([&, t]() {
                        auto& local = thread_maps[t].interps;
                        while (true) {
                            size_t i = interp_idx.fetch_add(1);
                            if (i >= data.deferred_interps.size()) break;
                            const auto& di = data.deferred_interps[i];
                            std::unordered_set<uint64_t> cells;
                            for (uint8_t j = 0; j + 1 < di.node_count; j++) {
                                const auto& n1 = data.interp_nodes[di.node_offset + j];
                                const auto& n2 = data.interp_nodes[di.node_offset + j + 1];
                                auto edge_cells = cover_edge(n1.lat, n1.lng, n2.lat, n2.lng);
                                for (const auto& c : edge_cells) {
                                    cells.insert(c.id());
                                }
                            }
                            for (uint64_t cell_id : cells) {
                                local[cell_id].push_back(di.interp_id);
                            }
                        }
                    });

                    threads.emplace_back([&, t]() {
                        auto& local = thread_maps[t].interps;
                        std::vector<S2CellId> edge_cells;
                        std::vector<uint64_t> way_cells;
                        while (true) {
                            size_t i = interp_idx.fetch_add(1);
                            if (i >= data.deferred_interps.size()) break;
                            const auto& di = data.deferred_interps[i];
                            way_cells.clear();
                            for (uint8_t j = 0; j + 1 < di.node_count; j++) {
                                const auto& n1 = data.interp_nodes[di.node_offset + j];
                                const auto& n2 = data.interp_nodes[di.node_offset + j + 1];
                                cover_edge(n1.lat, n1.lng, n2.lat, n2.lng, edge_cells);
                                for (const auto& c : edge_cells) {
                                    way_cells.push_back(c.id());
                                }
                            }
                            std::sort(way_cells.begin(), way_cells.end());
                            way_cells.erase(std::unique(way_cells.begin(), way_cells.end()), way_cells.end());
                            for (uint64_t cell_id : way_cells) {
                                local[cell_id].push_back(di.interp_id);
                            }
                        }
                    });