source file of the GNU LilyPond music typesetter
- (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ (c) 1997--1998 Jan Nieuwenhuizen <jan@digicash.com>
*/
Stem_info::Stem_info (Stem const *s)
{
- x = s->hpos_f ();
+ x_ = s->hpos_f ();
dir_ = s->dir_;
- beams_i_ = 0 >? (abs (s->flag_i_) - 2);
+ mult_i_ = s->mult_i_;
/*
[todo]
- * get algorithm
- * runtime
+ * get algorithm runtime
Breitkopf + H\"artel:
miny_f_ = interline + #beams * interbeam
*/
Real internote_f = s->paper ()->internote_f ();
- Real interline_f = 2 * internote_f;
- Real notehead_y = interline_f;
- // huh? why do i seem to need the / 2 ?
+ Real interline_f = 2.0 * internote_f;
Real interbeam_f = s->paper ()->interbeam_f ();
- // Real interbeam_f = s->paper ()->interbeam_f () / 2;
- // perhaps bo dim (y) = internote?
+ Real staffline_f = s->paper ()->rule_thickness ();
+ Real beam_f = 0.48 * (interline_f - staffline_f);
- idealy_f_ = dir_ * s->stem_begin_f () + beams_i_ * interbeam_f;
- if (beams_i_ < 3)
- idealy_f_ += 2 * interline_f;
- else
- idealy_f_ += 1.5 * interline_f;
- idealy_f_ /= internote_f;
- miny_f_ = dir_ * s->stem_begin_f () + 2 + beams_i_ * interbeam_f / internote_f;
-
- idealy_f_ = miny_f_ >? idealy_f_;
- // assert (miny_f_ <= idealy_f_);
+ if (check_debug && !monitor->silent_b ("Stem_info"))
+ {
+ static int i = 1;
+ cout << "******" << i++ << "******" << endl;
+ cout << "begin_f: " << s->stem_begin_f () * dir_ << endl;
+ // urg urg urg
+ cout << "chord_f/i: " << s->chord_start_f () * dir_ / internote_f << endl;
+ }
+
+ /*
+ For simplicity, we'll assume dir = UP and correct if
+ dir = DOWN afterwards.
+ */
+ idealy_f_ = s->chord_start_f () * dir_ / internote_f;
+ idealy_f_ *= internote_f;
+
+ idealy_f_ += interbeam_f * mult_i_;
+
+ miny_f_ = idealy_f_;
+
+ // B"arenreiter
+ if (mult_i_ < 3)
+ idealy_f_ += 2.0 * interline_f;
+ else
+ idealy_f_ += 1.5 * interline_f;
+
+ miny_f_ += 1.0 * interline_f;
+
+ // lowest beam of (UP) beam must never be lower than second staffline
+ miny_f_ = miny_f_ >? (- 2 * internote_f - beam_f
+ + (mult_i_ > 0) * beam_f + interbeam_f * (mult_i_ - 1));
+
+ idealy_f_ /= internote_f;
+ miny_f_ /= internote_f;
+
+ if (check_debug && !monitor->silent_b ("Stem_info"))
+ {
+ cout << "dir_: " << dir_ << endl;
+ cout << "mult_i_: " << mult_i_ << endl;
+ cout << "idealy_f_: " << idealy_f_ << endl;
+ cout << "miny_f_: " << miny_f_ << endl;
+ }
+
+ idealy_f_ = miny_f_ >? idealy_f_;
}