[−][src]Trait geo::algorithm::line_locate_point::LineLocatePoint
Returns a fraction of the line's total length representing the location of the closest point on the line to the given point.
Examples
use geo::{LineString, point}; use geo::algorithm::line_locate_point::LineLocatePoint; let linestring: LineString<f64> = vec![ [-1.0, 0.0], [0.0, 0.0], [0.0, 1.0] ].into(); assert_eq!(linestring.line_locate_point(&point!(x: -1.0, y: 0.0)), 0.0); assert_eq!(linestring.line_locate_point(&point!(x: -0.5, y: 0.0)), 0.25); assert_eq!(linestring.line_locate_point(&point!(x: 0.0, y: 0.0)), 0.5); assert_eq!(linestring.line_locate_point(&point!(x: 0.0, y: 0.5)), 0.75); assert_eq!(linestring.line_locate_point(&point!(x: 0.0, y: 1.0)), 1.0);
Associated Types
Loading content...Required methods
fn line_locate_point(&self, p: &Rhs) -> Self::Output
Implementors
impl<T> LineLocatePoint<T, Point<T>> for Line<T> where
T: CoordinateType + Float + Zero + One,
[src]
T: CoordinateType + Float + Zero + One,
impl<T> LineLocatePoint<T, Point<T>> for LineString<T> where
T: CoordinateType + Float + Zero + One + PartialOrd + AddAssign,
Line<T>: EuclideanDistance<T, Point<T>> + EuclideanLength<T>,
[src]
T: CoordinateType + Float + Zero + One + PartialOrd + AddAssign,
Line<T>: EuclideanDistance<T, Point<T>> + EuclideanLength<T>,