[][src]Struct polys::Tri

pub struct Tri {
    pub side1: f64,
    pub side2: f64,
    pub side3: f64,
}

Struct that represents a triangle.

Fields

side1: f64side2: f64side3: f64

Implementations

impl Tri[src]

pub fn new(s1: f64, s2: f64, s3: f64) -> Tri[src]

Returns a new Tri from given sides s1, s2, s3.

Examples

let tri = polys::Tri::new(24.0, 30.0, 18.0);

Trait Implementations

impl Debug for Tri[src]

impl Polygon for Tri[src]

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

Gets the area of the Tri from its sides.

Examples

let tri = polys::Tri::new(24.0, 30.0, 18.0);
let area = tri.area();
assert_eq!(area, 216 as f64);

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

Gets the perimeter of the Tri from its sides.

Examples

let tri = polys::Tri::new(24.0, 30.0, 18.0);
let peri = tri.peri();
assert_eq!(peri, 72f64);

Auto Trait Implementations

impl RefUnwindSafe for Tri

impl Send for Tri

impl Sync for Tri

impl Unpin for Tri

impl UnwindSafe for Tri

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