Trait geo::algorithm::closest_point::ClosestPoint [−][src]
pub trait ClosestPoint<F: Float, Rhs = Point<F>> { fn closest_point(&self, p: &Rhs) -> Closest<F>; }
Find the closest point between two objects, where the other object is
assumed to be a Point by default.
Examples
Here's a simple example where we've got a horizontal line which goes
through (-50, 0) -> (50, 0) and want to find the closest point to
(0, 100). If you draw it out on paper the point on the line which is
closest to (0, 100) will be the origin.
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
fn closest_point(&self, p: &Rhs) -> Closest<F>
Find the closest point between self and p.
Implementations on Foreign Types
impl<'a, F, C> ClosestPoint<F> for &'a C where
C: ClosestPoint<F>,
F: Float, [src]
impl<'a, F, C> ClosestPoint<F> for &'a C where
C: ClosestPoint<F>,
F: Float, fn closest_point(&self, p: &Point<F>) -> Closest<F>[src]
fn closest_point(&self, p: &Point<F>) -> Closest<F>Implementors
impl<F: Float> ClosestPoint<F> for Point<F>impl<F: Float> ClosestPoint<F> for Line<F>impl<F: Float> ClosestPoint<F> for LineString<F>impl<F: Float> ClosestPoint<F> for Polygon<F>impl<F: Float> ClosestPoint<F> for MultiPolygon<F>impl<F: Float> ClosestPoint<F> for MultiPoint<F>impl<F: Float> ClosestPoint<F> for MultiLineString<F>