2 bezier.cc -- implement Bezier and Bezier_bow
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
18 return 2 / M_PI * atan (M_PI * x / 2);
22 slur_height (Real width, Real h_inf, Real r_0)
24 return F0_1 (width * r_0 / h_inf) * h_inf;
38 For small w, the height should be proportional to w, for w ->
39 infinity, the height should rise to a limit asymptotically.
41 Hence we take F (x) such that
42 F (0) = 0 , F' (0) = 1, and F (infty) = 1
46 h = h_infinity * F (x * r_0 / h_infinity)
51 * F (x) = 2/pi * atan (pi x/2)
53 * F (x) = 1/alpha * x^alpha / (1 + x^alpha)
57 [with the 2nd recipe you can determine how quickly the conversion from
58 `small' slurs to `big' slurs occurs.]
60 Although this might seem cand_idates to SCM-ify, it is not all clear
61 which parameters (ie. h_inf, r_0, F (.)) should be candidates for
62 this. At present h_inf and r_0 come from paper settings, but we did
63 no experiments for determining the best combinations of F, h_inf and
67 The indent is proportional to the height of the slur for small
68 slurs. For large slurs, this gives a certain hookiness at the end,
69 so we increase the indent.
80 G(w) = h (w/(w+h_inf) 1.5 + .5 h
86 get_slur_indent_height (Real * indent, Real *height,
87 Real width, Real h_inf, Real r_0)
89 *height = slur_height (width, h_inf, r_0);
90 *indent = (width/(h_inf+ width)*1.5 + 0.5) * (*height);
97 slur_shape (Real width, Real h_inf, Real r_0)
102 get_slur_indent_height (&indent, &height,
106 curve.control_[0] = Offset (0, 0);
107 curve.control_[1] = Offset (indent, height);
108 curve.control_[2] = Offset (width - indent, height);
109 curve.control_[3] = Offset (width, 0);