| 1094 | } |
| 1095 | |
| 1096 | bool edge_supports_same_line( |
| 1097 | const DPoint& seed_a, |
| 1098 | const DPoint& seed_b, |
| 1099 | const DPoint& test_a, |
| 1100 | const DPoint& test_b, |
| 1101 | double angle_tol_deg = 3., |
| 1102 | double line_dist_tol = 0.15) |
| 1103 | { |
| 1104 | auto d_seed = seed_b - seed_a; |
| 1105 | auto d_test = test_b - test_a; |
| 1106 | if (d_seed.squared_length() < 1.e-18 || d_test.squared_length() < 1.e-18) { |
| 1107 | return false; |
| 1108 | } |
| 1109 | if (angle_between_dirs_deg(d_seed, d_test) > angle_tol_deg) { |
| 1110 | return false; |
| 1111 | } |
| 1112 | return |
| 1113 | point_line_distance(test_a, seed_a, d_seed) <= line_dist_tol && |
| 1114 | point_line_distance(test_b, seed_a, d_seed) <= line_dist_tol; |
| 1115 | } |
| 1116 | |
| 1117 | std::vector<LineRun> runs_from_graph(const CenterLineGraphData& graph, double angle_tol_deg = 3., double line_dist_tol = 0.15) { |
| 1118 | std::vector<bool> visited(graph.edges.size(), false); |
no test coverage detected