| 62 | } |
| 63 | |
| 64 | void look_up(const Matrix2Fr& points, |
| 65 | VectorF& squared_dists, |
| 66 | VectorI& closest_segment_indices) { |
| 67 | const size_t num_pts = points.rows(); |
| 68 | squared_dists.resize(num_pts); |
| 69 | closest_segment_indices.resize(num_pts); |
| 70 | |
| 71 | for (size_t i=0; i<num_pts; i++) { |
| 72 | Point p = to_cgal_point(points.row(i)); |
| 73 | Point_and_primitive_id itr = m_tree->closest_point_and_primitive(p); |
| 74 | closest_segment_indices[i] = itr.second - m_segments.begin(); |
| 75 | Point p2 = itr.first; |
| 76 | squared_dists[i] = (p-p2).squared_length(); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | void look_up_with_closest_points(const Matrix2Fr& points, |
| 81 | VectorF& squared_dists, |
no test coverage detected