Function graphics::triangulation::stream_quad_tri_list [−][src]
pub fn stream_quad_tri_list<E, F>(m: Matrix2d, quad_edge: E, f: F) where
E: FnMut() -> Option<(Vec2d, Vec2d)>,
F: FnMut(&[[f32; 2]]),
Streams a quad into tri list.
Uses buffers that fit inside L1 cache. The ‘quad_edge’ stream returns two points defining the next edge.
quad_edge
is a function that returns two vertices, which together comprise
one edge of a quad
f
is a function that consumes the tri list constructed by the output of
quad_edge
, one chunk (buffer) at a time
The tri list is series of buffers (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, // ^------------------------------------^ __ // Two triangles together form a single quad |\\ 2| // |1\\ | // |__\\|
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 quad_edge
returns None
, indicating there are no more edges left.
(in which case the last partially filled buffer is sent to f
)