pub(crate) fn radial_circle(
bbox: (f64, f64, f64, f64),
center_x: i16,
center_y: i16,
) -> Option<(f64, f64, f64)> {
let (x, y, width, height) = bbox;
if ![x, y, width, height].into_iter().all(f64::is_finite) || width <= 0.0 || height <= 0.0 {
return None;
}
let local_x = width * f64::from(center_x) / 100.0;
let local_y = height * f64::from(center_y) / 100.0;
let dx = local_x.abs().max((width - local_x).abs());
let dy = local_y.abs().max((height - local_y).abs());
let geometry = (x + local_x, y + local_y, dx.hypot(dy));
[geometry.0, geometry.1, geometry.2]
.into_iter()
.all(f64::is_finite)
.then_some(geometry)
}