LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 }; | 108 }; |
109 | 109 |
110 /* | 110 /* |
111 Parameters for a single beam. Precomputed to save time in | 111 Parameters for a single beam. Precomputed to save time in |
112 scoring individual configurations. | 112 scoring individual configurations. |
113 | 113 |
114 */ | 114 */ |
115 class Beam_scoring_problem | 115 class Beam_scoring_problem |
116 { | 116 { |
117 public: | 117 public: |
118 Beam_scoring_problem (Grob *me, Drul_array<Real> ys, bool, bool); | 118 Beam_scoring_problem (Grob *me, Drul_array<Real> ys, bool); |
119 Drul_array<Real> solve () const; | 119 Drul_array<Real> solve () const; |
120 | 120 |
121 private: | 121 private: |
122 Spanner *beam_; | 122 Spanner *beam_; |
123 | 123 |
124 Interval unquanted_y_; | 124 Interval unquanted_y_; |
125 bool consistent_broken_slope_; | 125 bool align_broken_intos_; |
126 bool adjust_region_sizes_; | 126 bool do_initial_slope_calculations_; |
127 | 127 |
128 Real staff_space_; | 128 Real staff_space_; |
129 Real beam_thickness_; | 129 Real beam_thickness_; |
130 Real line_thickness_; | 130 Real line_thickness_; |
131 Real musical_dy_; | 131 Real musical_dy_; |
132 int normal_stem_count_; | 132 int normal_stem_count_; |
133 | |
134 Real x_span_; | 133 Real x_span_; |
135 | 134 |
136 | 135 |
137 /* | 136 /* |
138 Do stem computations. These depend on YL and YR linearly, so we can | 137 Do stem computations. These depend on YL and YR linearly, so we can |
139 precompute for every stem 2 factors. | 138 precompute for every stem 2 factors. |
140 | 139 |
141 We store some info to quickly interpolate. The stemlengths are | 140 We store some info to quickly interpolate. The stemlengths are |
142 affine linear in YL and YR. If YL == YR == 0, then we might have | 141 affine linear in YL and YR. If YL == YR == 0, then we might have |
143 stem_y != 0.0, when we're cross staff. | 142 stem_y != 0.0, when we're cross staff. |
(...skipping 21 matching lines...) Expand all Loading... |
165 // end. This is used for quickly weeding out invalid | 164 // end. This is used for quickly weeding out invalid |
166 // Beam_configurations. | 165 // Beam_configurations. |
167 Drul_array<Interval> quant_range_; | 166 Drul_array<Interval> quant_range_; |
168 Real beam_translation_; | 167 Real beam_translation_; |
169 vector<Beam_collision> collisions_; | 168 vector<Beam_collision> collisions_; |
170 vector<Beam_segment> segments_; | 169 vector<Beam_segment> segments_; |
171 | 170 |
172 vsize first_normal_index (); | 171 vsize first_normal_index (); |
173 vsize last_normal_index (); | 172 vsize last_normal_index (); |
174 | 173 |
175 void init_stems (); | 174 void init_instance_variables (Grob *me, Drul_array<Real> ys, bool align_broken
_intos); |
176 void add_collision (Real x, Interval y, Real factor); | 175 void add_collision (Real x, Interval y, Real factor); |
177 void no_visible_stem_positions (); | 176 void no_visible_stem_positions (); |
178 void least_squares_positions (); | 177 void least_squares_positions (); |
| 178 Real calc_concaveness (); |
179 void slope_damping (); | 179 void slope_damping (); |
180 void shift_region_to_valid (); | 180 void shift_region_to_valid (); |
181 | 181 |
182 void one_scorer (Beam_configuration *config) const; | 182 void one_scorer (Beam_configuration *config) const; |
183 Beam_configuration *force_score (SCM inspect_quants, | 183 Beam_configuration *force_score (SCM inspect_quants, |
184 const vector<Beam_configuration *> &configs)
const; | 184 const vector<Beam_configuration *> &configs)
const; |
185 Real y_at (Real x, Beam_configuration const *c) const; | 185 Real y_at (Real x, Beam_configuration const *c) const; |
186 | 186 |
187 // Scoring functions: | 187 // Scoring functions: |
188 void score_forbidden_quants (Beam_configuration *config) const; | 188 void score_forbidden_quants (Beam_configuration *config) const; |
189 void score_horizontal_inter_quants (Beam_configuration *config) const; | 189 void score_horizontal_inter_quants (Beam_configuration *config) const; |
190 void score_slope_ideal (Beam_configuration *config) const; | 190 void score_slope_ideal (Beam_configuration *config) const; |
191 void score_slope_direction (Beam_configuration *config) const; | 191 void score_slope_direction (Beam_configuration *config) const; |
192 void score_slope_musical (Beam_configuration *config) const; | 192 void score_slope_musical (Beam_configuration *config) const; |
193 void score_stem_lengths (Beam_configuration *config) const; | 193 void score_stem_lengths (Beam_configuration *config) const; |
194 void generate_quants (vector<Beam_configuration *>* scores) const; | 194 void generate_quants (vector<Beam_configuration *>* scores) const; |
195 void score_collisions (Beam_configuration *config) const; | 195 void score_collisions (Beam_configuration *config) const; |
196 }; | 196 }; |
197 | 197 |
198 #endif /* BEAM_SCORING_PROBLEM_HH */ | 198 #endif /* BEAM_SCORING_PROBLEM_HH */ |
LEFT | RIGHT |