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

Function polygonInPolygon

src/utilities/geometry/Intersection.cpp:613–642  ·  view source on GitHub ↗

cppcheck-suppress constParameterReference

Source from the content-addressed store, hash-verified

611
612// cppcheck-suppress constParameterReference
613bool polygonInPolygon(std::vector<Point3d>& points, const std::vector<Point3d>& polygon, double tol) {
614
615 // convert vertices to boost rings
616 std::vector<Point3d> allPoints;
617
618 boost::optional<BoostRing> boostPolygon = nonIntersectingBoostRingFromVertices(polygon, allPoints, tol);
619 if (!boostPolygon) {
620 return false;
621 }
622
623 if (points.empty()) {
624 return false;
625 }
626
627 for (const Point3d& point : points) {
628 if (std::abs(point.z()) > tol) {
629 return false;
630 }
631 }
632
633 for (const Point3d& point : points) {
634 boost::tuple<double, double> p = boostPointFromPoint3d(point, allPoints, tol);
635 const BoostPoint boostPoint(p.get<0>(), p.get<1>());
636 const double distance = boost::geometry::distance(boostPoint, *boostPolygon);
637 if (distance >= 0.0001) {
638 return false;
639 }
640 }
641 return true;
642}
643
644bool pointInPolygon(const Point3d& point, const std::vector<Point3d>& polygon, double tol) {
645 // convert vertices to boost rings

Callers 1

Calls 5

absFunction · 0.85
boostPointFromPoint3dFunction · 0.85
emptyMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected