+
+/*
+ [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 ()
+
+*/
+
+void
+Note_column::do_post_processing ()
+{
+ if (!stem_l_ || !rest_b ())
+ return;
+
+ Beam * b = stem_l_->beam_l_;
+ if (!b || !b->stems_.size ())
+ return;
+
+ /* ugh. Should be done by beam. */
+ Direction d = stem_l_->get_dir ();
+ Real beamy = (stem_l_->hpos_f () - b->stems_[0]->hpos_f ()) * b->slope_f_ + b->left_y_;
+
+ Real staff_space = rest_l_arr_[0]->staff_line_leading_f ();
+ 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 = rest_l_arr_[0]->lines_i ();
+
+ // move discretely by half spaces.
+ int discrete_dist = int (ceil (dist ));
+
+ // move by whole spaces inside the staff.
+ if (discrete_dist < stafflines+1)
+ discrete_dist = int (ceil (discrete_dist / 2.0)* 2.0);
+
+ translate_rests (-d * discrete_dist);
+}