From 81907c58424544543360760a0c60062042a7af5a Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 19 May 2022 09:19:57 +0200 Subject: [PATCH] [Refactor] Calculate large arc flag in a more effective way --- src/main.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 80196f2..f28be2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -178,12 +178,6 @@ fn get_range_path( let end_delta_x = radius * end_deg.to_radians().sin(); let end_delta_y = radius * (1.0 - end_deg.to_radians().cos()); - let large_arc_flag = if start_deg < end_deg { - if deg_diff.abs() >= 180.0 { 0 } else { 1 } - } else { - if deg_diff.abs() >= 180.0 { 1 } else { 0 } - }; - let path_data = PathData::new() .move_to((image_width / 2, image_width / 2)) .line_to(( @@ -194,7 +188,7 @@ fn get_range_path( radius, radius, deg_diff, - large_arc_flag, + ((start_deg < end_deg) ^ (deg_diff.abs() >= 180.0)) as u8, 0, image_width as f32 / 2.0 - end_delta_x, image_width as f32 / 2.0 + radius - end_delta_y,