Or replace them with something not requiring angles altogether.
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);
}
void
-rotate (vector<Offset> *array, Real phi)
+rotate (vector<Offset> *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]);
}
}
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]);
}
};
void scale (vector<Offset> *array, Real xscale, Real yscale);
-void rotate (vector<Offset> *array, Real phi);
+void rotate (vector<Offset> *array, Real deg);
void translate (vector<Offset> *array, Offset o);
Bezier slur_shape (Real width, Real height_limit,
}
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;
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;
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;
}
}
- dz = os[RIGHT] - os[LEFT];
+ dz = (os[RIGHT] - os[LEFT]).direction ();
for (LEFT_and_RIGHT (d))
{
if (extremes_[d].slur_head_
TODO: parameter */
os[d][X_AXIS]
-= dir_ * extremes_[d].slur_head_x_extent_.length ()
- * sin (dz.arg ()) / 3;
+ * dz[Y_AXIS] / 3;
}
}
void
Stencil::rotate (Real a, Offset off)
{
- rotate_degrees (a * 180 / M_PI, off);
+ rotate_degrees (a, 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);