+ Grob *s2 = Beam::last_normal_stem (beam);
+ Grob *s1 = Beam::first_normal_stem (beam);
+
+ Grob *common = s1->common_refpoint (s2, X_AXIS);
+ Real dx = s2->relative_coordinate (common, X_AXIS) -
+ s1->relative_coordinate (common, X_AXIS);
+
+ return scm_from_double (dx ? dy / dx : 0);
+ }
+ else
+ /* down stems with flags should have more sloped trems (helps avoid
+ flag/stem collisions without making the stem very long) */
+ return scm_from_double (
+ (Stem::duration_log (stem) >= 3 && get_grob_direction (stem) == DOWN) ?
+ 0.40 : 0.25);
+}
+
+MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_width, 1)
+SCM
+Stem_tremolo::calc_width (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Grob *stem = unsmob_grob (me->get_object ("stem"));
+ Direction stemdir = get_grob_direction (stem);
+ bool beam = Stem::get_beam (stem);
+ bool flag = Stem::duration_log (stem) >= 3 && !beam;
+
+ /* beamed stems and up-stems with flags have shorter tremolos */
+ return scm_from_double (((stemdir == UP && flag) || beam)? 1.0 : 1.5);
+}
+
+MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_style, 1)
+SCM
+Stem_tremolo::calc_style (SCM smob)