[][src]Trait geo::algorithm::closest_point::ClosestPoint

pub trait ClosestPoint<F: Float, Rhs = Point<F>> {
    pub fn closest_point(&self, p: &Rhs) -> Closest<F>;
}

Find the closest Point between a given geometry and an input Point. The closest point may intersect the geometry, be a single point, or be indeterminate, as indicated by the value of the returned enum.

Examples

We have a horizontal line which goes through (-50, 0) -> (50, 0), and want to find the closest point to the point (0, 100). Drawn on paper, the point on the line which is closest to (0, 100) is the origin (0, 0).

let p: Point<f32> = Point::new(0.0, 100.0);
let horizontal_line: Line<f32> = Line::new(Point::new(-50.0, 0.0), Point::new(50.0, 0.0));

let closest = horizontal_line.closest_point(&p);
assert_eq!(closest, Closest::SinglePoint(Point::new(0.0, 0.0)));

Required methods

pub fn closest_point(&self, p: &Rhs) -> Closest<F>[src]

Find the closest point between self and p.

Loading content...

Implementations on Foreign Types

impl<'a, F, C> ClosestPoint<F, Point<F>> for &'a C where
    C: ClosestPoint<F>,
    F: Float
[src]

Loading content...

Implementors

impl<F: Float + HasKernel> ClosestPoint<F, Point<F>> for Line<F>[src]

impl<F: Float + HasKernel> ClosestPoint<F, Point<F>> for LineString<F>[src]

impl<F: Float + HasKernel> ClosestPoint<F, Point<F>> for MultiLineString<F>[src]

impl<F: Float + HasKernel> ClosestPoint<F, Point<F>> for MultiPolygon<F>[src]

impl<F: Float + HasKernel> ClosestPoint<F, Point<F>> for Polygon<F>[src]

impl<F: Float> ClosestPoint<F, Point<F>> for MultiPoint<F>[src]

impl<F: Float> ClosestPoint<F, Point<F>> for Point<F>[src]

Loading content...