| 642 | } |
| 643 | |
| 644 | bool pointInPolygon(const Point3d& point, const std::vector<Point3d>& polygon, double tol) { |
| 645 | // convert vertices to boost rings |
| 646 | std::vector<Point3d> allPoints; |
| 647 | |
| 648 | boost::optional<BoostRing> boostPolygon = nonIntersectingBoostRingFromVertices(polygon, allPoints, tol); |
| 649 | if (!boostPolygon) { |
| 650 | return false; |
| 651 | } |
| 652 | |
| 653 | if (std::abs(point.z()) > tol) { |
| 654 | return false; |
| 655 | } |
| 656 | |
| 657 | boost::tuple<double, double> p = boostPointFromPoint3d(point, allPoints, tol); |
| 658 | const BoostPoint boostPoint(p.get<0>(), p.get<1>()); |
| 659 | |
| 660 | //boost::geometry::strategy::within::winding<BoostPoint> strategy; |
| 661 | //boost::geometry::strategy::within::franklin<BoostPoint> strategy; |
| 662 | //boost::geometry::strategy::within::crossings_multiply<BoostPoint> strategy; |
| 663 | //bool result = boost::geometry::within(boostPoint, *boostPolygon, strategy); |
| 664 | |
| 665 | //bool result = boost::geometry::intersects(boostPoint, *boostPolygon); |
| 666 | |
| 667 | //bool result = boost::geometry::overlaps(boostPoint, *boostPolygon); |
| 668 | |
| 669 | const double distance = boost::geometry::distance(boostPoint, *boostPolygon); |
| 670 | const bool result = (distance <= 0.0001); |
| 671 | |
| 672 | return result; |
| 673 | } |
| 674 | |
| 675 | boost::optional<std::vector<Point3d>> join(const std::vector<Point3d>& polygon1, const std::vector<Point3d>& polygon2, double tol) { |
| 676 | // convert vertices to boost rings |