PerpDistance

Trait PerpDistance 

Source
pub trait PerpDistance {
    // Required method
    fn d_perp_m(&self, a: LngLat, b: LngLat, p: LngLat) -> f64;
}
Expand description

Trait for calculating perpendicular distance from a point to a line segment.

This abstraction allows the Douglas-Peucker algorithm to work with different distance calculation methods without changing the core algorithm.

Required Methods§

Source

fn d_perp_m(&self, a: LngLat, b: LngLat, p: LngLat) -> f64

Calculate the perpendicular distance from point p to line segment a-b.

§Arguments
  • a - Start point of the line segment
  • b - End point of the line segment
  • p - Point to measure distance from
§Returns

Perpendicular distance in the implementation’s units (usually meters)

Implementors§