[][src]Struct geo_types::Triangle

pub struct Triangle<T: CoordNum>(pub Coordinate<T>, pub Coordinate<T>, pub Coordinate<T>);

A bounded 2D area whose three vertices are defined by Coordinates. The semantics and validity are that of the equivalent Polygon; in addition, the three vertices must not be collinear and they must be distinct.


impl<T: CoordNum> Triangle<T>[src]

pub fn to_array(&self) -> [Coordinate<T>; 3][src]

pub fn to_lines(&self) -> [Line<T>; 3][src]

pub fn to_polygon(self) -> Polygon<T>[src]

Create a Polygon from the Triangle.


use geo_types::{Coordinate, Triangle, polygon};

let triangle = Triangle(
    Coordinate { x: 0., y: 0. },
    Coordinate { x: 10., y: 20. },
    Coordinate { x: 20., y: -10. },

        (x: 0., y: 0.),
        (x: 10., y: 20.),
        (x: 20., y: -10.),
        (x: 0., y: 0.),

Trait Implementations

impl<T: Clone + CoordNum> Clone for Triangle<T>[src]

impl<T: Copy + CoordNum> Copy for Triangle<T>[src]

impl<T: Debug + CoordNum> Debug for Triangle<T>[src]

impl<T: Eq + CoordNum> Eq for Triangle<T>[src]

impl<IC: Into<Coordinate<T>> + Copy, T: CoordNum> From<[IC; 3]> for Triangle<T>[src]

impl<T: CoordNum> From<Triangle<T>> for Polygon<T>[src]

impl<T: CoordNum> From<Triangle<T>> for Geometry<T>[src]

impl<T: Hash + CoordNum> Hash for Triangle<T>[src]

impl<T: PartialEq + CoordNum> PartialEq<Triangle<T>> for Triangle<T>[src]

impl<T: CoordNum> StructuralEq for Triangle<T>[src]

impl<T: CoordNum> StructuralPartialEq for Triangle<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Triangle<T> where
    T: RefUnwindSafe

impl<T> Send for Triangle<T> where
    T: Send

impl<T> Sync for Triangle<T> where
    T: Sync

impl<T> Unpin for Triangle<T> where
    T: Unpin

impl<T> UnwindSafe for Triangle<T> where
    T: UnwindSafe

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.