- pos = Interval (y, (y+dy));
- me->set_grob_property ("positions", ly_interval2scm (pos));
- return SCM_UNSPECIFIED;
-}
-
-
-MAKE_SCHEME_CALLBACK (Beam, check_concave, 1);
-SCM
-Beam::check_concave (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
-
- Link_array<Grob> stems =
- Pointer_group_interface__extract_grobs (me, (Grob*) 0, "stems");
-
- for (int i = 0; i < stems.size ();)
- {
- if (Stem::invisible_b (stems[i]))
- stems.del (i);
- else
- i++;
- }
-
- if (stems.size () < 3)
- return SCM_UNSPECIFIED;
-
-
- /* Concaveness #1: If distance of an inner notehead to line between
- two outer noteheads is bigger than CONCAVENESS-GAP (2.0ss),
- beam is concave (Heinz Stolba).
-
- In the case of knees, the line connecting outer heads is often
- not related to the beam slope (it may even go in the other
- direction). Skip the check when the outer stems point in
- different directions. --hwn
-
- */
- bool concaveness1 = false;
- SCM gap = me->get_grob_property ("concaveness-gap");
- if (gh_number_p (gap)
- && Stem::get_direction(stems.top ())
- == Stem::get_direction(stems[0]))
- {
- Real r1 = gh_scm2double (gap);
- Real dy = Stem::chord_start_y (stems.top ())
- - Stem::chord_start_y (stems[0]);
-
-
- Real slope = dy / (stems.size () - 1);
-
- Real y0 = Stem::chord_start_y (stems[0]);
- for (int i = 1; i < stems.size () - 1; i++)
- {
- Real c = (Stem::chord_start_y (stems[i]) - y0) - i * slope;
- if (c > r1)
- {
- concaveness1 = true;
- break;
- }
- }
- }
-
-
- /* Concaveness #2: Sum distances of inner noteheads that fall
- outside the interval of the two outer noteheads.
-
- We only do this for beams where first and last stem have the same
- direction. --hwn.
-
-
- Note that "convex" stems compensate for "concave" stems.
- (is that intentional?) --hwn.
- */