cppcheck-suppress constParameterReference
| 611 | |
| 612 | // cppcheck-suppress constParameterReference |
| 613 | bool 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 | |
| 644 | bool pointInPolygon(const Point3d& point, const std::vector<Point3d>& polygon, double tol) { |
| 645 | // convert vertices to boost rings |
no test coverage detected