2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2004--2015 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)
30 Pitch_interval::Pitch_interval ()
32 at (LEFT) = Pitch (100, 0);
33 at (RIGHT) = Pitch (-100, 0);
37 Pitch_interval::is_empty () const
39 return at (LEFT) > at (RIGHT);
43 Pitch_interval::add_point (Pitch p)
45 Drul_array<bool> expansions (false, false);
46 if (at (LEFT).tone_pitch () > p.tone_pitch ())
49 expansions [LEFT] = true;
51 if (at (RIGHT).tone_pitch () < p.tone_pitch ())
54 expansions [RIGHT] = true;
59 Pitch_lexicographic_interval::Pitch_lexicographic_interval (Pitch p1, Pitch p2)
65 Pitch_lexicographic_interval::Pitch_lexicographic_interval ()
67 at (LEFT) = Pitch (100, 0);
68 at (RIGHT) = Pitch (-100, 0);
72 Pitch_lexicographic_interval::is_empty () const
74 return at (LEFT) > at (RIGHT);
78 Pitch_lexicographic_interval::add_point (Pitch p)
80 Drul_array<bool> expansions (false, false);
84 expansions [LEFT] = true;
89 expansions [RIGHT] = true;