]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stem.cc
Avoid floating-point compares on Stem:head_positions; issue 4310
[lilypond.git] / lily / stem.cc
index 045a90760b29d7e916f211e0c46322b99f433ea2..f21e0de6b5dac5b7dffbd0a3b1da25f4fcbb0562 100644 (file)
@@ -110,10 +110,10 @@ Stem::head_positions (Grob *me)
 Real
 Stem::chord_start_y (Grob *me)
 {
-  Interval hp = head_positions (me);
-  if (!hp.is_empty ())
-    return hp[get_grob_direction (me)] * Staff_symbol_referencer::staff_space (me)
-           * 0.5;
+  if (head_count (me))
+    return Staff_symbol_referencer::get_position (last_head (me))
+      * Staff_symbol_referencer::staff_space (me) * 0.5;
+
   return 0;
 }
 
@@ -658,9 +658,9 @@ Stem::calc_default_direction (SCM smob)
 
   Direction dir = CENTER;
   int staff_center = 0;
-  Interval hp = head_positions (me);
-  if (!hp.is_empty ())
+  if (head_count (me))
     {
+      Interval hp = head_positions (me);
       int udistance = (int) (UP * hp[UP] - staff_center);
       int ddistance = (int) (DOWN * hp[DOWN] - staff_center);