X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbezier.cc;h=a8cda698382d8191d73b0c583ba9ca80699cddb6;hb=f817c9010f8016d5e9c19ec3b167e7d485538eb3;hp=806d3855310c840d9372e7fd961d408b8434d99a;hpb=2ec5f924eb75dfc6b584a8df25a03bdfde31fc6c;p=lilypond.git diff --git a/lily/bezier.cc b/lily/bezier.cc index 806d385531..a8cda69838 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -6,8 +6,7 @@ (c) 1998--2004 Jan Nieuwenhuizen */ - -#include +#include #include "bezier.hh" #include "warn.hh" @@ -57,7 +56,7 @@ translate (Array* array, Offset o) Formula of the bezier 3-spline - sum_{j=0}^3 (3 over j) z_j (1-t)^ (3-j) t^j + sum_{j = 0}^3 (3 over j) z_j (1-t)^ (3-j) t^j A is the axis of X coordinate. @@ -91,7 +90,7 @@ Bezier::curve_point (Real t)const Real one_min_tj = (1-t)* (1-t)* (1-t); Offset o; - for (int j=0 ; j < 4; j++) + for (int j = 0 ; j < 4; j++) { o += control_[j] * binomial_coefficient (3, j) * pow (t,j) * pow (1-t, 3-j); @@ -114,7 +113,7 @@ Polynomial Bezier::polynomial (Axis a)const { Polynomial p (0.0); - for (int j=0; j <= 3; j++) + for (int j = 0; j <= 3; j++) { p += (control_[j][a] * binomial_coefficient (3, j)) @@ -143,8 +142,8 @@ filter_solutions (Array sol) Array Bezier::solve_derivative (Offset deriv)const { - Polynomial xp=polynomial (X_AXIS); - Polynomial yp=polynomial (Y_AXIS); + Polynomial xp = polynomial (X_AXIS); + Polynomial yp = polynomial (Y_AXIS); xp.differentiate (); yp.differentiate (); @@ -180,7 +179,7 @@ Bezier::extent (Axis a)const Array sols (solve_derivative (d)); sols.push (1.0); sols.push (0.0); - for (int i= sols.size (); i--;) + for (int i = sols.size (); i--;) { Offset o (curve_point (sols[i])); iv.unite (Interval (o[a],o[a])); @@ -219,7 +218,7 @@ Bezier::translate (Offset o) void Bezier::assert_sanity () const { - for (int i=0; i < CONTROL_COUNT; i++) + for (int i = 0; i < CONTROL_COUNT; i++) assert (!isnan (control_[i].length ()) && !isinf (control_[i].length ())); } @@ -228,7 +227,7 @@ void Bezier::reverse () { Bezier b2; - for (int i =0; i < CONTROL_COUNT; i++) + for (int i = 0; i < CONTROL_COUNT; i++) b2.control_[CONTROL_COUNT-i-1] = control_[i]; *this = b2; }