+ bool follow_beam = par_beam
+ && get_grob_direction (par_beam) == dir
+ && !Beam::is_knee (par_beam);
+
+ vector<Offset> points;
+ if (columns.size ()
+ && follow_beam
+ && Note_column::get_stem (columns[0])
+ && Note_column::get_stem (columns.back ()))
+ {
+ Drul_array<Grob *> stems (Note_column::get_stem (columns[0]),
+ Note_column::get_stem (columns.back ()));
+
+ Interval poss;
+ for (LEFT_and_RIGHT (side))
+ {
+ // Trigger setting of stem lengths if necessary.
+ if (Grob *beam = Stem::get_beam (stems[side]))
+ (void) beam->get_property ("quantized-positions");
+ poss[side] = stems[side]->extent (stems[side], Y_AXIS)[get_grob_direction (stems[side])]
+ + stems[side]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
+ }
+
+ *dy = poss[RIGHT] - poss[LEFT];
+ points.push_back (Offset (stems[LEFT]->relative_coordinate (commonx, X_AXIS) - x0, poss[LEFT]));
+ points.push_back (Offset (stems[RIGHT]->relative_coordinate (commonx, X_AXIS) - x0, poss[RIGHT]));
+ }
+ else
+ {
+ /*
+ Use outer non-rest columns to determine slope
+ */
+ Grob *left_col = 0;
+ Grob *right_col = 0;
+ get_bounds (me, &left_col, &right_col);
+ if (left_col && right_col)
+ {
+ Interval rv = Note_column::cross_staff_extent (right_col, commony);
+ Interval lv = Note_column::cross_staff_extent (left_col, commony);
+ rv.unite (staff);
+ lv.unite (staff);
+
+ Real graphical_dy = rv[dir] - lv[dir];
+
+ Slice ls = Note_column::head_positions_interval (left_col);
+ Slice rs = Note_column::head_positions_interval (right_col);
+
+ Interval musical_dy;
+ musical_dy[UP] = rs[UP] - ls[UP];
+ musical_dy[DOWN] = rs[DOWN] - ls[DOWN];
+ if (sign (musical_dy[UP]) != sign (musical_dy[DOWN]))
+ *dy = 0.0;
+ else if (sign (graphical_dy) != sign (musical_dy[DOWN]))
+ *dy = 0.0;
+ else
+ *dy = graphical_dy;
+ }
+ else
+ *dy = 0;