use crate::support::canvas::Canvas;
use crate::support::color::Color;
use crate::support::point::Point;
pub fn tick_width(total_height: f32) -> f32 {
total_height * 0.32
}
pub fn draw_radical(
canvas: &mut Canvas,
origin: Point,
total_height: f32,
radicand_width: f32,
thickness: f32,
color: Color,
) {
let tail = Point::new(origin.x, origin.y - total_height * 0.45);
let dip = Point::new(
origin.x + total_height * 0.12,
origin.y - total_height * 0.25,
);
let hook_ctrl = Point::new(
origin.x + total_height * 0.18,
origin.y - total_height * 0.05,
);
let peak = Point::new(origin.x + tick_width(total_height), origin.y - total_height);
let bar_end = Point::new(peak.x + radicand_width, peak.y);
canvas.begin_path();
canvas.move_to(tail);
canvas.line_to(dip);
canvas.quad_to(hook_ctrl, peak);
canvas.line_to(bar_end);
canvas.stroke_style(color);
canvas.line_width(thickness);
canvas.stroke();
}