+
+
+
+
+Molecule*
+Tie::do_brew_molecule_p () const
+{
+ Real thick = paper_l ()->get_var ("tie_thickness");
+ Bezier one = get_curve ();
+
+ Molecule a;
+ SCM d = get_elt_property ("dashed");
+ if (gh_number_p (d))
+ a = lookup_l ()->dashed_slur (one, thick, gh_scm2int (d));
+ else
+ a = lookup_l ()->slur (one, directional_element (this).get () * thick, thick);
+
+ return new Molecule (a);
+}
+
+
+
+Bezier
+Tie::get_curve () const
+{
+ Direction d (directional_element (this).get ());
+ Bezier_bow b (get_encompass_offset_arr (), d);
+
+ b.ratio_ = paper_l ()->get_var ("slur_ratio");
+ b.height_limit_ = paper_l ()->get_var ("slur_height_limit");
+ b.rc_factor_ = paper_l ()->get_var ("slur_rc_factor");
+
+ b.calculate ();
+ Bezier c (b.get_curve ());
+
+ /* should do this for slurs as well. */
+ Array<Real> horizontal (c.solve_derivative (Offset (1,0)));
+
+ if (horizontal.size ())
+ {
+ /*
+ ugh. Doesnt work for non-horizontal curves.
+ */
+ Real space = staff_symbol_referencer (this).staff_space ();
+ Real y = c.curve_point (horizontal[0])[Y_AXIS];
+
+ Real ry = rint (y/space) * space;
+ Real diff = ry - y;
+ Real newy = y;
+ if (fabs (diff) < paper_l ()->get_var ("tie_staffline_clearance"))
+ {
+ newy = ry - 0.5 * space * sign (diff) ;
+ }
+
+ Real y0 = c.control_ [0][Y_AXIS];
+ c.control_[2][Y_AXIS] =
+ c.control_[1][Y_AXIS] =
+ (c.control_[1][Y_AXIS] - y0) * (newy / y) + y0;
+ }
+ else
+ programming_error ("Tie is nowhere horizontal");
+ return c;
+}
+
+
+Array<Offset>
+Tie::get_encompass_offset_arr () const
+{
+ Array<Offset> offset_arr;
+ offset_arr.push (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
+ offset_arr.push (Offset (spanner_length () + dx_f_drul_[RIGHT],
+ dy_f_drul_[RIGHT]));
+
+ return offset_arr;
+}
+
+