fn draw_face() -> impl Iterator<Item = Pixel<BinaryColor>> {
    let tic_len = 3.0;

    // Use the circle macro to create the outer face
    let face =
        Circle::new(CENTER, SIZE * 2).into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1));

    // Create 12 `Line`s starting from the outer edge and drawing inwards by `tic_len` pixels
    let tics = (0..12).into_iter().map(move |index| {
        // Start angle around the circle, in radians
        let angle = START + (PI * 2.0 / 12.0) * index as f32;

        // Start point on circumference
        let start = polar(angle, SIZE as f32);

        // End point; start point offset by `tic_len` pixels towards the circle center
        let end = polar(angle, SIZE as f32 - tic_len);

        Line::new(start, end)
            .into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
            .pixels()
    });

    // Create a single iterator of pixels, first iterating over the circle, then over the 12 lines
    // generated
    face.pixels().into_iter().chain(tics.flatten())
}
/// Draw a circle and 12 tics as a simple clock face
Draw a circle and 12 tics as a simple clock face
Draw a circle and 12 tics as a simple clock face
fn draw_face() -> impl Iterator<Item = Pixel<BinaryColor>> {
    let tic_len = 3.0;
    // Use the circle macro to create the outer face
    let face =
        Circle::new(CENTER, SIZE * 2).into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1));
    // Create 12 `Line`s starting from the outer edge and drawing inwards by `tic_len` pixels
    let tics = (0..12).into_iter().map(move |index| {
        // Start angle around the circle, in radians
        let angle = START + (PI * 2.0 / 12.0) * index as f32;
        // Start point on circumference
        let start = polar(angle, SIZE as f32);
        // End point; start point offset by `tic_len` pixels towards the circle center
        let end = polar(angle, SIZE as f32 - tic_len);
        Line::new(start, end)
            .into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
            .pixels()
    });
    // Create a single iterator of pixels, first iterating over the circle, then over the 12 lines
    // generated
    face.pixels().into_iter().chain(tics.flatten())
}
fn draw_face ( ) -> impl Iterator < Item = Pixel < BinaryColor > > { let tic_len = 3.0 ; // Use the circle macro to create the outer face let face = Circle :: new ( CENTER , SIZE * 2 ) . into_styled ( PrimitiveStyle :: with_stroke ( BinaryColor :: On , 1 ) ) ; // Create 12 `Line`s starting from the outer edge and drawing inwards by `tic_len` pixels let tics = ( 0 .. 12 ) . into_iter ( ) . map ( move | index | { // Start angle around the circle, in radians let angle = START + ( PI * 2.0 / 12.0 ) * index as f32 ; // Start point on circumference let start = polar ( angle , SIZE as f32 ) ; // End point; start point offset by `tic_len` pixels towards the circle center let end = polar ( angle , SIZE as f32 - tic_len ) ; Line :: new ( start , end ) . into_styled ( PrimitiveStyle :: with_stroke ( BinaryColor :: On , 1 ) ) . pixels ( ) } ) ; // Create a single iterator of pixels, first iterating over the circle, then over the 12 lines // generated face . pixels ( ) . into_iter ( ) . chain ( tics . flatten ( ) ) }
Draw a circle and 12 tics as a simple clock face
Draw a circle and 12 tics as a simple clock face