From 041226739c651945573431bcdba23176a8decea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Warcho=C5=82?= Date: Sun, 13 Feb 2011 22:39:36 +0100 Subject: [PATCH] Second variation of improving transition between full-length and shortened stems. This transition between full length (3.5 ss) and shortened (2.5) stems in more elongated, and the changes in stem lengths are not linear. --- lily/stem.cc | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lily/stem.cc b/lily/stem.cc index 11cf6de..af76a2a 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -346,11 +346,11 @@ Stem::calc_length (SCM smob) SCM sshorten = ly_assoc_get (ly_symbol2scm ("stem-shorten"), details, SCM_EOL); SCM scm_shorten = scm_is_pair (sshorten) ? robust_list_ref (max (duration_log (me) - 2, 0), sshorten) : SCM_EOL; - Real shorten = 2* robust_scm2double (scm_shorten, 0); - - /* On boundary: shorten only half */ - if (abs (head_positions (me)[dir]) <= 1) - shorten *= 0.5; + Real shorten = 2 * robust_scm2double (scm_shorten, 0); + /* make a smooth transition between shortened stems and normal ones: */ + Real shortening_steps[] = {0.2, 0.4, 0.6, 0.8, 0.88, 0.96}; + if (abs (head_positions (me)[dir]) < 5) + shorten *= shortening_steps[(int) abs (head_positions (me)[dir])]; length -= shorten; } -- 1.7.0.4