]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.1.18.jcn4: vixje
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 5 Jan 1999 20:33:07 +0000 (21:33 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 5 Jan 1999 20:33:07 +0000 (21:33 +0100)
pl 18.jcn4
- beam length adjustments
- ugly beamtrend fix: input/test/beam-trend.ly

NEWS
VERSION
init/params.ly
input/test/beam-trend.ly [new file with mode: 0644]
lily/beam.cc
lily/include/beam.hh
lily/stem-info.cc
mutopia/J.S.Bach/wtk1-fugue2.ly

diff --git a/NEWS b/NEWS
index 733fbe3bd9e1db648c3b3b60170ce551e8ba971f..a87715db56d6a67dd7c90d532b8f6b462bd4b988 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+pl 18.jcn4
+       - beam length adjustments
+       - ugly beamtrend fix: input/test/beam-trend.ly
+
 pl 18.jcn3
        - bf: (beamed) forced stem shorten
        - bf: broken slurs and ties; minimal slur/tie length setting ignored
diff --git a/VERSION b/VERSION
index c7fab2aa3f23c27d4199cb3e83ee2fe5e861a9c9..d0c2078b63d2297ed56b7d45599a8cc58aa686b5 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=1
 PATCH_LEVEL=18
-MY_PATCH_LEVEL=jcn3
+MY_PATCH_LEVEL=jcn4
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index cb4cf24aef42d84c4e8bae017111cd61c0e9d2f5..807a8a06fd4fa7526486c02f6f053121ef7c3bdc 100644 (file)
@@ -54,10 +54,16 @@ beam_dir_algorithm = \MAJORITY;
 %    beam_*2 : multiplicity >= beam_multiple_break
 %
 beam_multiple_break = 3.0;
-beam_minimum_stem1 = 1.5 * \interline;
-beam_minimum_stem2 = 1.0 * \interline;
-beam_ideal_stem1 = 2.0 * \interline;
-beam_ideal_stem2 = 1.5 * \interline;
+% beam_minimum_stem1 = 1.5 * \interline;
+% beam_ideal_stem1 = 2.0 * \interline;
+% beam_minimum_stem2 = 1.0 * \interline;
+% beam_ideal_stem2 = 1.5 * \interline;
+
+% let's try these minor adjustments
+beam_minimum_stem1 = 1.25 * \interline;
+beam_ideal_stem1 = 1.75 * \interline;
+beam_minimum_stem2 = 0.75 * \interline;
+beam_ideal_stem2 = 1.25 * \interline;
 
 % beam_slope_damp_correct_factor = 2.0;
 beam_slope_damp_correct_factor = 0.0;
diff --git a/input/test/beam-trend.ly b/input/test/beam-trend.ly
new file mode 100644 (file)
index 0000000..24b2e7b
--- /dev/null
@@ -0,0 +1,9 @@
+\score{
+       \notes\relative c'{
+               \stemup
+               [f8 a' g f]
+       }
+       \paper{
+               linewidth=-1.;
+       }
+}
index f365889c4fa9ec8c2ff69997166dd38a781143b5..b82b7c498ec0a546da11ec26524a876b880bc67c 100644 (file)
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "grouping.hh"
-#include "stem-info.hh"
-
-
-
 
 Beam::Beam ()
 {
@@ -117,7 +113,7 @@ Beam::do_post_processing ()
       transparent_b_ = true;
       return ;
     }
-  solve_slope ();
+  calculate_slope ();
   set_stemlens ();
 }
 
@@ -216,48 +212,29 @@ Beam::set_default_dir ()
 /*
   See Documentation/tex/fonts.doc
  */
+
 void
-Beam::solve_slope ()
+Beam::solve_slope (Array<Stem_info>& sinfo)
 {
   /*
     should use minimum energy formulation (cf linespacing)
   */
-
-  assert (multiple_i_);
-  Array<Stem_info> sinfo;
+  assert (sinfo.size () > 1);
   DOUT << "Beam::solve_slope: \n";
-  for (int j=0; j <stems_.size (); j++)
-    {
-      Stem *i = stems_[j];
 
-      i->mult_i_ = multiple_i_;
-      i->set_default_extents ();
-      if (i->invisible_b ())
-       continue;
+  Real staffline_f = paper ()->rule_thickness ();
+  Real epsilon_f = staffline_f / 8;
 
-      Stem_info info (i);
-      sinfo.push (info);
-    }
-  if (! sinfo.size ())
-    slope_f_ = left_y_ = 0;
-  else if (sinfo.size () == 1)
+  Real leftx = sinfo[0].x_;
+  Least_squares l;
+  for (int i=0; i < sinfo.size (); i++)
     {
-      slope_f_ = 0;
-      left_y_ = sinfo[0].idealy_f_;
+      sinfo[i].x_ -= leftx;
+      l.input.push (Offset (sinfo[i].x_, sinfo[i].idealy_f_));
     }
-  else
-    {
-      Real leftx = sinfo[0].x_;
-      Least_squares l;
-      for (int i=0; i < sinfo.size (); i++)
-       {
-         sinfo[i].x_ -= leftx;
-         l.input.push (Offset (sinfo[i].x_, sinfo[i].idealy_f_));
-       }
 
-      l.minimise (slope_f_, left_y_);
-
-     }
+  l.input[0].y () += left_y_;
+  l.minimise (slope_f_, left_y_);
 
   solved_slope_f_ = dir_ * slope_f_;
 
@@ -280,33 +257,32 @@ Beam::solve_slope ()
     perhaps only if slope = 0 ?
     */
 
-//      left_y_ = sinfo[0].minyf_;
+  if (abs (slope_f_) < epsilon_f)
+    left_y_ = (sinfo[0].idealy_f_ + sinfo.top ().idealy_f_) / 2;
+  else
+    /* 
+      symmetrical, but results often in having stemlength = minimal 
+
+    left_y_ = sinfo[0].dir_ == dir_ ? sinfo[0].miny_f_ : sinfo[0].maxy_f_;
 
-  if (sinfo.size () >= 1)
+      what about
+    */
     {
-      Real staffline_f = paper ()->rule_thickness ();
-      Real epsilon_f = staffline_f / 8;
-      if (abs (slope_f_) < epsilon_f)
-       left_y_ = (sinfo[0].idealy_f_ + sinfo.top ().idealy_f_) / 2;
+      Real dx = stems_.top ()->hpos_f () - stems_[0]->hpos_f ();
+      if (sinfo[0].dir_ == sinfo.top ().dir_)
+       left_y_ = sinfo[0].idealy_f_ >? sinfo.top ().idealy_f_ - slope_f_ * dx; 
+      // knee
       else
-       /* 
-         symmetrical, but results often in having stemlength = minimal 
-
-       left_y_ = sinfo[0].dir_ == dir_ ? sinfo[0].miny_f_ : sinfo[0].maxy_f_;
-
-         what about
-       */
-       {
-         Real dx = stems_.top ()->hpos_f () - stems_[0]->hpos_f ();
-         if (sinfo[0].dir_ == sinfo.top ().dir_)
-           left_y_ = sinfo[0].idealy_f_ >? sinfo.top ().idealy_f_ - slope_f_ * dx; 
-         // knee
-         else
-           left_y_ = sinfo[0].idealy_f_;
-       }
+       left_y_ = sinfo[0].idealy_f_;
     }
+}
 
-  // uh?
+Real
+Beam::check_stemlengths_f (Array<Stem_info>& sinfo)
+{
+  /*
+   find shortest stem and adjust left_y accordingly
+   */
   Real dy = 0.0;
   for (int i=0; i < sinfo.size (); i++)
     {
@@ -316,7 +292,77 @@ Beam::solve_slope ()
       if (my - y > dy)
        dy = my -y;
     }
-  left_y_ += dy;
+  return dy;
+}
+
+void
+Beam::calculate_slope ()
+{
+  Real interline_f = paper ()->interline_f ();
+  Real staffline_f = paper ()->rule_thickness ();
+  Real epsilon_f = staffline_f / 8;
+
+  assert (multiple_i_);
+  Array<Stem_info> sinfo;
+  for (int i=0; i < stems_.size (); i++)
+    {
+      Stem *s = stems_[i];
+
+      s->mult_i_ = multiple_i_;
+      s->set_default_extents ();
+      if (s->invisible_b ())
+       continue;
+
+      Stem_info info (s);
+      sinfo.push (info);
+    }
+
+  if (! sinfo.size ())
+    slope_f_ = left_y_ = 0;
+  else if (sinfo.size () == 1)
+    {
+      slope_f_ = 0;
+      left_y_ = sinfo[0].idealy_f_;
+    }
+  else
+    {
+      Real y;
+      Real s;
+      for (int i = 0; i < 3; i++)
+        {
+         y = left_y_;
+         solve_slope (sinfo);
+         Real dy = check_stemlengths_f (sinfo);
+         left_y_ += dy;
+
+         // only consider recalculation if long stem adjustments
+         if (!i && (left_y_ - sinfo[0].idealy_f_ < 0.5 * interline_f))
+           break;
+       
+         if (!i)
+           s = slope_f_;
+         // never allow slope to tilt the other way
+         else if (sign (slope_f_) != sign (s))
+           {
+             left_y_ = 0;
+             slope_f_ = 0;
+             Real dy = check_stemlengths_f (sinfo);
+             left_y_ += dy;
+             break;
+           }
+         // or become steeper
+         else if (abs (slope_f_) > abs (s))
+           {
+             slope_f_ = s;
+             Real dy = check_stemlengths_f (sinfo);
+             left_y_ += dy;
+             break;
+           }
+         if (abs (dy) < epsilon_f)
+           break;
+       }
+    }
+
   left_y_ *= dir_;
   slope_f_ *= dir_;
 
index 29fa7049b41d7488f5102b5a1285852459af933a..5c42a6ba0627d036d9b1e5dd3c55855506c1f2e7 100644 (file)
@@ -6,8 +6,10 @@
 
 #ifndef BEAM_HH
 #define BEAM_HH
+
 #include "lily-proto.hh"
 #include "directional-spanner.hh"
+#include "stem-info.hh"
 #include "plist.hh"
 
 /** a beam connects multiple stems.
@@ -59,7 +61,9 @@ protected:
 
   virtual void quantise_left_y (bool extend_b);
   virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
-  virtual void solve_slope ();
+  virtual void calculate_slope ();
+  virtual Real check_stemlengths_f (Array<Stem_info>& sinfo);
+  virtual void solve_slope (Array<Stem_info>& sinfo);
   virtual void quantise_dy ();
   virtual Molecule*do_brew_molecule_p () const;
 };
index ad09936111bfe821c2aeba4d62111e801c70c13d..20f16ea05c4a02d5d19124c9807e727c5b334465 100644 (file)
@@ -93,7 +93,7 @@ Stem_info::Stem_info (Stem const *s)
       if (((int)s->chord_start_f ()) && (s->dir_ != s->get_default_dir ()))
        {
          idealy_f_ -= shorten_f;
-         miny_f_ = miny_f_ <? idealy_f_;
+         miny_f_ = miny_f_ <? idealy_f_ + internote_f;
        }
 
       // lowest beam of (UP) beam must never be lower than second staffline
index 108c83c819b7a44abea5687d80ed24bb002953a2..df8a32b935d153f72f45ddae23f57163fcd766bb 100644 (file)
@@ -25,7 +25,8 @@ global = \notes {
   \bar "|."; |
 }
   
-dux = \notes \relative c'' {
+dux = \notes \relative c''{
+  \voicetwo
   \clef violin;
 
   \property Voice.ydirection = "-1"
@@ -75,8 +76,7 @@ dux = \notes \relative c'' {
 
 
 comes = \notes \relative c''  {
-  \stemup
-
+  \voiceone
   r1 |
   r1 |
   r8 [g'16 fis] [g8 c,] [es g16 fis] [g8 a] |
@@ -182,18 +182,26 @@ bassdux = \notes \relative c' {
 
   \paper {
     gourlay_maxmeasures = 4.;
-    % current default for 16pt -> three pages
-    % hmm, too tight already, better more vsize!
-    arithmetic_multiplier = 4.8\pt;
-    % arithmetic_multiplier = 4.4\pt;
+    indent = 8.\mm;
+    textheight = 295.\mm;
+
+    %hmm
+%    \translator { \BarNumberingScoreContext }
+    \translator { \BarNumberingStaffContext }
 
     % Breitkopf; unlike B\"arenreiter rule
     % really looks a lot better?
     % should have an array of min/ideal lengths (scheme)
     % and check B\"arenreiter rules again -- make testcase
-    beam_multiple_break = 2.0;
 
-    %    beam_dir_algorithm = \MEDIAN;
+    % beam_multiple_break = 2.0;
+    % beam_minimum_stem1 = 1.5 * \interline;
+    % beam_ideal_stem1 = 2.0 * \interline;
+    % beam_minimum_stem2 = 1.25 * \interline;
+    % beam_ideal_stem2 = 1.75 * \interline;
+  }
+  \header{
+         opus = "BWV 847";
   }
 
   \midi {