summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e48cd37)
* lily/tie-formatting-problem.cc (score_configuration): score
tie/dot collisions.
* lily/tie-helper.cc (get_transformed_bezier): new function
2005-12-13 Han-Wen Nienhuys <hanwen@xs4all.nl>
2005-12-13 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * input/regression/tie-dot.ly: new file.
+
+ * lily/tie-formatting-problem.cc (score_configuration): score
+ tie/dot collisions.
+
+ * lily/tie-helper.cc (get_transformed_bezier): new function
+
* Documentation/topdocs/NEWS.tely (Top): strip out-www.
* stepmake/stepmake/python-module-vars.make (SHARED_FLAGS): use
* Documentation/topdocs/NEWS.tely (Top): strip out-www.
* stepmake/stepmake/python-module-vars.make (SHARED_FLAGS): use
--- /dev/null
+
+\header {
+ texidoc = "Ties avoid collisions with dots."
+}
+
+\version "2.7.23"
+
+\paper { raggedright = ##T }
+
+\relative c'' {
+ \time 12/8
+ d4*3/2~ d8[ e] r8
+ d4.~ d8 e f
+}
+
+
Real
Bezier::get_other_coordinate (Axis a, Real x) const
{
Real
Bezier::get_other_coordinate (Axis a, Real x) const
{
- Axis other = Axis ((a +1)%NO_AXES);
+ Axis other = Axis ((a +1) % NO_AXES);
Array<Real> ts = solve_point (a, x);
if (ts.size () == 0)
Array<Real> ts = solve_point (a, x);
if (ts.size () == 0)
+Interval
+Bezier::control_point_extent (Axis a) const
+{
+ Interval ext;
+ for (int i = CONTROL_COUNT; i--;)
+ ext.add_point (control_[i][a]);
+
+ return ext;
+}
+
+
/**
Flip around axis A
*/
/**
Flip around axis A
*/
Real get_other_coordinate (Axis a, Real x) const;
Array<Real> solve_point (Axis, Real coordinate) const;
Array<Real> solve_derivative (Offset) const;
Real get_other_coordinate (Axis a, Real x) const;
Array<Real> solve_point (Axis, Real coordinate) const;
Array<Real> solve_derivative (Offset) const;
- Interval extent (Axis)const;
+ Interval extent (Axis) const;
+ Interval control_point_extent (Axis) const;
+
Polynomial polynomial (Axis)const;
Offset curve_point (Real t) const;
Real curve_coordinate (Real t, Axis) const;
Polynomial polynomial (Axis)const;
Offset curve_point (Real t) const;
Real curve_coordinate (Real t, Axis) const;
{
Drul_array< Array<Skyline_entry> > chord_outlines_;
set<int> dot_positions_;
{
Drul_array< Array<Skyline_entry> > chord_outlines_;
set<int> dot_positions_;
Tie_configuration_map possibilities_;
Tie_configuration *get_configuration (int position, Direction dir);
Tie_configuration_map possibilities_;
Tie_configuration *get_configuration (int position, Direction dir);
Interval attachment_x_;
Grob *tie_;
int head_position_;
Tie_configuration ();
void center_tie_vertically (Tie_details const &);
Interval attachment_x_;
Grob *tie_;
int head_position_;
Tie_configuration ();
void center_tie_vertically (Tie_details const &);
- Bezier get_bezier (Tie_details const &) const;
+ Bezier get_transformed_bezier (Tie_details const &) const;
+ Bezier get_untransformed_bezier (Tie_details const &) const;
Real height (Tie_details const&) const;
static int compare (Tie_configuration const &a,
Real height (Tie_details const&) const;
static int compare (Tie_configuration const &a,
#include "item.hh"
#include "spanner.hh"
#include "item.hh"
#include "spanner.hh"
#include "stem.hh"
#include "note-head.hh"
#include "rhythmic-head.hh"
#include "stem.hh"
#include "note-head.hh"
#include "rhythmic-head.hh"
y.translate (p);
dot_positions_.insert (p);
y.translate (p);
dot_positions_.insert (p);
y *= staff_space * 0.5;
// boxes.push (Box (x, y));
y *= staff_space * 0.5;
// boxes.push (Box (x, y));
{
conf->delta_y_ += 0.25 * details_.staff_space_;
}
{
conf->delta_y_ += 0.25 * details_.staff_space_;
}
conf->attachment_x_ = get_attachment (y + conf->delta_y_);
Real h = conf->height (details_);
conf->attachment_x_ = get_attachment (y + conf->delta_y_);
Real h = conf->height (details_);
Real min_length = 0.333;
Real staff_line_clearance = 0.1;
Real staff_line_collision_penalty = 5;
Real min_length = 0.333;
Real staff_line_clearance = 0.1;
Real staff_line_collision_penalty = 5;
+ Real dot_collision_clearance = 0.25;
+ Real dot_collision_penalty = 10;
+
Real penalty = 0.0;
Real length = conf.attachment_x_.length ();
Real penalty = 0.0;
Real length = conf.attachment_x_.length ();
{
penalty += staff_line_collision_penalty;
}
{
penalty += staff_line_collision_penalty;
}
+
+ if (!dot_x_.is_empty ())
+ {
+ /* use left edge? */
+ Real x = dot_x_.center ();
+
+ Bezier b = conf.get_transformed_bezier (details_);
+ if (b.control_point_extent (X_AXIS).contains (x))
+ {
+ Real y = b.get_other_coordinate (X_AXIS, x);
+
+ for (set<int>::const_iterator i (dot_positions_.begin ());
+ i != dot_positions_.end (); i ++)
+ {
+ int dot_pos = (*i);
+ if (fabs (dot_pos * details_.staff_space_ * 0.5 - y) < dot_collision_clearance)
+ {
+ penalty += dot_collision_penalty;
+ }
+ }
+ }
+ }
void
Tie_configuration::center_tie_vertically (Tie_details const &details)
{
void
Tie_configuration::center_tie_vertically (Tie_details const &details)
{
- Bezier b = get_bezier (details);
+ Bezier b = get_untransformed_bezier (details);
Offset middle = b.curve_point (0.5);
Offset edge = b.curve_point (0.0);
Offset middle = b.curve_point (0.5);
Offset edge = b.curve_point (0.0);
Real center = (edge[Y_AXIS] + middle[Y_AXIS])/2.0;
delta_y_ = - dir_ * center;
Real center = (edge[Y_AXIS] + middle[Y_AXIS])/2.0;
delta_y_ = - dir_ * center;
Get bezier with left control at (0,0)
*/
Bezier
Get bezier with left control at (0,0)
*/
Bezier
-Tie_configuration::get_bezier (Tie_details const &details) const
+Tie_configuration::get_transformed_bezier (Tie_details const &details) const
+{
+ Bezier b (get_untransformed_bezier (details));
+
+ b.scale (1, dir_);
+ b.translate (Offset (attachment_x_[LEFT],
+ delta_y_ + details.staff_space_ * 0.5 * position_));
+
+ return b;
+}
+
+/*
+ Get bezier with left control at (0,0)
+ */
+Bezier
+Tie_configuration::get_untransformed_bezier (Tie_details const &details) const
{
Real l = attachment_x_.length();
if (isnan (l) || isnan (l))
{
Real l = attachment_x_.length();
if (isnan (l) || isnan (l))
Tie_details const &details
)
{
Tie_details const &details
)
{
- Bezier b = conf.get_bezier (details);
- b.scale (1, conf.dir_);
- b.translate (Offset (conf.attachment_x_[LEFT]
- - me->relative_coordinate (common, X_AXIS),
- 0.5 * conf.position_ * details.staff_space_
- + conf.delta_y_
- ));
-
+ Bezier b = conf.get_transformed_bezier (details);
+ b.translate (Offset (- me->relative_coordinate (common, X_AXIS), 0));
+
SCM controls = SCM_EOL;
for (int i = 4; i--;)
{
SCM controls = SCM_EOL;
for (int i = 4; i--;)
{