-/*
- [TODO]
- handle rest under beam (do_post: beams are calculated now)
- what about combination of collisions and rest under beam.
-
- Should lookup
-
- rest -> stem -> beam -> interpolate_y_position ()
-*/
-
-GLUE_SCORE_ELEMENT(Note_column,after_line_breaking);
-SCM
-Note_column::member_after_line_breaking ()
-{
- if (!stem_l () || !rest_b ())
- return SCM_UNDEFINED;
-
- Beam * b = stem_l ()->beam_l ();
- if (!b || !b->visible_stem_count ())
- return SCM_UNDEFINED;
-
- /* ugh. Should be done by beam.
- (what? should be done --jcn)
- scary too?: height is calculated during post_processing
- */
- Real beam_dy = 0;
- Real beam_y = 0;
-
- SCM s = b->get_elt_property ("height");
- if (gh_number_p (s))
- beam_dy = gh_scm2double (s);
-
- s = b->get_elt_property ("y-position");
- if (gh_number_p (s))
- beam_y = gh_scm2double (s);
-
-
- Real x0 = b->first_visible_stem ()->relative_coordinate (0, X_AXIS);
- Real dx = b->last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0;
- Real dydx = beam_dy && dx ? beam_dy/dx : 0;
-
- Direction d = stem_l ()->get_direction ();
- Real beamy = (stem_l ()->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y;
-
- s = get_elt_pointer ("rests");
- Score_element * se = unsmob_element (gh_car (s));
- Staff_symbol_referencer_interface si (se);
-
- Real staff_space = si.staff_space ();
- Real rest_dim = extent (Y_AXIS)[d]*2.0 /staff_space ;
-
- Real minimum_dist
- = paper_l ()->get_var ("restcollision_minimum_beamdist") ;
- Real dist =
- minimum_dist + -d * (beamy - rest_dim) >? 0;
-
- int stafflines = si.line_count ();
-
- // move discretely by half spaces.
- int discrete_dist = int (ceil (dist ));