]> git.donarmstrong.com Git - lilypond.git/blob - lily/pitch-interval.cc
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / pitch-interval.cc
1 /*
2   pitch-interval.cc -- implement Pitch_interval
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "pitch-interval.hh"
10
11 #include "interval.tcc"
12
13 Pitch_interval::Pitch_interval (Pitch p1, Pitch p2)
14 {
15   at (LEFT) = p1;
16   at (RIGHT) = p2;
17 }
18
19 Pitch_interval::Pitch_interval ()
20 {
21   at (LEFT) = Pitch (100, 0, 0);
22   at (RIGHT) = Pitch (-100, 0, 0);
23 }
24
25 bool
26 Pitch_interval::is_empty () const
27 {
28   return at (LEFT) > at (RIGHT);
29 }
30
31 void
32 Pitch_interval::add_point (Pitch p)
33 {
34   if (at (LEFT) > p)
35     at (LEFT) = p;
36   if (at (RIGHT) < p)
37     at (RIGHT) = p;
38 }