]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bezier.cc
* lily/ledger-line-spanner.cc (print): swap linear_combination
[lilypond.git] / lily / bezier.cc
index 416f9940d022c92d29f8549ae02f51d0e1df94c7..8c806a0f6304cb1b145c79880e6ac19952d41868 100644 (file)
@@ -3,12 +3,12 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include <math.h>
 
-#include "config.h"
+#include "config.hh"
 #include "warn.hh"
 #include "libc-extension.hh"
 #include "bezier.hh"
@@ -59,6 +59,9 @@ translate (Array<Offset>* array, Offset o)
   Formula of the bezier 3-spline
 
   sum_{j=0}^3 (3 over j) z_j (1-t)^ (3-j)  t^j
+
+
+  A is the axis of X coordinate.
  */
 
 Real
@@ -74,7 +77,9 @@ Bezier::get_other_coordinate (Axis a,  Real x) const
     }
   
   Offset c = curve_point (ts[0]);
-  assert (fabs (c[a] - x) < 1e-8);
+
+  if (fabs (c[a] - x) > 1e-8)
+    programming_error ("Bezier intersection not correct?");
   
   return c[other];
 }
@@ -112,9 +117,10 @@ Bezier::polynomial (Axis a)const
   Polynomial p (0.0);
   for (int j=0; j <= 3; j++)
     {
-      p += (control_[j][a] *   binomial_coefficient (3, j))
-       * Polynomial::power (j , Polynomial (0,1))*
-       Polynomial::power (3 - j, Polynomial (1,-1));
+      p +=
+       (control_[j][a] * binomial_coefficient (3, j))
+       * Polynomial::power (j, Polynomial (0, 1))
+       * Polynomial::power (3 - j, Polynomial (1, -1));
     }
 
   return p;
@@ -186,7 +192,6 @@ Bezier::extent (Axis a)const
 /**
    Flip around axis A
  */
-
 void
 Bezier::scale (Real x, Real y)
 {