[Refactor] Remove the time_to_degrees function

It just passed its sole parameter to seconds_to_degrees, so having this function
doesn’t really make sense.

It was actually a remnant from the Python version which operated on timestamps, not raw
seconds-since-midnight values.
This commit is contained in:
Gergely Polonkai 2022-05-23 17:48:45 +02:00
parent b7aa26be89
commit eb99194e16
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -40,14 +40,9 @@ fn seconds_to_degrees(seconds: i32) -> f32 {
seconds as f32 * 360.0 / 86400.0 seconds as f32 * 360.0 / 86400.0
} }
fn time_to_degrees(timestamp: i32, // should be time/timestamp
) -> f32 {
seconds_to_degrees(timestamp)
}
fn get_range_path(radius: f32, range_name: &str, start_time: i32, end_time: i32) -> Path { fn get_range_path(radius: f32, range_name: &str, start_time: i32, end_time: i32) -> Path {
let start_deg = time_to_degrees(start_time); let start_deg = seconds_to_degrees(start_time);
let end_deg = time_to_degrees(end_time); let end_deg = seconds_to_degrees(end_time);
let deg_diff = end_deg - start_deg; let deg_diff = end_deg - start_deg;
let start_delta_x = radius * start_deg.to_radians().sin(); let start_delta_x = radius * start_deg.to_radians().sin();
@ -275,7 +270,7 @@ fn gen_svg(config: &Option<Config>, hour_name_path_cache: &[(PathData, PathData)
"transform", "transform",
format!( format!(
"rotate({}, {}, {})", "rotate({}, {}, {})",
time_to_degrees(local_time) - utc_rotation, seconds_to_degrees(local_time) - utc_rotation,
IMAGE_WIDTH / 2, IMAGE_WIDTH / 2,
IMAGE_WIDTH / 2 IMAGE_WIDTH / 2
), ),
@ -302,7 +297,7 @@ fn gen_svg(config: &Option<Config>, hour_name_path_cache: &[(PathData, PathData)
"transform", "transform",
format!( format!(
"rotate({}, {}, {})", "rotate({}, {}, {})",
time_to_degrees(noon), seconds_to_degrees(noon),
IMAGE_WIDTH / 2, IMAGE_WIDTH / 2,
IMAGE_WIDTH / 2 IMAGE_WIDTH / 2
), ),
@ -321,7 +316,7 @@ fn gen_svg(config: &Option<Config>, hour_name_path_cache: &[(PathData, PathData)
"transform", "transform",
format!( format!(
"rotate({}, {}, {})", "rotate({}, {}, {})",
time_to_degrees(midnight), seconds_to_degrees(midnight),
IMAGE_WIDTH / 2, IMAGE_WIDTH / 2,
IMAGE_WIDTH / 2 IMAGE_WIDTH / 2
), ),
@ -377,7 +372,7 @@ fn gen_svg(config: &Option<Config>, hour_name_path_cache: &[(PathData, PathData)
"transform", "transform",
format!( format!(
"rotate({}, {}, {})", "rotate({}, {}, {})",
time_to_degrees(local_time), seconds_to_degrees(local_time),
IMAGE_WIDTH / 2, IMAGE_WIDTH / 2,
IMAGE_WIDTH / 2 IMAGE_WIDTH / 2
), ),