+2002-05-18 Han-Wen <hanwen@cs.uu.nl>
+
+ * lily/stem.cc (calc_stem_info): bugfix for less ugly knees.
+
2002-05-17 Han-Wen <hanwen@cs.uu.nl>
* scripts/lilypond-book.py (re_dict): fix regexps; don't combine ?
MAJOR_VERSION=1
MINOR_VERSION=5
PATCH_LEVEL=56
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
*/
- const int REGION_SIZE = 3;
+ const int REGION_SIZE = 2;
for (int i = -REGION_SIZE ; i < REGION_SIZE; i++)
for (int j = 0; j < num_quants; j++)
{
Array<Real> rbase_lengths;
Array<int> directions;
+
+ Drul_array<bool> dirs_found(0,0);
+
for (int i= 0; i < stems.size(); i++)
{
Grob*s = stems[i];
b = calc_stem_y (me, s, Interval (0,1));
rbase_lengths.push (b);
- directions.push( Directional_element_interface::get( s));
+
+ Direction d = Directional_element_interface::get( s);
+ directions.push( d);
+ dirs_found [d] = true;
}
+ bool knee_b = dirs_found[LEFT] && dirs_found[RIGHT];
for (int i = qscores.size (); i--;)
if (qscores[i].demerits < 100)
{
qscores[i].demerits
+= score_stem_lengths (stems, stem_infos,
lbase_lengths, rbase_lengths,
- directions,
+ directions, knee_b,
me, qscores[i].yl, qscores[i].yr);
}
Array<Real> left_factor,
Array<Real> right_factor,
Array<int> directions,
+ bool knee,
Grob*me, Real yl, Real yr)
{
Real demerit_score = 0.0 ;
Stem_info info = stem_infos[i];
Direction d = Direction (directions[i]);
+
+ Real pen = STEM_LENGTH_LIMIT_PENALTY;
+ if (knee)
+ pen = sqrt(pen);
- demerit_score += STEM_LENGTH_LIMIT_PENALTY * ( 0 >? (info.min_y - d * current_y));
- demerit_score += STEM_LENGTH_LIMIT_PENALTY * ( 0 >? (d * current_y - info.max_y));
+ demerit_score += pen * ( 0 >? (info.min_y - d * current_y));
+ demerit_score += pen * ( 0 >? (d * current_y - info.max_y));
demerit_score += STEM_LENGTH_DEMERIT_FACTOR * shrink_extra_weight (d * current_y - info.ideal_y);
}
static Real score_stem_lengths (Link_array<Grob>,
Array<Stem_info>,
Array<Real>, Array<Real>, Array<int>,
- Grob*,Real , Real);
+ bool,Grob*,Real , Real);
static Real score_forbidden_quants (Grob*, Real, Real,
Real, Real, Real, Real,
int);
TODO: This is way too hairy
*/
-#include <math.h> // m_pi
+#include <math.h> // rint
#include "lookup.hh"
#include "directional-element-interface.hh"
info.ideal_y = chord_start_f (me);
// for simplicity, we calculate as if dir == UP
+
+ /*
+ UGH. This confuses issues more. fixme. --hwn
+ */
info.ideal_y *= beam_dir;
SCM grace_prop = me->get_grob_property ("grace");
Real stem_length = a[multiplicity <? (a.size () - 1)] * staff_space;
+
+ /*
+ This sucks -- On a kneed beam, *all* stems are kneed, not half of them.
+ */
if (!beam_dir || (beam_dir == Directional_element_interface::get (me)))
/* normal beamed stem */
{
else
/* knee */
{
- info.ideal_y -= thick;
- info.max_y = info.ideal_y;
- info.min_y = - 1000 ; // INT_MAX;
+ info.ideal_y -= thick + stem_length;
+ info.max_y = info.ideal_y - minimum_length;
- info.ideal_y -= stem_length;
- info.max_y -= minimum_length;
+ /*
+ We shouldn't invert the stems, so we set minimum at 0.
+ */
+ info.min_y = 0.5;
}
info.ideal_y = (info.max_y <? info.ideal_y) >? info.min_y;