]> git.donarmstrong.com Git - lilypond.git/blob - lily/pitch-interval.cc
73c619e1bfd31125c7efddffecf27d79c6728b89
[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--2005 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   elem_ref (LEFT) = p1;
16   elem_ref (RIGHT) = p2;
17 }
18
19 Pitch_interval::Pitch_interval ()
20 {
21   elem_ref (LEFT) = Pitch (100, 0, 0);
22   elem_ref (RIGHT) = Pitch (-100, 0, 0);
23 }
24
25 bool
26 Pitch_interval::is_empty () const
27 {
28   return elem (LEFT) > elem (RIGHT);
29 }
30
31 void
32 Pitch_interval::add_point (Pitch p)
33 {
34   if (elem_ref (LEFT) > p)
35     elem_ref (LEFT) = p;
36   if (elem_ref (RIGHT) < p)
37     elem_ref (RIGHT) = p;
38 }