[][src]Struct arcs::primitives::Line

pub struct Line<S> {
    pub start: Point2D<f64, S>,
    pub end: Point2D<f64, S>,
}

A line connecting Line::start to Line::end.

Fields

start: Point2D<f64, S>

The Line's starting point.

end: Point2D<f64, S>

The Line's ending point.

Implementations

impl<S> Line<S>[src]

pub const fn new(start: Point2D<f64, S>, end: Point2D<f64, S>) -> Line<S>[src]

Create a new Line.

pub fn displacement(&self) -> Vector2D<f64, S>[src]

The displacement vector from Line::start to Line::end.

pub fn direction(&self) -> Vector2D<f64, S>[src]

The [Line::displacement()], normalised to a unit vector.

pub fn length(self) -> f64[src]

The Line's length.

pub fn perpendicular_distance_to(self, point: Point2D<f64, S>) -> Length<f64, S>[src]

How close would the [Point2D] get if this line were extended forever?

See also Distance from a point to a line on Wikipedia.

Trait Implementations

impl<Space> AffineTransformable for Line<Space>[src]

impl<Space> Approximate<Space> for Line<Space>[src]

type Iter = Chain<Once<Point2D<f64, Space>>, Once<Point2D<f64, Space>>>

An iterator over the approximated vertices.

impl<S> Bounded<S> for Line<S>[src]

impl<S> Clone for Line<S>[src]

impl<Space> ClosestPoint<Space> for Line<Space>[src]

impl<S> Copy for Line<S>[src]

impl<S> Debug for Line<S> where
    S: Debug
[src]

impl<S> Default for Line<S> where
    S: Default
[src]

impl<Space> Length for Line<Space>[src]

fn length(&self) -> f64[src]

Calculates the length of the line.

let line = Line::new(Point::zero(), Point::new(5.0, 0.0));

assert_eq!(line.length(), 5.0);

impl<S> PartialEq<Line<S>> for Line<S> where
    S: PartialEq<S>, 
[src]

impl<S> StructuralPartialEq for Line<S>[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

impl<T> Event for T where
    T: Send + Sync + 'static, 
[src]

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

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

impl<T> Resource for T where
    T: Any + Send + Sync
[src]

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

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 
[src]

impl<S> Scale for S where
    S: ScaleNonUniform
[src]

impl<A> ScaleNonUniform for A where
    A: AffineTransformable
[src]

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

type Owned = T

The resulting type after obtaining ownership.

impl<Space, A> Translate<Space> for A where
    A: AffineTransformable
[src]

impl<T> TryDefault for T where
    T: Default
[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.