2 drul-array.hh -- declare Drul_array
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "direction.hh"
17 Left/right or Up/down arrays. Drul is nicer sounding than udlr
23 T &elem_ref (Direction d)
25 assert (d==1 || d== -1);
26 return array_[ (d+1)/2];
28 T elem (Direction d) const
30 assert (d==1 || d== -1);
31 return array_[ (d+1)/2];
33 T &operator[] (Direction d)
37 T operator[] (Direction d) const
44 Drul_array (T t1, T t2)
53 scale_drul (Drul_array<T> * dr, T x)
55 dr->elem_ref (LEFT) *= x;
56 dr->elem_ref (RIGHT) *= x;
60 linear_combination (Drul_array<Real> const &d, Real x)
62 return ((1.0 - x) * Real (d.elem (LEFT))
63 + (x + 1.0) * Real (d.elem (RIGHT))) * 0.5;
66 #endif /* DRUL_ARRAY_HH */