| 14 | |
| 15 | namespace LongEdgeRemovalHelper { |
| 16 | void split(std::list<VectorF>& end_points, |
| 17 | std::list<VectorF>::iterator begin_itr, |
| 18 | Float length, Float threshold) { |
| 19 | if (length <= threshold) return; |
| 20 | if (!std::isfinite(length)) return; |
| 21 | |
| 22 | auto end_itr = std::next(begin_itr); |
| 23 | assert(end_itr != end_points.end()); |
| 24 | const auto& v1 = *begin_itr; |
| 25 | const auto& v2 = *end_itr; |
| 26 | VectorF mid = 0.5 * (v1 + v2); |
| 27 | Float half_length = length * 0.5; |
| 28 | auto mid_itr = end_points.insert(end_itr, mid); |
| 29 | |
| 30 | split(end_points, begin_itr, half_length, threshold); |
| 31 | split(end_points, mid_itr, half_length, threshold); |
| 32 | } |
| 33 | } |
| 34 | using namespace LongEdgeRemovalHelper; |
| 35 |
no test coverage detected