Skip to main content

closest_points

Function closest_points 

Source
pub fn closest_points<A, B>(
    a: &A,
    b: &B,
) -> (<CartesianClosestPoints as ClosestPointsStrategy<A, B>>::Out, <CartesianClosestPoints as ClosestPointsStrategy<A, B>>::Out)
Expand description

Return the pair of nearest points on (a, b)(pa, pb) where pa lies on a, pb on b, and |pa − pb| is minimal.

Mirrors boost::geometry::closest_points from boost/geometry/algorithms/closest_points.hpp. The distance between the returned points equals the geometry-pair distance distance(a, b).

§Panics

Panics if a linestring operand has fewer than 2 points — Boost treats empty input as an error (empty_input_exception); the Rust port panics with a clear message. Point and segment operands cannot be empty and never panic.