[][src]Struct lyon_geom::LineSegment

pub struct LineSegment<S> {
    pub from: Point<S>,
    pub to: Point<S>,
}

A linear segment.

Fields

from: Point<S>to: Point<S>

Methods

impl<S: Scalar> LineSegment<S>[src]

pub fn sample(&self, t: S) -> Point<S>[src]

Sample the segment at t (expecting t between 0 and 1).

pub fn x(&self, t: S) -> S[src]

Sample the x coordinate of the segment at t (expecting t between 0 and 1).

pub fn y(&self, t: S) -> S[src]

Sample the y coordinate of the segment at t (expecting t between 0 and 1).

pub fn from(&self) -> Point<S>[src]

pub fn to(&self) -> Point<S>[src]

pub fn solve_t_for_x(&self, x: S) -> S[src]

pub fn solve_t_for_y(&self, y: S) -> S[src]

pub fn solve_y_for_x(&self, x: S) -> S[src]

pub fn solve_x_for_y(&self, y: S) -> S[src]

pub fn flip(&self) -> Self[src]

Returns an inverted version of this segment where the beginning and the end points are swapped.

pub fn split_range(&self, t_range: Range<S>) -> Self[src]

Return the sub-segment inside a given range of t.

This is equivalent splitting at the range's end points.

pub fn split(&self, t: S) -> (Self, Self)[src]

Split this curve into two sub-segments.

pub fn before_split(&self, t: S) -> Self[src]

Return the segment before the split point.

pub fn after_split(&self, t: S) -> Self[src]

Return the segment after the split point.

pub fn split_at_x(&self, x: S) -> (Self, Self)[src]

pub fn bounding_rect(&self) -> Rect<S>[src]

Return the minimum bounding rectangle

pub fn to_vector(&self) -> Vector<S>[src]

Returns the vector between this segment's from and to points.

pub fn to_line(&self) -> Line<S>[src]

Returns the line containing this segment.

pub fn length(&self) -> S[src]

Computes the length of this segment.

pub fn set_length(&mut self, new_length: S)[src]

Changes the segment's length, moving destination point.

pub fn translate(&mut self, by: Vector<S>) -> Self[src]

pub fn transform(&self, transform: &Transform2D<S>) -> Self[src]

Applies the transform to this segment and returns the results.

pub fn intersection_t(&self, other: &Self) -> Option<(S, S)>[src]

Computes the intersection (if any) between this segment and another one.

The result is provided in the form of the t parameter of each segment. To get the intersection point, sample one of the segments at the corresponding value.

pub fn intersection(&self, other: &Self) -> Option<Point<S>>[src]

pub fn line_intersection_t(&self, line: &Line<S>) -> Option<S>[src]

pub fn line_intersection(&self, line: &Line<S>) -> Option<Point<S>>[src]

pub fn horizontal_line_intersection_t(&self, y: S) -> Option<S>[src]

pub fn vertical_line_intersection_t(&self, x: S) -> Option<S>[src]

pub fn horizontal_line_intersection(&self, y: S) -> Option<Point<S>>[src]

pub fn vertical_line_intersection(&self, x: S) -> Option<Point<S>>[src]

pub fn intersects(&self, other: &Self) -> bool[src]

pub fn intersects_line(&self, line: &Line<S>) -> bool[src]

pub fn overlaps_line(&self, line: &Line<S>) -> bool[src]

pub fn overlaps_segment(&self, other: &LineSegment<S>) -> bool[src]

pub fn contains_segment(&self, other: &LineSegment<S>) -> bool[src]

Trait Implementations

impl<S: Scalar> Segment for LineSegment<S>[src]

type Scalar = S

impl<S: Scalar> FlatteningStep for LineSegment<S>[src]

fn flattened(self, tolerance: Self::Scalar) -> Flattened<Self::Scalar, Self>[src]

Returns the flattened representation of the curve as an iterator, starting after the current point. Read more

impl<S: Copy> Copy for LineSegment<S>[src]

impl<S: Clone> Clone for LineSegment<S>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<S: PartialEq> PartialEq<LineSegment<S>> for LineSegment<S>[src]

impl<S> From<LineSegment<S>> for BezierSegment<S>[src]

impl<S: Debug> Debug for LineSegment<S>[src]

Auto Trait Implementations

impl<S> Unpin for LineSegment<S> where
    S: Unpin

impl<S> Sync for LineSegment<S> where
    S: Sync

impl<S> Send for LineSegment<S> where
    S: Send

impl<S> UnwindSafe for LineSegment<S> where
    S: UnwindSafe

impl<S> RefUnwindSafe for LineSegment<S> where
    S: RefUnwindSafe

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]