From df93c347672cf8cbb8e1ee0b6754764038f15be1 Mon Sep 17 00:00:00 2001 From: hanwen Date: Sun, 10 Jul 2005 12:10:22 +0000 Subject: [PATCH] hardcode binomial coefficients of order 3. --- ChangeLog | 4 ++++ lily/bezier.cc | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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)); } -- 2.39.5