Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / pitch-interval.cc
blobe92a721ae004ab214a656e4da78ea1adaca5e451
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2004--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "pitch-interval.hh"
22 #include "interval.tcc"
24 Pitch_interval::Pitch_interval (Pitch p1, Pitch p2)
26 at (LEFT) = p1;
27 at (RIGHT) = p2;
30 Pitch_interval::Pitch_interval ()
32 at (LEFT) = Pitch (100, 0, 0);
33 at (RIGHT) = Pitch (-100, 0, 0);
36 bool
37 Pitch_interval::is_empty () const
39 return at (LEFT) > at (RIGHT);
42 Drul_array<bool>
43 Pitch_interval::add_point (Pitch p)
45 Drul_array<bool> expansions(false,false);
46 if (at (LEFT).tone_pitch () > p.tone_pitch ())
48 at (LEFT) = p;
49 expansions [LEFT] = true;
51 if (at (RIGHT).tone_pitch () < p.tone_pitch ())
53 at (RIGHT) = p;
54 expansions [RIGHT] = true;
56 return expansions;
60 Pitch_lexicographic_interval::Pitch_lexicographic_interval (Pitch p1, Pitch p2)
62 at (LEFT) = p1;
63 at (RIGHT) = p2;
66 Pitch_lexicographic_interval::Pitch_lexicographic_interval ()
68 at (LEFT) = Pitch (100, 0, 0);
69 at (RIGHT) = Pitch (-100, 0, 0);
72 bool
73 Pitch_lexicographic_interval::is_empty () const
75 return at (LEFT) > at (RIGHT);
78 Drul_array<bool>
79 Pitch_lexicographic_interval::add_point (Pitch p)
81 Drul_array<bool> expansions(false,false);
82 if (at (LEFT) > p)
84 at (LEFT) = p;
85 expansions [LEFT] = true;
87 if (at (RIGHT) < p)
89 at (RIGHT) = p;
90 expansions [RIGHT] = true;
92 return expansions;