- /* For knees, non-forced stems should probably have their
- natural direction. In any case, when knee, beam direction is
- foe.
-
- TODO: for x staff knees, set direction pointing to 'the
- other' staff, rather than natural.
- */
- if (knee_b(me))
- {
- Stem::get_direction (s); // this actually sets it, if necessary
- }
- else
- {
- SCM force = s->remove_grob_property ("dir-forced");
- if (!gh_boolean_p (force) || !gh_scm2bool (force))
- Directional_element_interface::set (s, d);
- }
- }
-}
-
-/*
- A union of intervals in the real line.
-
- Abysmal performance (quadratic) for large N, hopefully we don't have
- that large N. In any case, this should probably be rewritten to use
- a balanced tree.
- */
-struct Int_set
-{
- Array<Interval> allowed_regions_;
-
- Int_set()
- {
- set_full();
- }
-
- void set_full()
- {
- allowed_regions_.clear();
- Interval s;
- s.set_full ();
- allowed_regions_.push (s);
- }
-
- void remove_interval (Interval rm)
- {
- for (int i = 0; i < allowed_regions_.size(); )
- {
- Interval s = rm;
-
- s.intersect (allowed_regions_[i]);
-
- if (!s.empty_b ())
- {
- Interval before = allowed_regions_[i];
- Interval after = allowed_regions_[i];
-
- before[RIGHT] = s[LEFT];
- after[LEFT] = s[RIGHT];
-
- if (!before.empty_b())
- {
- allowed_regions_.insert (before, i);
- i++;
- }
- allowed_regions_.del (i);
- if (!after.empty_b ())
- {
- allowed_regions_.insert (after, i);
- i++;
- }
- }
- else
- i++;
- }
- }
-};