]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/misc.cc
* lily/slur-configuration.cc (fit_factor): oops, skip point if
[lilypond.git] / lily / misc.cc
index 54da3d0f5566a035e3d804655cc3f79f90f985f8..e7c3063df234c6ce79bca6185bf9358e837e401b 100644 (file)
@@ -43,3 +43,15 @@ directed_round (Real f, Direction d)
     return ceil (f);
 }
 
+
+
+/*
+   0 at threshold,  1 at 0, with 1/x falloff.
+ */
+Real
+peak_around (Real epsilon,  Real threshold, Real x)
+{
+  if (x < 0)
+    return 1.0;
+  return max (- epsilon * (x - threshold) / ((x + epsilon)  * threshold), 0.0);
+}