]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/beam-concave.ly: Add to-be-considered-concave
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 31 Mar 2002 22:50:11 +0000 (22:50 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 31 Mar 2002 22:50:11 +0000 (22:50 +0000)
beam.

* lily/beam.cc (check_concave): Add check for large gap between an
inner notehead and the line through outer noteheads.

* scm/grob-description.scm (Beam): Add concaveness-gap, default
value 2.0 staff-space.

* scm/grob-property-description.scm (concaveness-gap): Add
description.

ChangeLog
input/mozart-hrn3-allegro.ly
input/regression/beam-concave.ly
lily/beam.cc
scm/grob-description.scm
scm/grob-property-description.scm

index 2cf3f2171704266c679d70b0b2e2379bc2d621f2..bb2b4ee7c99d8ef81e194a42f43b2f2a63dc0449 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2002-04-01  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * input/regression/beam-concave.ly: Add to-be-considered-concave
+       beam.
+
+       * lily/beam.cc (check_concave): Add check for large gap between an
+       inner notehead and the line through outer noteheads.
+
+       * scm/grob-description.scm (Beam): Add concaveness-gap, default
+       value 2.0 staff-space.
+       
+       * scm/grob-property-description.scm (concaveness-gap): Add
+       description.
+
+2002-03-31  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * input/mozart-hrn3-allegro.ly: Fix typo.
+
 2002-03-31  Juergen Reuter  <reuter@ipd.uka.de>
 
        * scm/ps.scm, ps/music-drawing-routines.ps, lily/lookup.cc,
index fcead2faa74cd44e7db27a2df0a3c49d504dbcd3..2d7c95dc28413d3347a3d468e382c3a55a438bf2 100644 (file)
@@ -55,7 +55,7 @@ allegro =
        d4. [e16 fis] [g () fis e d] [c() b a g]
        \endcresc
        < a1(-\trill
-1        { s2 \grace{ [g16 a] } } >
+         { s2 \grace{ [g16 a] } } >
        \mark "C"
        )g4 r r2
        R1*15
index cb3cd9b1b6852863bd05ac6b27ce732a33dd48c5..ac8b48e492bbc0c7d0788bb004973ca8f00e4b21 100644 (file)
@@ -11,6 +11,7 @@ beams this way."
 \score{
   \notes\relative c'{
     \property Voice.Beam \set #'concaveness-threshold = #0.08
+    \property Voice.Beam \set #'concaveness-bt2 = #2.0
     
 %% This case seems easy: second beam should be horizontal.
     
@@ -54,7 +55,10 @@ beams this way."
 %     %% SCS-VI Prelude, m82
 %     %% slope = 0.1ss (possibly b.o. context?)
 %     [g, e' cis]
+
     
+%%% `Han-Wen': this should be concave
+    [a,16^"horiz." a' a a]
   }
   \paper{
     linewidth = -1.0
index 23bd41dbaa7330061f38004a0c7bd8f9069a57d1..16f427bbf3e0fdb0f61a55dcab7cc8e01a8c6f76 100644 (file)
@@ -775,37 +775,64 @@ Beam::check_concave (SCM smob)
   if (stems.size () < 3)
     return SCM_UNSPECIFIED;
 
-  /* Concaveness try #2: Sum distances of inner noteheads that
-     fall outside the interval of the two outer noteheads */
-  Real concave = 0;
-  Interval iv (Stem::chord_start_f (stems[0]),
-              Stem::chord_start_f (stems.top ()));
-  
-  if (iv[MAX] < iv[MIN])
-    iv.swap ();
-  
-  for (int i = 1; i < stems.size () - 1; i++)
+  Direction dir = Directional_element_interface::get (me);
+  /* Concaveness #1: If distance of an inner notehead to line between
+     two outer noteheads is bigger than CONCAVENESS-GAP (2.0ss),
+     beam is concave (Heinz Stolba). */
+  bool concaveness1 = false;
+  Real r1 = gh_scm2double (me->get_grob_property ("concaveness-gap"));
+  if (r1 > 0)
     {
-      Real c = 0;
-      Real f = Stem::chord_start_f (stems[i]);
-      if ((c = f - iv[MAX]) > 0)
-       concave += c;
-      else if ((c = f - iv[MIN]) < 0)
-       concave += c;
+      Real dy = Stem::chord_start_f (stems.top ())
+       - Stem::chord_start_f (stems[0]);
+      Real slope = dy / (stems.size () - 1);
+      
+      Real y0 = Stem::chord_start_f (stems[0]);
+      for (int i = 1; i < stems.size () - 1; i++)
+       {
+         Real c = (Stem::chord_start_f (stems[i]) - y0) - i * slope;
+         if (c > r1)
+           {
+             concaveness1 = true;
+             break;
+           }
+       }
     }
 
-  Direction dir = Directional_element_interface::get (me);
-  concave *= dir;
+    
+  /* Concaveness #2: Sum distances of inner noteheads that fall
+     outside the interval of the two outer noteheads */
+  Real concaveness2 = 0;
+  Real r2 = gh_scm2double (me->get_grob_property ("concaveness-threshold"));
+  if (!concaveness1 && r2 > 0)
+    {
+      Real concave = 0;
+      Interval iv (Stem::chord_start_f (stems[0]),
+                  Stem::chord_start_f (stems.top ()));
       
-  Real concaveness = concave / (stems.size () - 2);
-  /* ugh: this is the a kludge to get input/regression/beam-concave.ly
-     to behave as baerenreiter. */
-  concaveness /= (stems.size () - 2);
-  
-  Real r = gh_scm2double (me->get_grob_property ("concaveness-threshold"));
+      if (iv[MAX] < iv[MIN])
+       iv.swap ();
+      
+      for (int i = 1; i < stems.size () - 1; i++)
+       {
+         Real c = 0;
+         Real f = Stem::chord_start_f (stems[i]);
+         if ((c = f - iv[MAX]) > 0)
+           concave += c;
+         else if ((c = f - iv[MIN]) < 0)
+           concave += c;
+       }
+      
+      concave *= dir;
 
+      concaveness2 = concave / (stems.size () - 2);
+      /* ugh: this is the a kludge to get input/regression/beam-concave.ly
+        to behave as baerenreiter. */
+      concaveness2 /= (stems.size () - 2);
+    }
+  
   /* TODO: some sort of damping iso -> plain horizontal */
-  if (concaveness > r)
+  if (concaveness1 || concaveness2 > r2)
     {
       Interval pos = ly_scm2interval (me->get_grob_property ("positions"));
       Real r = pos.linear_combination (0);
index f90647f38849fa401652a9307bc95c4c1f6d5c65..ab647f4df50682e2c3be3584259fa5da71694432 100644 (file)
        ;; todo: clean this up a bit: the list is getting
        ;; rather long.
        (molecule-callback . ,Beam::brew_molecule)
+       (concaveness-gap . 2.0)
        (concaveness-threshold . 0.08)
        (positions . (#f . #f))
        (position-callbacks . (,Beam::least_squares
index 0f453ffb34c0de4ddb15ae6a2ef4ad41450f33a2..055699db66cdec5a7500f01810729787f22118aa 100644 (file)
@@ -90,6 +90,9 @@ column as start/begin point. Only columns that have grobs or act as bounds are s
 (grob-property-description 'center-element ly-grob? "grob which will
 be at the center of the group after aligning (when using
 Align_interface::center_on_element). .")
+(grob-property-description 'concaveness-gap number? "A beam is
+considered to be concave if the distance of an inner notehead to the
+line between two outer noteheads is bigger than this gap.")
 (grob-property-description 'concaveness-threshold number? "A beam is
 considered to be concave is concaveness is bigger than this threshold.
 Concaveness is calculated as the sum of the vertical distances of