Struct geom::polyline::PolyLine [−][src]
Fields
pts: Vec<Pt2D>
length: Distance
Implementations
impl PolyLine
[src]
impl PolyLine
[src]pub fn new(pts: Vec<Pt2D>) -> Result<PolyLine>
[src]
pub fn must_new(pts: Vec<Pt2D>) -> PolyLine
[src]
pub fn unchecked_new(pts: Vec<Pt2D>) -> PolyLine
[src]
Doesn’t check for duplicates. Use at your own risk.
pub fn deduping_new(pts: Vec<Pt2D>) -> Result<PolyLine>
[src]
First dedupes adjacent points
pub fn to_thick_ring(&self, width: Distance) -> Ring
[src]
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>
[src]
&self,
self_width: Distance,
boundary_width: Distance
) -> Option<Polygon>
pub fn reversed(&self) -> PolyLine
[src]
pub fn extend(self, other: PolyLine) -> Result<PolyLine>
[src]
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
.
pub fn must_extend(self, other: PolyLine) -> PolyLine
[src]
Like extend
, but panics on failure.
pub fn optionally_push(self, pt: Pt2D) -> PolyLine
[src]
Extends self
by a single point. If the new point is close enough to the last, dedupes.
Doesn’t clean up any intermediate points.
pub fn force_extend(self, other: PolyLine) -> Result<PolyLine>
[src]
Like extend
, but handles the last and first point not matching by inserting that point.
Doesn’t clean up any intermediate points.
pub fn append(first: Vec<Pt2D>, second: Vec<Pt2D>) -> Result<Vec<Pt2D>>
[src]
One or both args might be empty.
pub fn points(&self) -> &Vec<Pt2D>
[src]
pub fn into_points(self) -> Vec<Pt2D>
[src]
pub fn lines(&self) -> impl Iterator<Item = Line> + '_
[src]
pub fn length(&self) -> Distance
[src]
pub fn slice(
&self,
start: Distance,
end: Distance
) -> Result<(PolyLine, Distance)>
[src]
&self,
start: Distance,
end: Distance
) -> Result<(PolyLine, Distance)>
Returns the excess distance left over from the end
pub fn exact_slice(&self, start: Distance, end: Distance) -> PolyLine
[src]
No excess leftover distance allowed.
pub fn maybe_exact_slice(
&self,
start: Distance,
end: Distance
) -> Result<PolyLine>
[src]
&self,
start: Distance,
end: Distance
) -> Result<PolyLine>
pub fn first_half(&self) -> PolyLine
[src]
pub fn second_half(&self) -> PolyLine
[src]
pub fn dist_along(&self, dist_along: Distance) -> Result<(Pt2D, Angle)>
[src]
pub fn must_dist_along(&self, dist_along: Distance) -> (Pt2D, Angle)
[src]
pub fn middle(&self) -> Pt2D
[src]
pub fn first_pt(&self) -> Pt2D
[src]
pub fn last_pt(&self) -> Pt2D
[src]
pub fn first_line(&self) -> Line
[src]
pub fn last_line(&self) -> Line
[src]
pub fn shift_right(&self, width: Distance) -> Result<PolyLine>
[src]
pub fn must_shift_right(&self, width: Distance) -> PolyLine
[src]
pub fn shift_left(&self, width: Distance) -> Result<PolyLine>
[src]
pub fn must_shift_left(&self, width: Distance) -> PolyLine
[src]
pub fn shift_either_direction(&self, width: Distance) -> Result<PolyLine>
[src]
Perpendicularly shifts the polyline to the right if positive or left if negative.
fn shift_with_corrections(&self, width: Distance) -> Result<PolyLine>
[src]
fn shift_with_sharp_angles(
&self,
width: Distance,
miter_threshold: f64
) -> Vec<Pt2D>
[src]
&self,
width: Distance,
miter_threshold: f64
) -> Vec<Pt2D>
pub fn make_polygons(&self, width: Distance) -> Polygon
[src]
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
[src]
&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>
[src]
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance
) -> Vec<Polygon>
pub fn dashed_lines(
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance
) -> Vec<Polygon>
[src]
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance
) -> Vec<Polygon>
Don’t draw the dashes too close to the ends.
pub fn maybe_make_arrow(
&self,
thickness: Distance,
cap: ArrowCap
) -> Option<Polygon>
[src]
&self,
thickness: Distance,
cap: ArrowCap
) -> Option<Polygon>
Fail if the length is too short.
pub fn make_arrow(&self, thickness: Distance, cap: ArrowCap) -> Polygon
[src]
If the length is too short, just give up and make the thick line
pub fn make_double_arrow(&self, thickness: Distance, cap: ArrowCap) -> Polygon
[src]
pub fn dashed_arrow(
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance,
cap: ArrowCap
) -> Vec<Polygon>
[src]
&self,
width: Distance,
dash_len: Distance,
dash_separation: Distance,
cap: ArrowCap
) -> Vec<Polygon>
pub fn intersection(&self, other: &PolyLine) -> Option<(Pt2D, Angle)>
[src]
Also return the angle of the line where the hit was found
pub fn intersection_infinite(&self, other: &InfiniteLine) -> Option<Pt2D>
[src]
pub fn get_slice_ending_at(&self, pt: Pt2D) -> Option<PolyLine>
[src]
Panics if the pt is not on the polyline. Returns None if the point is the first point (meaning the slice is empty).
pub fn get_slice_starting_at(&self, pt: Pt2D) -> Option<PolyLine>
[src]
Returns None if the point is the last point.
pub fn safe_get_slice_ending_at(&self, pt: Pt2D) -> Option<PolyLine>
[src]
Same as get_slice_ending_at, but returns None if the point isn’t on the polyline.
pub fn safe_get_slice_starting_at(&self, pt: Pt2D) -> Option<PolyLine>
[src]
Same as get_slice_starting_at, but returns None if the point isn’t on the polyline.
pub fn dist_along_of_point(&self, pt: Pt2D) -> Option<(Distance, Angle)>
[src]
pub fn trim_to_endpts(&self, pt1: Pt2D, pt2: Pt2D) -> PolyLine
[src]
pub fn get_bounds(&self) -> Bounds
[src]
pub fn extend_to_length(&self, min_len: Distance) -> PolyLine
[src]
If the current line is at least this long, return it. Otherwise, extend the end of it, following the angle of the last line.
pub fn to_geojson(&self, gps: Option<&GPSBounds>) -> Geometry
[src]
Produces a GeoJSON linestring, optionally mapping the world-space points back to GPS.
pub fn project_pt(&self, query: Pt2D) -> Pt2D
[src]
Returns the point on the polyline closest to the query.
pub fn overall_angle(&self) -> Angle
[src]
Returns the angle from the start to end of this polyline.
pub(crate) fn to_geo(&self) -> LineString<f64>
[src]
pub fn step_along(
&self,
step_size: Distance,
buffer_ends: Distance
) -> Vec<(Pt2D, Angle)>
[src]
&self,
step_size: Distance,
buffer_ends: Distance
) -> Vec<(Pt2D, Angle)>
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.
pub fn step_along_start_end(
&self,
step_size: Distance,
start_buffer: Distance,
end_buffer: Distance
) -> Vec<(Pt2D, Angle)>
[src]
&self,
step_size: Distance,
start_buffer: Distance,
end_buffer: Distance
) -> Vec<(Pt2D, Angle)>
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.
pub fn interpolate_points(&self, max_step: Distance) -> PolyLine
[src]
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
impl<'de> Deserialize<'de> for PolyLine
[src]
impl<'de> Deserialize<'de> for PolyLine
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl StructuralPartialEq for PolyLine
[src]
Auto Trait Implementations
impl RefUnwindSafe for PolyLine
impl Send for PolyLine
impl Sync for PolyLine
impl Unpin for PolyLine
impl UnwindSafe for PolyLine
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,