[][src]Struct line_drawing::XiaolinWu

pub struct XiaolinWu<I, O> { /* fields omitted */ }

An implementation of Xiaolin Wu's line algorithm.

This algorithm works based on floating-points and returns an extra variable for how much a a point is covered, which is useful for anti-aliasing.

Note that due to the implementation, the returned line will always go from left to right.

Example:

extern crate line_drawing;
use line_drawing::XiaolinWu;

fn main() {
    for ((x, y), value) in XiaolinWu::<f32, i8>::new((0.0, 0.0), (3.0, 6.0)) {
        print!("(({}, {}), {}), ", x, y, value);
    }
}
((0, 0), 0.5), ((0, 1), 0.5), ((1, 1), 0.5), ((1, 2), 1), ((1, 3), 0.5), ((2, 3), 0.5), ((2, 4), 1), ((2, 5), 0.5), ((3, 5), 0.5), ((3, 6), 0.5),

Methods

impl<I: FloatNum, O: SignedNum> XiaolinWu<I, O>[src]

pub fn new(start: Point<I>, end: Point<I>) -> Self[src]

Important traits for Steps<T, I>
pub fn steps(self) -> Steps<(Point<O>, I), Self>[src]

Trait Implementations

impl<I: FloatNum, O: SignedNum> Iterator for XiaolinWu<I, O>[src]

type Item = (Point<O>, I)

The type of the elements being iterated over.

Auto Trait Implementations

impl<I, O> Send for XiaolinWu<I, O> where
    I: Send,
    O: Send

impl<I, O> Unpin for XiaolinWu<I, O> where
    I: Unpin,
    O: Unpin

impl<I, O> Sync for XiaolinWu<I, O> where
    I: Sync,
    O: Sync

impl<I, O> UnwindSafe for XiaolinWu<I, O> where
    I: UnwindSafe,
    O: UnwindSafe

impl<I, O> RefUnwindSafe for XiaolinWu<I, O> where
    I: RefUnwindSafe,
    O: RefUnwindSafe

Blanket Implementations

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> From<T> for 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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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