pub fn decompose_rectangles<T, I>(redges: I) -> Vec<Rect<T>> where
    T: Ord + Bounded + Copy + Zero,
    I: Iterator<Item = REdge<T>>, 
Expand description

Decompose a set of manhattanized polygons into non-overlapping horizontal rectangles. The polygons in form of an iterator over all the edges. A point is considered inside the polygon when the polygon wraps around it a non-zero number of times.

Example

    use libreda_db::prelude::*;
    use libreda_db::layout::algorithms::decompose_rectangles;
    // Use a polygon like the following.
    //    +--+
    //    |  |
    // +--+  |
    // |     |
    // +-----+
    let poly = SimpleRPolygon::try_new(vec![
        (0, 0), (2, 0), (2, 2), (1, 2), (1, 1), (0, 1)
    ].iter().map(|t| Point::from(t)).collect()).unwrap();

    // Decompose the polygon into non-overlapping horizontal rectangles.
    let rects = decompose_rectangles(poly.edges());
    assert_eq!(rects, vec![Rect::new((0, 0), (2, 1)), Rect::new((1, 1), (2, 2))]);