+
+ vector<int> nhp = Stem::note_head_positions (stem);
+ /*
+ * We re-decide stem-dir if there may be collisions with other
+ * note heads in the staff.
+ */
+ Grob *maybe_nc = stem->get_parent (X_AXIS)->get_parent (X_AXIS);
+ bool whole_note = Stem::duration_log (stem) <= 0;
+ if (whole_note && has_interface<Note_collision_interface> (maybe_nc))
+ {
+ Drul_array<bool> avoid_me (false, false);
+ vector<int> all_nhps = Note_collision_interface::note_head_positions (maybe_nc);
+ if (all_nhps[0] < nhp[0])
+ avoid_me[DOWN] = true;
+ if (all_nhps.back () > nhp.back ())
+ avoid_me[UP] = true;
+ if (avoid_me[stemdir])
+ {
+ stemdir = -stemdir;
+ if (avoid_me[stemdir])
+ {
+ me->warning ("Whole-note tremolo may collide with simultaneous notes.");
+ stemdir = -stemdir;
+ }
+ }
+ }
+ return scm_from_int (stemdir);
+}
+
+Real
+Stem_tremolo::y_offset (Grob *me, bool pure)
+{
+ Item *stem = unsmob<Item> (me->get_object ("stem"));
+ if (!stem)
+ return 0.0;
+
+ Direction dir = get_grob_direction (me);