Function openrailwaymap_exporter::algorithms::points_in_front
source · pub fn points_in_front(
linestring: &LineString<f64>,
current_location: Coord<f64>,
target_direction: Coord<f64>
) -> Vec<Coord<f64>>
Expand description
Returns the points in front of the current location in a given LineString
.
Examples
use geo::{line_string, coord};
use openrailwaymap_exporter::algorithms::{closest_point_in_linestring, points_in_front};
let linestring = line_string![
coord! { x: 0.0, y: 0.0 },
coord! { x: 0.0, y: 10.0 },
coord! { x: 50.0, y: 50.0 },
coord! { x: 100.0, y: 100.0 },
];
let current_location = coord! { x: 10.0, y: 20.0 };
let target_direction = coord! { x: 100.0, y: 100.0 };
let points = points_in_front(&linestring, current_location, target_direction);
assert_eq!(points, vec![coord! { x: 50.0, y: 50.0 }, coord! { x: 100.0, y: 100.0 }]);