/// Create a render path for the specified polygon.
Create a render path for the specified polygon.
Create a render path for the specified polygon .
pub fn path_for_polygon(
    center: Point,
    radius: Coord,
    segment_count: usize,
    render_context: &mut RenderContext,
) -> Path {
    let segment_angle = (2.0 * std::f32::consts::PI) / segment_count as f32;
    let mut path_builder = render_context.path_builder().expect("path_builder");
    let first_point = point_for_segment_index(0, center, radius, segment_angle);
    path_builder.move_to(first_point);
    for index in 1..segment_count {
        let pt = point_for_segment_index(index, center, radius, segment_angle);
        path_builder.line_to(pt);
    }
    path_builder.line_to(first_point);
    path_builder.build()
}
pub fn path_for_polygon ( center : Point , radius : Coord , segment_count : usize , render_context : & mut RenderContext , ) -> Path { let segment_angle = ( 2.0 * std :: f32 :: consts :: PI ) / segment_count as f32 ; let mut path_builder = render_context . path_builder ( ) . expect ( " " ) ; let first_point = point_for_segment_index ( 0 , center , radius , segment_angle ) ; path_builder . move_to ( first_point ) ; for index in 1 .. segment_count { let pt = point_for_segment_index ( index , center , radius , segment_angle ) ; path_builder . line_to ( pt ) ; } path_builder . line_to ( first_point ) ; path_builder . build ( ) }
Create a render path for the specified polygon.
Create a render path for the specified polygon .
center
Point
radius
Coord
segment_count
usize
render_context
&mut RenderContext