Struct geom::PolyLine [−][src]
Fields
pts: Vec<Pt2D>
length: Distance
Implementations
Doesn’t check for duplicates. Use at your own risk.
Like make_polygons, but make sure the points actually form a ring.
pub fn to_thick_boundary(
&self,
self_width: Distance,
boundary_width: Distance
) -> Option<Polygon>
Glue together two polylines in order. The last point of self
must be the same as the
first point of other
. This method handles removing unnecessary intermediate points if the
extension happens to be at the same angle as the last line segment of self
.
Like extend
, but panics on failure.
Extends self
by a single point. If the new point is close enough to the last, dedupes.
Doesn’t clean up any intermediate points.
Like extend
, but handles the last and first point not matching by inserting that point.
Doesn’t clean up any intermediate points.
One or both args might be empty.
pub fn into_points(self) -> Vec<Pt2D>ⓘ
Returns the excess distance left over from the end
No excess leftover distance allowed.
Perpendicularly shifts the polyline to the right if positive or left if negative.
fn shift_with_sharp_angles(
&self,
width: Distance,
miter_threshold: f64
) -> Vec<Pt2D>ⓘ
The resulting polygon is manually triangulated and may not have a valid outer Ring (but it usually does).
pub fn make_polygons_with_miter_threshold(
&self,
width: Distance,
miter_threshold: f64
) -> Polygon
pub fn make_polygons_with_miter_threshold(
&self,
width: Distance,
miter_threshold: f64
) -> Polygon
The resulting polygon is manually triangulated and may not have a valid outer Ring (but it usually does).
pub fn exact_dashed_polygons(
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance
) -> Vec<Polygon>ⓘ
Don’t draw the dashes too close to the ends.
Fail if the length is too short.
If the length is too short, just give up and make the thick line
pub fn dashed_arrow(
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance,
cap: ArrowCap
) -> Vec<Polygon>ⓘ
Also return the angle of the line where the hit was found
Panics if the pt is not on the polyline. Returns None if the point is the first point (meaning the slice is empty).
Returns None if the point is the last point.
Same as get_slice_ending_at, but returns None if the point isn’t on the polyline.
Same as get_slice_starting_at, but returns None if the point isn’t on the polyline.
If the current line is at least this long, return it. Otherwise, extend the end of it, following the angle of the last line.
Produces a GeoJSON linestring, optionally mapping the world-space points back to GPS.
Returns the point on the polyline closest to the query.
Returns the angle from the start to end of this polyline.
Walk along the PolyLine, starting buffer_ends
from the start and ending buffer_ends
before the end. Advance in increments of step_size
. Returns the point and angle at each
step.
Walk along the PolyLine, from start_buffer
to length - end_buffer
. Advance in
increments of step_size
. Returns the point and angle at each step.
use geom::{PolyLine, Pt2D, Distance};
let polyline = PolyLine::must_new(vec![
Pt2D::new(0.0, 0.0),
Pt2D::new(0.0, 10.0),
Pt2D::new(10.0, 20.0),
]);
assert_eq!(
polyline.interpolate_points(Distance::meters(20.0)).points(),
&vec![
Pt2D::new(0.0, 0.0),
Pt2D::new(0.0, 10.0),
Pt2D::new(10.0, 20.0),
]
);
assert_eq!(
polyline.interpolate_points(Distance::meters(10.0)).points(),
&vec![
Pt2D::new(0.0, 0.0),
Pt2D::new(0.0, 10.0),
Pt2D::new(5.0, 15.0),
Pt2D::new(10.0, 20.0),
]
);
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for PolyLine
impl UnwindSafe for PolyLine
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self