From: fred Date: Sun, 24 Mar 2002 19:56:33 +0000 (+0000) Subject: lilypond-0.1.21 X-Git-Tag: release/1.5.59~3956 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=78cc849a44dfbcedf9191bf804883f10f5e0066f;p=lilypond.git lilypond-0.1.21 --- diff --git a/lily/idealspacing.cc b/lily/idealspacing.cc index 16298be1e1..7497d3b66a 100644 --- a/lily/idealspacing.cc +++ b/lily/idealspacing.cc @@ -34,3 +34,15 @@ Idealspacing::OK() const { assert (hooke_f_ >= 0); } + +Real +Idealspacing::energy_f(Real x) const +{ + Real dx = (space_f_ - x); + + Real e = sqr(dx); + if ( dx < 0) + e *= 4; // ugh. + + return hooke_f_ * e; +}