Converts a Polygon to a BoostPolygon
| 1271 | |
| 1272 | /// Converts a Polygon to a BoostPolygon |
| 1273 | boost::optional<BoostPolygon> BoostPolygonFromPolygon(const Polygon3d& polygon, Point3dVector& allPoints, double tol) { |
| 1274 | BoostPolygon boostPolygon; |
| 1275 | |
| 1276 | for (const Point3d& vertex : polygon.getOuterPath()) { |
| 1277 | |
| 1278 | // should all have zero z coordinate now |
| 1279 | //double z = vertex.z(); |
| 1280 | //if (std::abs(z) > tol) { |
| 1281 | // LOG_FREE(Error, "utilities.geometry.boostPolygonFromVertices", "All points must be on z = 0 plane"); |
| 1282 | // return boost::none; |
| 1283 | //} |
| 1284 | boost::geometry::append(boostPolygon, boostPointFromPoint3d(vertex, allPoints, tol)); |
| 1285 | } |
| 1286 | |
| 1287 | const Point3dVector& path = polygon.getOuterPath(); |
| 1288 | const Point3d& first = path.front(); |
| 1289 | boost::geometry::append(boostPolygon, boostPointFromPoint3d(first, allPoints, tol)); |
| 1290 | |
| 1291 | return boostPolygon; |
| 1292 | } |
| 1293 | |
| 1294 | Polygon3d PolygonFromBoostPolygon(const BoostPolygon& boostPolygon, Point3dVector& allPoints, double tol) { |
| 1295 | Polygon3d p; |
no test coverage detected