From: Han-Wen Nienhuys Date: Sun, 10 Jul 2005 12:10:22 +0000 (+0000) Subject: hardcode binomial coefficients of order 3. X-Git-Tag: release/2.7.1~48 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a177d0a351abf3f473e6f29ec7840628c9344518;p=lilypond.git hardcode binomial coefficients of order 3. --- diff --git a/ChangeLog b/ChangeLog index 227490fee4..77254bd557 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-07-10 Han-Wen Nienhuys + * lily/bezier.cc: hardcode binomial coefficients of order 3. + + * lily/include/music-wrapper.hh: remove Music_wrapper as Music subtype. + * scm/define-music-types.scm (music-descriptions): don't use Music_wrapper type. diff --git a/lily/bezier.cc b/lily/bezier.cc index f9b7e84142..02065b8db6 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -12,6 +12,8 @@ #include "warn.hh" #include "libc-extension.hh" +Real binomial_coefficient_3[] = {1,3 ,3, 1}; + Real binomial_coefficient (Real over, int under) { @@ -90,7 +92,7 @@ Bezier::curve_point (Real t) const Offset o; for (int j = 0; j < 4; j++) { - o += control_[j] * binomial_coefficient (3, j) + o += control_[j] * binomial_coefficient_3[j] * pow (t, j) * pow (1 - t, 3 - j); tj *= t; @@ -113,7 +115,7 @@ Bezier::polynomial (Axis a) const for (int j = 0; j <= 3; j++) { p - += (control_[j][a] * binomial_coefficient (3, j)) + += (control_[j][a] * binomial_coefficient_3[j]) * Polynomial::power (j, Polynomial (0, 1)) * Polynomial::power (3 - j, Polynomial (1, -1)); }