Struct geom::PolyLine[][src]

pub struct PolyLine {
    pts: Vec<Pt2D>,
    length: Distance,
}

Fields

pts: Vec<Pt2D>length: Distance

Implementations

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]

pub fn reversed(&self) -> PolyLine[src]

pub fn extend(self, other: PolyLine) -> Result<PolyLine>[src]

pub fn must_extend(self, other: PolyLine) -> PolyLine[src]

pub fn must_push(self, pt: Pt2D) -> PolyLine[src]

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]

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]

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]

fn shift_with_corrections(&self, width: Distance) -> Result<PolyLine>[src]

fn shift_with_sharp_angles(
    &self,
    width: Distance,
    miter_threshold: f64
) -> Vec<Pt2D>
[src]

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]

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]

pub fn dashed_lines(
    &self,
    width: Distance,
    dash_len: Distance,
    dash_separation: Distance
) -> Vec<Polygon>
[src]

Don’t draw the dashes too close to the ends.

pub fn maybe_make_arrow(
    &self,
    thickness: Distance,
    cap: ArrowCap
) -> Option<Polygon>
[src]

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]

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 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.

Trait Implementations

impl Clone for PolyLine[src]

impl Debug for PolyLine[src]

impl<'de> Deserialize<'de> for PolyLine[src]

impl Display for PolyLine[src]

impl PartialEq<PolyLine> for PolyLine[src]

impl Serialize for PolyLine[src]

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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.