Skip to main content

distance_dyn

Function distance_dyn 

Source
pub fn distance_dyn<S, Cs>(
    a: &DynGeometry<S, Cs>,
    b: &DynGeometry<S, Cs>,
) -> Result<S, DynKindMismatch>
where S: CoordinateScalar, Cs: CoordinateSystem + Copy, Cs::Family: SameAs<CartesianFamily> + DefaultDistance<Cs::Family>, DefaultDistanceStrategy<Point<S, 2, Cs>, Point<S, 2, Cs>>: DistanceStrategy<Point<S, 2, Cs>, Point<S, 2, Cs>, Out = S> + Default, PointToSegment<Pythagoras>: DistanceStrategy<Point<S, 2, Cs>, Segment<Point<S, 2, Cs>>, Out = S>,
Expand description

Runtime-dispatched distance.

Returns Ok(d) for any pair v1’s static distance supports (point-point, and point-linestring via PointToSegment).

The Cartesian family bound reflects that PointToSegment (T24) is Cartesian-only in v1; point-point works for any family, but the shared bound keeps the wrapper’s where clause a single line.

§Errors

Returns Err(DynKindMismatch) for any kind pair with no static distance impl (e.g. polygon-polygon).

§Panics

Panics on an empty linestring: there is no point to measure to, and 0 would read as “touching”. Boost throws empty_input_exception here; the port panics with a clear message, as discrete_hausdorff_distance does.