Skip to main content

Module closest_points

Module closest_points 

Source
Expand description

closest_points(&a, &b) -> (Point, Point) — nearest-point pair.

Mirrors boost::geometry::closest_points(g1, g2, segment_out) from boost/geometry/algorithms/closest_points.hpp. Boost returns the closest pair as a Segment; the Rust port returns a (Point, Point) tuple — same information, no Segment::new boilerplate at the call site. The first returned point lies on a, the second on b.

v1 ships the Cartesian pairs the Boost test fixtures cover: point↔point, point↔segment, segment↔segment, and linestring↔linestring. The areal (polygon) pairs depend on overlay machinery and land in phase_03.

Functions§

closest_points
Return the pair of nearest points on (a, b)(pa, pb) where pa lies on a, pb on b, and |pa − pb| is minimal.
closest_points_with
Return the nearest-point pair using an explicitly supplied strategy.