[][src]Function pathfinder::tools::plot

pub fn plot(a: Coordinate, b: Coordinate) -> Vec<Coordinate>

Generates a list of Coordinates between two points. Required for drawing direct edges.

Implemented according to bresenham's 4 way line algorithm.

More information can be found here.

https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

Examples

First we create a simple path between two coordinates.

use pathfinder::{tools, Coordinate};
let a = Coordinate::new(0, 0);
let b = Coordinate::new(1, 1);
let path = tools::plot(a, b);

Paths can also be used from macro invocations.

let path = tools::plot(coordinate!(), coordinate!(100, 100));