LEFT | RIGHT |
(no file at all) | |
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) 1997--2019 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2019 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 beam_ = dynamic_cast<Spanner *> (me); | 198 beam_ = dynamic_cast<Spanner *> (me); |
199 unquanted_y_ = ys; | 199 unquanted_y_ = ys; |
200 | 200 |
201 /* | 201 /* |
202 If 'ys' are finite, use them as starting points for y-positions of the | 202 If 'ys' are finite, use them as starting points for y-positions of the |
203 ends of the beam, instead of the best-fit through the natural ends of | 203 ends of the beam, instead of the best-fit through the natural ends of |
204 the stems. Otherwise, we want to do initial slope calculations. | 204 the stems. Otherwise, we want to do initial slope calculations. |
205 */ | 205 */ |
206 do_initial_slope_calculations_ = false; | 206 do_initial_slope_calculations_ = false; |
207 for (LEFT_and_RIGHT (d)) | 207 for (LEFT_and_RIGHT (d)) |
208 do_initial_slope_calculations_ |= isinf (unquanted_y_[d]) || isnan (unquante
d_y_[d]); | 208 do_initial_slope_calculations_ |= !std::isfinite (unquanted_y_[d]); |
209 | 209 |
210 /* | 210 /* |
211 Calculations are relative to a unit-scaled staff, i.e. the quants are | 211 Calculations are relative to a unit-scaled staff, i.e. the quants are |
212 divided by the current staff_space_. | 212 divided by the current staff_space_. |
213 */ | 213 */ |
214 staff_space_ = Staff_symbol_referencer::staff_space (beam_); | 214 staff_space_ = Staff_symbol_referencer::staff_space (beam_); |
215 beam_thickness_ = Beam::get_beam_thickness (beam_) / staff_space_; | 215 beam_thickness_ = Beam::get_beam_thickness (beam_) / staff_space_; |
216 line_thickness_ = Staff_symbol_referencer::line_thickness (beam_) / staff_spac
e_; | 216 line_thickness_ = Staff_symbol_referencer::line_thickness (beam_) / staff_spac
e_; |
217 | 217 |
218 // This is the least-squares DY, corrected for concave beams. | 218 // This is the least-squares DY, corrected for concave beams. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 least_squares_positions (); | 403 least_squares_positions (); |
404 slope_damping (); | 404 slope_damping (); |
405 shift_region_to_valid (); | 405 shift_region_to_valid (); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 // Assuming V is not empty, pick a 'reasonable' point inside V. | 409 // Assuming V is not empty, pick a 'reasonable' point inside V. |
410 static Real | 410 static Real |
411 point_in_interval (Interval v, Real dist) | 411 point_in_interval (Interval v, Real dist) |
412 { | 412 { |
413 if (isinf (v[DOWN])) | 413 if (std::isinf (v[DOWN])) |
414 return v[UP] - dist; | 414 return v[UP] - dist; |
415 else if (isinf (v[UP])) | 415 else if (std::isinf (v[UP])) |
416 return v[DOWN] + dist; | 416 return v[DOWN] + dist; |
417 else | 417 else |
418 return v.center (); | 418 return v.center (); |
419 } | 419 } |
420 | 420 |
421 /* Set stem's shorten property if unset. | 421 /* Set stem's shorten property if unset. |
422 | 422 |
423 TODO: | 423 TODO: |
424 take some y-position (chord/beam/nearest?) into account | 424 take some y-position (chord/beam/nearest?) into account |
425 scmify forced-fraction | 425 scmify forced-fraction |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 Real collision_demerit = collisions_[i].base_penalty_ * | 1321 Real collision_demerit = collisions_[i].base_penalty_ * |
1322 pow (scale_free, 3) * parameters_.COLLISION_PENALTY; | 1322 pow (scale_free, 3) * parameters_.COLLISION_PENALTY; |
1323 | 1323 |
1324 if (collision_demerit > 0) { | 1324 if (collision_demerit > 0) { |
1325 demerits += collision_demerit; | 1325 demerits += collision_demerit; |
1326 } | 1326 } |
1327 } | 1327 } |
1328 | 1328 |
1329 config->add (demerits, "C"); | 1329 config->add (demerits, "C"); |
1330 } | 1330 } |
LEFT | RIGHT |