2 bow.cc -- implement Bow
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
12 #include "paper-def.hh"
13 #include "molecule.hh"
22 dy_f_drul_
[LEFT
] = dy_f_drul_
[RIGHT
] = 0.0;
23 dx_f_drul_
[LEFT
] = dx_f_drul_
[RIGHT
] = 0.0;
28 Bow::brew_molecule_p () const
30 Real thick
= paper ()->get_var ("slur_thickness");
31 Array
<Offset
> c
= get_controls ();
32 Real dy
= c
[3].y () - c
[0].y ();
36 a
= lookup_l ()->slur (c
);
38 a
= lookup_l ()->dashed_slur (c
, thick
, dash_i_
);
40 if (check_debug
&& !monitor
->silent_b ("Bow"))
43 cout
<< "******" << i
++ << "******" << endl
;
45 // cout << "c0.y: " << c[0].y << endl;
46 cout
<< "c0.y: " << c
[0].y () << endl
;
47 cout
<< "c3.y: " << c
[3].y () << endl
;
48 cout
<< "dy: " << dy
<< endl
;
49 cout
<< "dy_f_l: " << dy_f_drul_
[LEFT
] << endl
;
50 cout
<< "dy_f_r: " << dy_f_drul_
[RIGHT
] << endl
;
51 cout
<< "dy_f: " << dy_f_drul_
[RIGHT
] - dy_f_drul_
[LEFT
] << endl
;
53 a
.translate (Offset (dx_f_drul_
[LEFT
], dy_f_drul_
[LEFT
]));
55 Molecule
* mol_p
= new Molecule
;
64 Real dy
= dy_f_drul_
[RIGHT
] - dy_f_drul_
[LEFT
];
66 Real dx
= width ().length ();
68 return Offset (dx
/ 2, dy
);
75 ugh . Control points are too crude measures.
78 Bow::do_height () const
81 Array
<Offset
> c (get_controls());
82 for (int i
=0; i
< c
.size (); i
++)
84 Real y
= c
[i
][Y_AXIS
];
85 iv
.unite (Interval (y
,y
));
91 Bow::do_width () const
93 Interval i
= Spanner::do_width ();
95 return Interval (0, dx
);
99 Bow::get_controls () const
101 Bezier_bow
b (paper ());
102 b
.set (get_encompass_offset_arr (), dir_
);
104 Array
<Offset
> controls
;
105 controls
.set_size (8);
106 for (int i
= 0; i
< 4; i
++)
107 controls
[i
] = b
.control_
[i
];
108 for (int i
= 0; i
< 4; i
++)
109 controls
[i
+ 4] = b
.return_
[i
];
114 Bow::get_encompass_offset_arr () const
116 Offset
d (dx_f_drul_
[RIGHT
] - dx_f_drul_
[LEFT
],
117 dy_f_drul_
[RIGHT
] - dy_f_drul_
[LEFT
]);
118 d
.x() += width (). length ();
121 notes
.push (Offset (0, 0));