| 287 | } |
| 288 | |
| 289 | Polygon Polygon::convexHull(Polygon& polygon1, Polygon& polygon2) |
| 290 | { |
| 291 | std::vector<Position> vertices; |
| 292 | vertices.reserve(polygon1.nVertices() + polygon2.nVertices()); |
| 293 | vertices.insert(vertices.end(), polygon1.getVertices().begin(), polygon1.getVertices().end()); |
| 294 | vertices.insert(vertices.end(), polygon2.getVertices().begin(), polygon2.getVertices().end()); |
| 295 | |
| 296 | return monotoneChainConvexHullOfPoints(vertices); |
| 297 | } |
| 298 | |
| 299 | Polygon Polygon::monotoneChainConvexHullOfPoints(const std::vector<Position>& points) |
| 300 | { |