Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(760)

Delta Between Two Patch Sets: lily/slur-scoring.cc

Issue 6498077: Approximates cross-staff slurs in VerticalAxisGroup vertical-skylines. Base URL: http://git.savannah.gnu.org/gitweb/?p=lilypond.git/trunk/
Left Patch Set: Uses single data structure in engraver for slur and stubs. Created 12 years, 7 months ago
Right Patch Set: Better approximations Created 12 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> 4 Copyright (C) 1996--2012 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 10 matching lines...) Expand all
21 #include "slur-scoring.hh" 21 #include "slur-scoring.hh"
22 22
23 #include <queue> 23 #include <queue>
24 24
25 #include "axis-group-interface.hh" 25 #include "axis-group-interface.hh"
26 #include "accidental-interface.hh" 26 #include "accidental-interface.hh"
27 #include "beam.hh" 27 #include "beam.hh"
28 #include "clef.hh" 28 #include "clef.hh"
29 #include "directional-element-interface.hh" 29 #include "directional-element-interface.hh"
30 #include "dots.hh" 30 #include "dots.hh"
31 #include "international.hh"
31 #include "libc-extension.hh" 32 #include "libc-extension.hh"
32 #include "main.hh" 33 #include "main.hh"
33 #include "misc.hh" 34 #include "misc.hh"
34 #include "note-column.hh" 35 #include "note-column.hh"
35 #include "output-def.hh" 36 #include "output-def.hh"
36 #include "paper-column.hh" 37 #include "paper-column.hh"
37 #include "pitch.hh" 38 #include "pitch.hh"
38 #include "pointer-group-interface.hh" 39 #include "pointer-group-interface.hh"
39 #include "slur-configuration.hh" 40 #include "slur-configuration.hh"
40 #include "slur.hh" 41 #include "slur.hh"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Slur_score_state::get_encompass_info (Grob *col) const 110 Slur_score_state::get_encompass_info (Grob *col) const
110 { 111 {
111 Grob *stem = unsmob_grob (col->get_object ("stem")); 112 Grob *stem = unsmob_grob (col->get_object ("stem"));
112 Encompass_info ei; 113 Encompass_info ei;
113 114
114 if (!stem) 115 if (!stem)
115 { 116 {
116 programming_error ("no stem for note column"); 117 programming_error ("no stem for note column");
117 ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS); 118 ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS);
118 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], 119 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS],
119 Y_AXIS, stub_, 0, INT_MAX)[dir_]; 120 Y_AXIS, stub_, spanned_rank_interval_[L EFT], spanned_rank_interval_[RIGHT])[dir_];
120 return ei; 121 return ei;
121 } 122 }
122 Direction stem_dir = get_grob_direction (stem); 123 Direction stem_dir = get_grob_direction (stem);
123 124
124 if (Grob *head = Note_column::first_head (col)) 125 if (Grob *head = Note_column::first_head (col))
125 ei.x_ = head->extent (common_[X_AXIS], X_AXIS).center (); 126 ei.x_ = head->extent (common_[X_AXIS], X_AXIS).center ();
126 else 127 else
127 ei.x_ = col->extent (common_[X_AXIS], X_AXIS).center (); 128 ei.x_ = col->extent (common_[X_AXIS], X_AXIS).center ();
128 129
129 Grob *h = Stem::extremal_heads (stem)[Direction (dir_)]; 130 Grob *h = Stem::extremal_heads (stem)[Direction (dir_)];
130 if (!h) 131 if (!h)
131 { 132 {
132 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stu b_, 0, INT_MAX)[dir_]; 133 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stu b_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_];
133 return ei; 134 return ei;
134 } 135 }
135 136
136 ei.head_ = h->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[d ir_]; 137 ei.head_ = h->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, spanned_rank_ interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_];
137 138
138 if ((stem_dir == dir_) 139 if ((stem_dir == dir_)
139 && !stem->maybe_pure_extent (stem, Y_AXIS, stub_, 0, INT_MAX).is_empty ()) 140 && !stem->maybe_pure_extent (stem, Y_AXIS, stub_, spanned_rank_interval_[L EFT], spanned_rank_interval_[RIGHT]).is_empty ())
140 { 141 {
141 ei.stem_ = stem->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT _MAX)[dir_]; 142 ei.stem_ = stem->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, spanne d_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_];
142 if (Grob *b = Stem::get_beam (stem)) 143 if (Grob *b = Stem::get_beam (stem))
143 ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b); 144 ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b);
144 145
145 Interval x = stem->extent (common_[X_AXIS], X_AXIS); 146 Interval x = stem->extent (common_[X_AXIS], X_AXIS);
146 ei.x_ = x.is_empty () 147 ei.x_ = x.is_empty ()
147 ? stem->relative_coordinate (common_[X_AXIS], X_AXIS) 148 ? stem->relative_coordinate (common_[X_AXIS], X_AXIS)
148 : x.center (); 149 : x.center ();
149 } 150 }
150 else 151 else
151 ei.stem_ = ei.head_; 152 ei.stem_ = ei.head_;
(...skipping 18 matching lines...) Expand all
170 extremes[d].flag_ = Note_column::get_flag (extremes[d].note_column_); 171 extremes[d].flag_ = Note_column::get_flag (extremes[d].note_column_);
171 172
172 if (extremes[d].stem_) 173 if (extremes[d].stem_)
173 { 174 {
174 extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_); 175 extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_);
175 176
176 for (int a = X_AXIS; a < NO_AXES; a++) 177 for (int a = X_AXIS; a < NO_AXES; a++)
177 { 178 {
178 Axis ax = Axis (a); 179 Axis ax = Axis (a);
179 Interval s = ax == Y_AXIS 180 Interval s = ax == Y_AXIS
180 ? extremes[d].stem_->maybe_pure_extent (common_[a x], ax, stub_, 0, INT_MAX) 181 ? extremes[d].stem_->maybe_pure_extent (common_[a x], ax, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])
181 : extremes[d].stem_->extent (common_[ax], ax); 182 : extremes[d].stem_->extent (common_[ax], ax);
182 if (extremes[d].flag_) 183 if (extremes[d].flag_)
183 s.unite (ax == Y_AXIS 184 s.unite (ax == Y_AXIS
184 ? extremes[d].flag_->maybe_pure_extent (common_[ax] , ax, stub_, 0, INT_MAX) 185 ? extremes[d].flag_->maybe_pure_extent (common_[ax] , ax, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])
185 : extremes[d].flag_->extent (common_[ax], ax)); 186 : extremes[d].flag_->extent (common_[ax], ax));
186 if (s.is_empty ()) 187 if (s.is_empty ())
187 { 188 {
188 /* 189 /*
189 do not issue warning. This happens for rests and 190 do not issue warning. This happens for rests and
190 whole notes. 191 whole notes.
191 */ 192 */
192 s = Interval (0, 0) 193 s = Interval (0, 0)
193 + (ax == Y_AXIS 194 + (ax == Y_AXIS
194 ? extremes[d].stem_->maybe_pure_coordinate (common_ [ax], ax, stub_, 0, INT_MAX) 195 ? extremes[d].stem_->maybe_pure_coordinate (common_ [ax], ax, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])
195 : extremes[d].stem_->relative_coordinate (common_[a x], ax)); 196 : extremes[d].stem_->relative_coordinate (common_[a x], ax));
196 } 197 }
197 extremes[d].stem_extent_[ax] = s; 198 extremes[d].stem_extent_[ax] = s;
198 } 199 }
199 200
200 extremes[d].slur_head_ 201 extremes[d].slur_head_
201 = Stem::extremal_heads (extremes[d].stem_)[dir]; 202 = Stem::extremal_heads (extremes[d].stem_)[dir];
202 if (!extremes[d].slur_head_ 203 if (!extremes[d].slur_head_
203 && Note_column::has_rests (extremes[d].bound_)) 204 && Note_column::has_rests (extremes[d].bound_))
204 extremes[d].slur_head_ = Note_column::get_rest (extremes[d].boun d_); 205 extremes[d].slur_head_ = Note_column::get_rest (extremes[d].boun d_);
(...skipping 11 matching lines...) Expand all
216 } 217 }
217 218
218 return extremes; 219 return extremes;
219 } 220 }
220 221
221 void 222 void
222 Slur_score_state::fill (Grob *me) 223 Slur_score_state::fill (Grob *me)
223 { 224 {
224 slur_ = dynamic_cast<Spanner *> (me); 225 slur_ = dynamic_cast<Spanner *> (me);
225 stub_ = slur_->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interf ace")); 226 stub_ = slur_->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interf ace"));
227 spanned_rank_interval_ = slur_->spanned_rank_interval ();
226 228
227 columns_ 229 columns_
228 = internal_extract_grob_array (me, ly_symbol2scm ("note-columns")); 230 = internal_extract_grob_array (me, ly_symbol2scm ("note-columns"));
229 231
230 if (columns_.empty ()) 232 if (columns_.empty ())
231 { 233 {
232 me->suicide (); 234 me->suicide ();
233 return; 235 return;
234 } 236 }
235 237
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 encompass_infos_.push_back (get_encompass_info (columns_[i])); 320 encompass_infos_.push_back (get_encompass_info (columns_[i]));
319 321
320 valid_ = true; 322 valid_ = true;
321 323
322 musical_dy_ = 0.0; 324 musical_dy_ = 0.0;
323 for (LEFT_and_RIGHT (d)) 325 for (LEFT_and_RIGHT (d))
324 { 326 {
325 if (!is_broken_ 327 if (!is_broken_
326 && extremes_[d].slur_head_) 328 && extremes_[d].slur_head_)
327 musical_dy_ += d 329 musical_dy_ += d
328 * extremes_[d].slur_head_->maybe_pure_coordinate (common_ [Y_AXIS], Y_AXIS, stub_, 0, INT_MAX); 330 * extremes_[d].slur_head_->maybe_pure_coordinate (common_ [Y_AXIS], Y_AXIS, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RI GHT]);
329 } 331 }
330 332
331 edge_has_beams_ 333 edge_has_beams_
332 = (extremes_[LEFT].stem_ && Stem::get_beam (extremes_[LEFT].stem_)) 334 = (extremes_[LEFT].stem_ && Stem::get_beam (extremes_[LEFT].stem_))
333 || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_)); 335 || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_));
334 336
335 if (is_broken_) 337 if (is_broken_)
336 musical_dy_ = 0.0; 338 musical_dy_ = 0.0;
337 } 339 }
338 340
339 MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1) 341 MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1)
340 SCM 342 SCM
341 Slur::calc_control_points (SCM smob) 343 Slur::calc_control_points (SCM smob)
342 { 344 {
343 Spanner *me = unsmob_spanner (smob); 345 Spanner *me = unsmob_spanner (smob);
346
347 if (!to_boolean (me->get_property ("cross-staff"))
348 && me->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interface" )))
349 {
350 me->suicide ();
351 return SCM_EOL;
352 }
344 353
345 Slur_score_state state; 354 Slur_score_state state;
346 state.fill (me); 355 state.fill (me);
347 356
348 if (!state.valid_) 357 if (!state.valid_)
349 return SCM_EOL; 358 return SCM_EOL;
350 359
351 state.generate_curves (); 360 state.generate_curves ();
352 361
353 SCM end_ys = me->get_property ("positions"); 362 SCM end_ys = me->get_property ("positions");
(...skipping 21 matching lines...) Expand all
375 me->set_property ("annotation", ly_string2scm (total)); 384 me->set_property ("annotation", ly_string2scm (total));
376 } 385 }
377 #endif 386 #endif
378 387
379 SCM controls = SCM_EOL; 388 SCM controls = SCM_EOL;
380 for (int i = 4; i--;) 389 for (int i = 4; i--;)
381 { 390 {
382 Offset o = best->curve_.control_[i] 391 Offset o = best->curve_.control_[i]
383 - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXI S), 392 - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXI S),
384 me->maybe_pure_coordinate (state.common_[Y_AXIS], Y_A XIS, 393 me->maybe_pure_coordinate (state.common_[Y_AXIS], Y_A XIS,
385 state.stub_, 0, INT_MAX)); 394 state.stub_, state.spanned_rank_interval_[LEFT], state.spanned_rank_interval_[RIGHT]));
386 395
387 controls = scm_cons (ly_offset2scm (o), controls); 396 controls = scm_cons (ly_offset2scm (o), controls);
388 } 397 }
389 398
390 return controls; 399 return controls;
391 } 400 }
392 401
393 Slur_configuration * 402 Slur_configuration *
394 Slur_score_state::get_forced_configuration (Interval ys) const 403 Slur_score_state::get_forced_configuration (Interval ys) const
395 { 404 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 { 476 {
468 Drul_array<Real> end_ys; 477 Drul_array<Real> end_ys;
469 for (LEFT_and_RIGHT (d)) 478 for (LEFT_and_RIGHT (d))
470 { 479 {
471 if (extremes_[d].note_column_) 480 if (extremes_[d].note_column_)
472 { 481 {
473 end_ys[d] = dir_ 482 end_ys[d] = dir_
474 * max (max (dir_ * (base_attachments_[d][Y_AXIS] 483 * max (max (dir_ * (base_attachments_[d][Y_AXIS]
475 + parameters_.region_size_ * dir_), 484 + parameters_.region_size_ * dir_),
476 dir_ * (dir_ + extremes_[d].note_column_->mayb e_pure_extent 485 dir_ * (dir_ + extremes_[d].note_column_->mayb e_pure_extent
477 (common_[Y_AXIS], Y_AXIS, stu b_, 0, INT_MAX)[dir_])), 486 (common_[Y_AXIS], Y_AXIS, stu b_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_])),
478 dir_ * base_attachments_[-d][Y_AXIS]); 487 dir_ * base_attachments_[-d][Y_AXIS]);
479 } 488 }
480 else 489 else
481 end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * di r_; 490 end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * di r_;
482 } 491 }
483 492
484 return end_ys; 493 return end_ys;
485 } 494 }
486 495
487 bool 496 bool
(...skipping 29 matching lines...) Expand all
517 */ 526 */
518 if (stem 527 if (stem
519 && !Stem::is_invisible (stem) 528 && !Stem::is_invisible (stem)
520 && extremes_[d].stem_dir_ == dir_ 529 && extremes_[d].stem_dir_ == dir_
521 && Stem::get_beaming (stem, -d) 530 && Stem::get_beaming (stem, -d)
522 && Stem::get_beam (stem) 531 && Stem::get_beam (stem)
523 && (!spanner_less (slur_, Stem::get_beam (stem)) 532 && (!spanner_less (slur_, Stem::get_beam (stem))
524 || has_same_beam_)) 533 || has_same_beam_))
525 y = extremes_[d].stem_extent_[Y_AXIS][dir_]; 534 y = extremes_[d].stem_extent_[Y_AXIS][dir_];
526 else if (head) 535 else if (head)
527 y = head->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_ MAX)[dir_]; 536 y = head->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, spanned _rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_];
528 y += dir_ * 0.5 * staff_space_; 537 y += dir_ * 0.5 * staff_space_;
529 538
530 y = move_away_from_staffline (y, head); 539 y = move_away_from_staffline (y, head);
531 540
532 Grob *fh = Note_column::first_head (extremes_[d].note_column_); 541 Grob *fh = Note_column::first_head (extremes_[d].note_column_);
533 x 542 x
534 = (fh ? fh->extent (common_[X_AXIS], X_AXIS) 543 = (fh ? fh->extent (common_[X_AXIS], X_AXIS)
535 : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)) 544 : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS))
536 .linear_combination (CENTER); 545 .linear_combination (CENTER);
537 } 546 }
(...skipping 11 matching lines...) Expand all
549 if (ext.is_empty ()) 558 if (ext.is_empty ())
550 ext = Axis_group_interface:: 559 ext = Axis_group_interface::
551 generic_bound_extent (extremes_[d].bound_, 560 generic_bound_extent (extremes_[d].bound_,
552 common_[X_AXIS], X_AXIS); 561 common_[X_AXIS], X_AXIS);
553 x = ext[-d]; 562 x = ext[-d];
554 563
555 Grob *col = (d == LEFT) ? columns_[0] : columns_.back (); 564 Grob *col = (d == LEFT) ? columns_[0] : columns_.back ();
556 565
557 if (extremes_[-d].bound_ != col) 566 if (extremes_[-d].bound_ != col)
558 { 567 {
559 y = maybe_pure_robust_relative_extent (col, common_[Y_AXIS], Y_AXI S, stub_, 0, INT_MAX)[dir_]; 568 y = maybe_pure_robust_relative_extent (col, common_[Y_AXIS], Y_AXI S, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_];
560 y += dir_ * 0.5 * staff_space_; 569 y += dir_ * 0.5 * staff_space_;
561 570
562 if (get_grob_direction (col) == dir_ 571 if (get_grob_direction (col) == dir_
563 && Note_column::get_stem (col) 572 && Note_column::get_stem (col)
564 && !Stem::is_invisible (Note_column::get_stem (col))) 573 && !Stem::is_invisible (Note_column::get_stem (col)))
565 y -= dir_ * 1.5 * staff_space_; 574 y -= dir_ * 1.5 * staff_space_;
566 } 575 }
567 else 576 else
568 y = base_attachment[-d][Y_AXIS]; 577 y = base_attachment[-d][Y_AXIS];
569 578
(...skipping 26 matching lines...) Expand all
596 { 605 {
597 if (!on_staff) 606 if (!on_staff)
598 return y; 607 return y;
599 608
600 Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff); 609 Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff);
601 if (!staff_symbol) 610 if (!staff_symbol)
602 return y; 611 return y;
603 612
604 Real pos 613 Real pos
605 = (y - staff_symbol->maybe_pure_coordinate (common_[Y_AXIS], 614 = (y - staff_symbol->maybe_pure_coordinate (common_[Y_AXIS],
606 Y_AXIS, stub_, 0, INT_MAX)) 615 Y_AXIS, stub_, spanned_rank_interv al_[LEFT], spanned_rank_interval_[RIGHT]))
607 * 2.0 / staff_space_; 616 * 2.0 / staff_space_;
608 617
609 if (fabs (pos - my_round (pos)) < 0.2 618 if (fabs (pos - my_round (pos)) < 0.2
610 && Staff_symbol_referencer::on_staff_line (on_staff, (int) rint (pos))) 619 && Staff_symbol_referencer::on_staff_line (on_staff, (int) rint (pos)))
611 y += 1.5 * staff_space_ * dir_ / 10; 620 y += 1.5 * staff_space_ * dir_ / 10;
612 621
613 return y; 622 return y;
614 } 623 }
615 624
616 vector<Offset> 625 vector<Offset>
(...skipping 17 matching lines...) Expand all
634 extract_grob_set (slur_, "encompass-objects", extra_encompasses); 643 extract_grob_set (slur_, "encompass-objects", extra_encompasses);
635 for (vsize i = 0; i < extra_encompasses.size (); i++) 644 for (vsize i = 0; i < extra_encompasses.size (); i++)
636 { 645 {
637 if (Slur::has_interface (extra_encompasses[i])) 646 if (Slur::has_interface (extra_encompasses[i]))
638 { 647 {
639 Grob *small_slur = extra_encompasses[i]; 648 Grob *small_slur = extra_encompasses[i];
640 Bezier b = Slur::get_curve (small_slur); 649 Bezier b = Slur::get_curve (small_slur);
641 650
642 Offset z = b.curve_point (0.5); 651 Offset z = b.curve_point (0.5);
643 z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS) , 652 z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS) ,
644 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXI S, stub_, 0, INT_MAX)); 653 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXI S, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]));
645 654
646 z[Y_AXIS] += dir_ * parameters_.free_slur_distance_; 655 z[Y_AXIS] += dir_ * parameters_.free_slur_distance_;
647 avoid.push_back (z); 656 avoid.push_back (z);
648 } 657 }
649 else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2sc m ("inside")) 658 else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2sc m ("inside"))
650 { 659 {
651 Grob *g = extra_encompasses [i]; 660 Grob *g = extra_encompasses [i];
652 Interval xe = g->extent (common_[X_AXIS], X_AXIS); 661 Interval xe = g->extent (common_[X_AXIS], X_AXIS);
653 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX); 662 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, sp anned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]);
654 663
655 if (!xe.is_empty () 664 if (!xe.is_empty ()
656 && !ye.is_empty ()) 665 && !ye.is_empty ())
657 avoid.push_back (Offset (xe.center (), ye[dir_])); 666 avoid.push_back (Offset (xe.center (), ye[dir_]));
658 } 667 }
659 } 668 }
660 return avoid; 669 return avoid;
661 } 670 }
662 671
663 void 672 void
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 extract_grob_set (slur_, "encompass-objects", encompasses); 770 extract_grob_set (slur_, "encompass-objects", encompasses);
762 vector<Extra_collision_info> collision_infos; 771 vector<Extra_collision_info> collision_infos;
763 for (vsize i = encompasses.size (); i--;) 772 for (vsize i = encompasses.size (); i--;)
764 { 773 {
765 if (Slur::has_interface (encompasses[i])) 774 if (Slur::has_interface (encompasses[i]))
766 { 775 {
767 Spanner *small_slur = dynamic_cast<Spanner *> (encompasses[i]); 776 Spanner *small_slur = dynamic_cast<Spanner *> (encompasses[i]);
768 Bezier b = Slur::get_curve (small_slur); 777 Bezier b = Slur::get_curve (small_slur);
769 778
770 Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_A XIS), 779 Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_A XIS),
771 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y _AXIS, stub_, 0, INT_MAX)); 780 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y _AXIS, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]));
772 781
773 for (int k = 0; k < 3; k++) 782 for (int k = 0; k < 3; k++)
774 { 783 {
775 Direction hdir = Direction (k - 1); 784 Direction hdir = Direction (k - 1);
776 785
777 /* 786 /*
778 Only take bound into account if small slur starts 787 Only take bound into account if small slur starts
779 together with big slur. 788 together with big slur.
780 */ 789 */
781 if (hdir && small_slur->get_bound (hdir) != slur_->get_bound (hdir )) 790 if (hdir && small_slur->get_bound (hdir) != slur_->get_bound (hdir ))
(...skipping 13 matching lines...) Expand all
795 xext, 804 xext,
796 yext, 805 yext,
797 parameters_.extra_object_collision_pena lty_); 806 parameters_.extra_object_collision_pena lty_);
798 collision_infos.push_back (info); 807 collision_infos.push_back (info);
799 } 808 }
800 } 809 }
801 else 810 else
802 { 811 {
803 Grob *g = encompasses [i]; 812 Grob *g = encompasses [i];
804 Interval xe = g->extent (common_[X_AXIS], X_AXIS); 813 Interval xe = g->extent (common_[X_AXIS], X_AXIS);
805 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX); 814 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, sp anned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]);
806 if (Dots::has_interface (g)) 815 if (Dots::has_interface (g))
807 ye.widen (0.2); 816 ye.widen (0.2);
808 817
809 Real xp = 0.0; 818 Real xp = 0.0;
810 Real penalty = parameters_.extra_object_collision_penalty_; 819 Real penalty = parameters_.extra_object_collision_penalty_;
811 if (Accidental_interface::has_interface (g)) 820 if (Accidental_interface::has_interface (g))
812 { 821 {
813 penalty = parameters_.accidental_collision_; 822 penalty = parameters_.accidental_collision_;
814 823
815 Rational alt = ly_scm2rational (g->get_property ("alteration")); 824 Rational alt = ly_scm2rational (g->get_property ("alteration"));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 type_ = g->get_property ("avoid-slur"); 858 type_ = g->get_property ("avoid-slur");
850 } 859 }
851 860
852 Extra_collision_info::Extra_collision_info () 861 Extra_collision_info::Extra_collision_info ()
853 { 862 {
854 idx_ = 0.0; 863 idx_ = 0.0;
855 penalty_ = 0.; 864 penalty_ = 0.;
856 grob_ = 0; 865 grob_ = 0;
857 type_ = SCM_EOL; 866 type_ = SCM_EOL;
858 } 867 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b