]> git.donarmstrong.com Git - lilypond.git/blob - lily/pitch-interval.cc
069c86b7848871d2da25546d95706c013540dff1
[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
10 #include "pitch-interval.hh"
11
12 #include "interval.tcc"
13
14 Pitch_interval::Pitch_interval (Pitch p1, Pitch p2)
15 {
16   elem_ref(LEFT) =  p1;
17   elem_ref(RIGHT) =  p2;
18 }
19
20
21 Pitch_interval::Pitch_interval ()
22 {
23   elem_ref(LEFT) =  Pitch (100,0,0);
24   elem_ref(RIGHT) =  Pitch (-100,0,0);
25 }
26
27
28 bool
29 Pitch_interval::is_empty () const
30 {
31   return elem(LEFT) > elem(RIGHT);
32 }
33
34
35 void
36 Pitch_interval::add_point (Pitch p)
37 {
38   if (elem_ref(LEFT) >  p)
39     elem_ref(LEFT) = p;
40   if (elem_ref(RIGHT) < p)
41     elem_ref(RIGHT) = p;
42 }