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

Function verticesFromBoostRing

src/utilities/geometry/Intersection.cpp:480–509  ·  view source on GitHub ↗

convert a boost ring to vertices

Source from the content-addressed store, hash-verified

478
479// convert a boost ring to vertices
480std::vector<Point3d> verticesFromBoostRing(const BoostRing& ring, std::vector<Point3d>& allPoints, double tol) {
481 std::vector<Point3d> result;
482
483 // add point for each vertex except final vertex
484 for (unsigned i = 0; i < ring.size() - 1; ++i) {
485 const Point3d point3d(ring[i].x(), ring[i].y(), 0.0);
486
487 // try to combine points within tolerance
488 Point3d resultPoint = getCombinedPoint(point3d, allPoints, tol);
489
490 // don't keep repeated vertices
491 if ((i > 0) && (result.back() == resultPoint)) {
492 continue;
493 }
494 result.emplace_back(std::move(resultPoint));
495 }
496
497 result = removeCollinearLegacy(result);
498
499 // don't keep repeated vertices
500 if (result.front() == result.back()) {
501 result.pop_back();
502 }
503
504 if (result.size() < 3) {
505 return {};
506 }
507
508 return result;
509}
510
511// struct used to sort polygons in descending order by area
512struct BoostPolygonAreaGreater

Callers

nothing calls this directly

Calls 6

getCombinedPointFunction · 0.85
removeCollinearLegacyFunction · 0.85
pop_backMethod · 0.80
sizeMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected