]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.52
authorfred <fred>
Tue, 26 Mar 2002 22:14:36 +0000 (22:14 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:14:36 +0000 (22:14 +0000)
lily/leastsquares.cc
lily/note-column.cc
lily/rhythmic-column-engraver.cc

index 0f1568f29f82f44f2ac714b2e1d064666a685dbd..a9bb8df655cf1121f3f9e94a59f0e95e1510b5ab 100644 (file)
@@ -1,4 +1,5 @@
 #include "leastsquares.hh"
+#include "warn.hh"
 
 void
 Least_squares::OK() const
@@ -6,7 +7,7 @@ Least_squares::OK() const
   assert (input.size() > 1);
   Real dx = 0.0;
   for (int i=1; i < input.size(); i++)
-       dx += abs (input[i-1].x() - input[i].x ());
+    dx += abs (input[i-1].x() - input[i].x ());
 
   assert (dx);
 }
@@ -14,7 +15,6 @@ Least_squares::OK() const
 void
 Least_squares::minimise (Real &coef, Real &offset)
 {
-  OK();
   Real sx = 0.0;
   Real sy = 0.0;
   Real sqx =0.0;
@@ -30,9 +30,13 @@ Least_squares::minimise (Real &coef, Real &offset)
        sxy += x*y;
     }
   int N = input.size();
-  
 
-  coef = (N * sxy - sx*sy)/(N*sqx - sqr (sx));
+  coef =0.0;
+  offset =0.;
+  
+  Real den = (N*sqx - sqr (sx));
+  if (!N || !den)
+    programming_error ("Least_squares::minimise():  Nothing to minimise");
+  coef = (N * sxy - sx*sy)/den;
   offset = (sy - coef * sx)/N;
-       
 }
index 282ab3cdd13b009f36f4d8669bb10202cef701f0..c5c8dfca3394cd8bb3c936a6ed88182d44c7f5e8 100644 (file)
@@ -65,7 +65,7 @@ Note_column::dir () const
   else if (head_l_arr_.size ())
     return sign (head_positions_interval().center ());
 
-  assert (false);
+  programming_error ("Note column without heads and  stem!");
   return CENTER;
 }
 
index 8aab13a276565490afec28a4261d0bd0d7ab188b..d1d322af164c393165b26b3418c30ea5f3256fe5 100644 (file)
@@ -71,6 +71,10 @@ Rhythmic_column_engraver::process_acknowledged ()
 void
 Rhythmic_column_engraver::acknowledge_element (Score_element_info i)
 {
+  if (get_property ("weAreGraceContext",0).to_bool () !=
+      (i.elem_l_->get_elt_property (grace_scm_sym) != SCM_BOOL_F))
+    return ;
+  
   Item * item =  dynamic_cast <Item *> (i.elem_l_);
   if (Stem*s=dynamic_cast<Stem *> (item))
     {