From: fred Date: Tue, 26 Mar 2002 22:14:36 +0000 (+0000) Subject: lilypond-1.1.52 X-Git-Tag: release/1.5.59~2314 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bde7974caa2f72fbfe55481cd99801631a6975cb;p=lilypond.git lilypond-1.1.52 --- diff --git a/lily/leastsquares.cc b/lily/leastsquares.cc index 0f1568f29f..a9bb8df655 100644 --- a/lily/leastsquares.cc +++ b/lily/leastsquares.cc @@ -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; - } diff --git a/lily/note-column.cc b/lily/note-column.cc index 282ab3cdd1..c5c8dfca33 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -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; } diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 8aab13a276..d1d322af16 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -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 (i.elem_l_); if (Stem*s=dynamic_cast (item)) {