MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / BoostPolygonFromPolygon

Function BoostPolygonFromPolygon

src/utilities/geometry/Intersection.cpp:1273–1292  ·  view source on GitHub ↗

Converts a Polygon to a BoostPolygon

Source from the content-addressed store, hash-verified

1271
1272/// Converts a Polygon to a BoostPolygon
1273boost::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
1294Polygon3d PolygonFromBoostPolygon(const BoostPolygon& boostPolygon, Point3dVector& allPoints, double tol) {
1295 Polygon3d p;

Callers 2

joinFunction · 0.85
bufferAllFunction · 0.85

Calls 2

boostPointFromPoint3dFunction · 0.85
getOuterPathMethod · 0.80

Tested by

no test coverage detected