X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbeam-concave.cc;h=e703f9e9f796c62a837fe36843584c32fe70c461;hb=fba53fe32502b6d62ffbd251e1fbf22e5e5ed24f;hp=00ceb61dcd8479e0bdf0354775278c34e9c52edf;hpb=64313890b232c731d432e5b096f30bffc3f3756d;p=lilypond.git diff --git a/lily/beam-concave.cc b/lily/beam-concave.cc index 00ceb61dcd..e703f9e9f7 100644 --- a/lily/beam-concave.cc +++ b/lily/beam-concave.cc @@ -3,14 +3,14 @@ */ #include "pointer-group-interface.hh" -#include "std-vector.hh" #include "stem.hh" #include "beam.hh" +#include "grob.hh" #include "staff-symbol-referencer.hh" #include "directional-element-interface.hh" bool -is_concave_single_notes (std::vector const &positions, Direction beam_dir) +is_concave_single_notes (vector const &positions, Direction beam_dir) { Interval covering; covering.add_point (positions[0]); @@ -23,7 +23,7 @@ is_concave_single_notes (std::vector const &positions, Direction beam_dir) /* notes above and below the interval covered by 1st and last note. */ - for (vsize i = 1; i < positions.size () - 1; i++) + for (vsize i = 1; i + 1 < positions.size (); i++) { above = above || (positions[i] > covering[UP]); below = below || (positions[i] < covering[DOWN]); @@ -36,7 +36,7 @@ is_concave_single_notes (std::vector const &positions, Direction beam_dir) */ int dy = positions.back () - positions[0]; int closest = max (beam_dir * positions.back (), beam_dir * positions[0]); - for (vsize i = 2; !concave && i < positions.size () - 1; i++) + for (vsize i = 2; !concave && i + 1 < positions.size (); i++) { int inner_dy = positions[i] - positions[i - 1]; if (sign (inner_dy) != sign (dy) @@ -46,7 +46,7 @@ is_concave_single_notes (std::vector const &positions, Direction beam_dir) } bool all_closer = true; - for (vsize i = 1; all_closer && i < positions.size () - 1; i++) + for (vsize i = 1; all_closer && i + 1 < positions.size (); i++) { all_closer = all_closer && (beam_dir * positions[i] > closest); @@ -57,12 +57,12 @@ is_concave_single_notes (std::vector const &positions, Direction beam_dir) } Real -calc_positions_concaveness (std::vector const &positions, Direction beam_dir) +calc_positions_concaveness (vector const &positions, Direction beam_dir) { Real dy = positions.back () - positions[0]; Real slope = dy / Real (positions.size () - 1); Real concaveness = 0.0; - for (vsize i = 1; i < positions.size () - 1; i++) + for (vsize i = 1; i + 1 < positions.size (); i++) { Real line_y = slope * i + positions[0]; @@ -87,7 +87,7 @@ Beam::calc_concaveness (SCM smob) { Grob *me = unsmob_grob (smob); - Link_array stems + vector stems = extract_grob_array (me, "stems"); if (is_knee (me)) @@ -96,20 +96,20 @@ Beam::calc_concaveness (SCM smob) Direction beam_dir = CENTER; for (vsize i = stems.size (); i--;) { - if (Stem::is_invisible (stems[i])) - stems.del (i); - else + if (Stem::is_normal_stem (stems[i])) { if (Direction dir = get_grob_direction (stems[i])) beam_dir = dir; } + else + stems.erase (stems.begin () + i); } if (stems.size () <= 2) - return SCM_UNSPECIFIED; + return scm_from_int (0); - std::vector close_positions; - std::vector far_positions; + vector close_positions; + vector far_positions; for (vsize i = 0; i < stems.size (); i++) { /*