| 817 | }; |
| 818 | |
| 819 | Polygon_2 subdivide_polygon(double max_distance, const Polygon_2 & p) { |
| 820 | std::vector<Point_2> points; |
| 821 | for (auto it = p.edges_begin(); it != p.edges_end(); ++it) { |
| 822 | const auto& seg = *it; |
| 823 | auto num_splits = (int)std::ceil(std::sqrt(CGAL::to_double(seg.squared_length())) / max_distance) - 1; |
| 824 | points.push_back(seg.source()); |
| 825 | for (auto i = 0; i < num_splits; ++i) { |
| 826 | auto d = (seg.target() - seg.source()) / (num_splits + 1) * (i + 1); |
| 827 | points.push_back(seg.source() + d); |
| 828 | } |
| 829 | } |
| 830 | return Polygon_2(points.begin(), points.end()); |
| 831 | }; |
| 832 | |
| 833 | Polygon_with_holes_2 subdivide_polygon(double max_distance, const Polygon_with_holes_2& pwh) { |
| 834 | Polygon_2 outer = subdivide_polygon(max_distance, pwh.outer_boundary()); |
no test coverage detected