Function piston_window::triangulation::stream_polygon_tri_list[][src]

pub fn stream_polygon_tri_list<E, F>(m: [[f64; 3]; 2], polygon: E, f: F) where
    E: Iterator<Item = [f64; 2]>,
    F: FnMut(&[[f32; 2]]), 

Streams a polygon into tri list. Uses buffers that fit inside L1 cache.

polygon is a function that provides the vertices that comprise the polygon. Each call to E will return a new vertex until there are none left.

f is a function that consumes the tri list constructed by the output of polygon, one chunk (buffer) at a time.

Each chunk (buffer) is a fixed size array) of the format:

//     [[x0, y0], [x1, y1], [x2, y2], [x3, y3], ... [y4, y5], ...]
//      ^--------------------------^  ^--------------------^
//        3 Points of triangle   3 points of second triangle,

Together all the chunks comprise the full tri list. Each time the buffer size is reached, that chunk is fed to f, then this function proceeds using a new buffer until a call to polygon returns None, indicating there are no points left in the polygon. (in which case the last partially filled buffer is sent to f)