]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bezier-bow.cc
* lily/all-font-metrics.cc (find_font): Add "lm" to try-AFM-first
[lilypond.git] / lily / bezier-bow.cc
index b9f6c104bdf1003d3adaccb3487f2ac43aafd9e0..70072356edab1bc5f421909fad2d69e878b8f7dc 100644 (file)
@@ -6,7 +6,7 @@
   (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include <math.h>
+#include <cmath>
 
 #include "misc.hh"
 #include "bezier.hh"
@@ -59,7 +59,7 @@ height   <indent>
 
   Although this might seem cand_idates to SCM-ify, it is not all clear
   which parameters (ie. h_inf, r_0, F (.)) should be candidates for
-  this.  At present h_inf and r_0 come from paper settings, but we did
+  this.  At present h_inf and r_0 come from layout settings, but we did
   no experiments for determining the best combinations of F, h_inf and
   r_0.
 
@@ -68,16 +68,29 @@ height   <indent>
   slurs.  For large slurs, this gives a certain hookiness at the end,
   so we increase the indent.
 
-  ind = G(w)
+  indent = G(w)
 
-  w -> 0,  G(w) -> .5 h
+  w -> 0,  G(w) -> .33 w
+
+  
+  (due to derivative constraints, we cannot have indent > len/3)
+
+  w -> inf, G(w) -> 2*h_inf
+
+  i.e.
 
-  w -> inf, G(w) -> 2*h
 
-  eg.
+  G(0) = 0 , G'(0) 1/3, G(infty) = 2h_inf
 
+  solve from
 
-  G(w) = h (w/(w+h_inf) 1.5 + .5 h 
+   G(w) = r  + p/(w+q)
+
+  yields
+
+   G(w) = 2 h_inf - max_fraction * q^2/ (w + q)
+
+  with q = 2 h_inf 
   
   
   */
@@ -86,8 +99,12 @@ void
 get_slur_indent_height (Real *indent, Real *height,
                        Real width, Real h_inf, Real r_0)
 {
+  Real max_fraction = 1.0 / 3.1;
   *height =  slur_height (width, h_inf, r_0);
-  *indent = (width / (h_inf + width) * 1.5 + 0.5) * (*height);
+
+  Real q = 2 * h_inf / max_fraction; 
+  *indent =
+    2 *h_inf - sqr (q) * max_fraction / (width + q);
 }
 
 Bezier