diff options
Diffstat (limited to 'biometry.asy')
-rw-r--r-- | biometry.asy | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/biometry.asy b/biometry.asy deleted file mode 100644 index 294c212..0000000 --- a/biometry.asy +++ /dev/null @@ -1,38 +0,0 @@ -pair pair_ratio(pair a, pair b, real fraction) { - return a + (b - a)*fraction; -} -real real_ratio(real a, real b, real fraction) { - return a + (b - a)*fraction; -} -void draw_tic(pair a, pair b, real fraction, real tic_height, bool label) { - pair pt1 = pair_ratio(a, b, fraction); - pair pt2 = pt1 - (0, tic_height); - draw(pt1 -- pt2); - if (label) { - label(format("%f\%", fraction*100), pt2, S); - } -} -void draw_marker(pair a, pair b, real value, real marker_height) { - pair markpt = pair_ratio(a, b, value); - pair pt = (markpt.x, markpt.y + marker_height); - label("*", pt); -} -void draw_scale(pair a, pair b, real value, real tic_height) { - draw(pair_ratio(a, b, 0) -- pair_ratio(a, b, 1)); - draw_tic(a, b, 0.05, tic_height, true); - draw_tic(a, b, 0.5, tic_height, true); - draw_tic(a, b, 0.95, tic_height, true); - draw_tic(a, b, 0.25, 0.5*tic_height, false); - draw_tic(a, b, 0.75, 0.5*tic_height, false); - draw_marker(a, b, value, 0.5*tic_height); -} -void draw_biometry(string param, string param_age, real percentile) { - real width = 100; - real height = 75; - - label(param, (width/2, 2*height/3), N); - label(param_age, (width/2, 2*height/3), S); - pair scale1 = (0.1*width, 0.25*height); - pair scale2 = (0.9*width, 0.25*height); - draw_scale(scale1, scale2, percentile/100, 0.1*height); -}
\ No newline at end of file |