]> git.donarmstrong.com Git - lilypond.git/commitdiff
hardcode binomial coefficients of order 3.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Jul 2005 12:10:22 +0000 (12:10 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Jul 2005 12:10:22 +0000 (12:10 +0000)
ChangeLog
lily/bezier.cc

index 227490fee4eddaa6da396b70e530ebef98e742db..77254bd5577e256cc38b81e99de02f37133ed908 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-07-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * 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.
 
index f9b7e84142c0f99b0b7902c64f8a71e2eecc01b1..02065b8db6c43c8e0e5a1ca0a89162a09ea5d96f 100644 (file)
@@ -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));
     }