]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bezier.cc
*** empty log message ***
[lilypond.git] / lily / bezier.cc
index 40fd5f7ac0e6eba179365b9e6cbbd7e187460f75..c51ba3706d1603846c679ed0088d6aac78443e50 100644 (file)
@@ -6,10 +6,10 @@
   (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include "bezier.hh"
 
-#include <cmath>
+#include <math.h>
 
+#include "bezier.hh"
 #include "warn.hh"
 #include "libc-extension.hh"
 
@@ -57,7 +57,7 @@ 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
+  sum_{j = 0}^3 (3 over j) z_j (1-t)^ (3-j)  t^j
 
 
   A is the axis of X coordinate.
@@ -91,7 +91,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 +114,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 +143,8 @@ filter_solutions (Array<Real> sol)
 Array<Real>
 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 +180,7 @@ Bezier::extent (Axis a)const
   Array<Real> 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 +219,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 +228,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;
 }