| 164 | } |
| 165 | |
| 166 | void PoseGraph::UpdateEdge(image_t image_id1, |
| 167 | image_t image_id2, |
| 168 | PoseGraph::Edge edge) { |
| 169 | if (ShouldSwapImagePair(image_id1, image_id2)) { |
| 170 | edge.Invert(); |
| 171 | } |
| 172 | const image_pair_t pair_id = ImagePairToPairId(image_id1, image_id2); |
| 173 | auto it = edges_.find(pair_id); |
| 174 | if (it == edges_.end()) { |
| 175 | throw std::runtime_error( |
| 176 | "Image pair does not exist: " + std::to_string(image_id1) + ", " + |
| 177 | std::to_string(image_id2)); |
| 178 | } |
| 179 | it->second = std::move(edge); |
| 180 | } |
| 181 | |
| 182 | bool PoseGraph::IsValid(image_pair_t pair_id) const { |
| 183 | auto it = edges_.find(pair_id); |