From 28d3a736534f3aa3cd403485770a019bd35114c4 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 29 Aug 2016 10:10:52 +0200 Subject: Issue 4961/5: Change rotations to degrees rather than radians Or replace them with something not requiring angles altogether. --- lily/arpeggio.cc | 2 +- lily/bezier.cc | 8 ++++---- lily/include/bezier.hh | 2 +- lily/line-interface.cc | 2 +- lily/lookup.cc | 4 ++-- lily/slur-configuration.cc | 2 +- lily/slur-scoring.cc | 4 ++-- lily/stencil.cc | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 5ba2e59279..95da047a06 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -215,7 +215,7 @@ Arpeggio::brew_chord_slur (SCM smob) Real height_limit = 1.5; Real ratio = .33; Bezier curve = slur_shape (dy, height_limit, ratio); - curve.rotate (M_PI / 2); + curve.rotate (90.0); Stencil mol (Lookup::slur (curve, lt, lt, dash_definition)); mol.translate_axis (heads[LEFT], Y_AXIS); diff --git a/lily/bezier.cc b/lily/bezier.cc index b202d45dd6..eacd4fe6a4 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -38,9 +38,9 @@ scale (vector *array, Real x, Real y) } void -rotate (vector *array, Real phi) +rotate (vector *array, Real deg) { - Offset rot (complex_exp (Offset (0, phi))); + Offset rot (offset_directed (deg)); for (vsize i = 0; i < array->size (); i++) (*array)[i] = complex_multiply (rot, (*array)[i]); } @@ -322,9 +322,9 @@ Bezier::scale (Real x, Real y) } void -Bezier::rotate (Real phi) +Bezier::rotate (Real deg) { - Offset rot (complex_exp (Offset (0, phi))); + Offset rot (offset_directed (deg)); for (int i = 0; i < CONTROL_COUNT; i++) control_[i] = complex_multiply (rot, control_[i]); } diff --git a/lily/include/bezier.hh b/lily/include/bezier.hh index 959afc5c4e..54acce15fc 100644 --- a/lily/include/bezier.hh +++ b/lily/include/bezier.hh @@ -62,7 +62,7 @@ public: }; void scale (vector *array, Real xscale, Real yscale); -void rotate (vector *array, Real phi); +void rotate (vector *array, Real deg); void translate (vector *array, Offset o); Bezier slur_shape (Real width, Real height_limit, diff --git a/lily/line-interface.cc b/lily/line-interface.cc index f23b58e308..bc0895339f 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -70,7 +70,7 @@ Line_interface::make_trill_line (Grob *me, } while (len + elt_len < dz.length ()); - line.rotate (dz.arg (), Offset (LEFT, CENTER)); + line.rotate (dz.angle_degrees (), Offset (LEFT, CENTER)); line.translate (from); return line; diff --git a/lily/lookup.cc b/lily/lookup.cc index 3e592516c5..d7b6b8d26e 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -417,9 +417,9 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick, calculate the offset for the two beziers that make the sandwich for the slur */ - Real alpha = (curve.control_[3] - curve.control_[0]).arg (); + Offset dir = (curve.control_[3] - curve.control_[0]).direction (); Bezier back = curve; - Offset perp = curvethick * complex_exp (Offset (0, alpha + M_PI / 2)) * 0.5; + Offset perp = 0.5 * curvethick * Offset (-dir[Y_AXIS], dir[X_AXIS]); back.control_[1] += perp; back.control_[2] += perp; diff --git a/lily/slur-configuration.cc b/lily/slur-configuration.cc index dc453a9729..9eb4ef83bd 100644 --- a/lily/slur-configuration.cc +++ b/lily/slur-configuration.cc @@ -90,7 +90,7 @@ fit_factor (Offset dz_unit, Offset dz_perp, Real close_to_edge_length, Real fit_factor = 0.0; Offset x0 = curve.control_[0]; curve.translate (-x0); - curve.rotate (-dz_unit.arg ()); + curve.rotate (-dz_unit.angle_degrees ()); curve.scale (1, d); Interval curve_xext; diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 2d4865e190..a3dad6fb5e 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -740,7 +740,7 @@ Slur_score_state::enumerate_attachments (Drul_array end_ys) const } } - dz = os[RIGHT] - os[LEFT]; + dz = (os[RIGHT] - os[LEFT]).direction (); for (LEFT_and_RIGHT (d)) { if (extremes_[d].slur_head_ @@ -752,7 +752,7 @@ Slur_score_state::enumerate_attachments (Drul_array end_ys) const TODO: parameter */ os[d][X_AXIS] -= dir_ * extremes_[d].slur_head_x_extent_.length () - * sin (dz.arg ()) / 3; + * dz[Y_AXIS] / 3; } } diff --git a/lily/stencil.cc b/lily/stencil.cc index 0cf49296f0..5e568c98db 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -80,7 +80,7 @@ Stencil::extent_box () const void Stencil::rotate (Real a, Offset off) { - rotate_degrees (a * 180 / M_PI, off); + rotate_degrees (a, off); } /* @@ -121,7 +121,7 @@ Stencil::rotate_degrees_absolute (Real a, Offset absolute_off) pts.push_back (Offset (shifted_box.x ().at (RIGHT), shifted_box.y ().at (UP))); pts.push_back (Offset (shifted_box.x ().at (LEFT), shifted_box.y ().at (UP))); - const Offset rot = complex_exp (Offset (0, a * M_PI / 180.0)); + const Offset rot (offset_directed (a)); dim_.set_empty (); for (vsize i = 0; i < pts.size (); i++) dim_.add_point (pts[i] * rot + absolute_off); -- cgit v1.2.3