]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.21
authorfred <fred>
Sun, 24 Mar 2002 19:56:33 +0000 (19:56 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:56:33 +0000 (19:56 +0000)
lily/idealspacing.cc

index 16298be1e11613652a55bd2ccd23f9a87ca8f9a1..7497d3b66a8b5508a6fab8d7e07c62a845f8c421 100644 (file)
@@ -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;
+}