Make the names for the guards for ETL private headers consistent WRT the number of...
[synfig.git] / ETL / trunk / ETL / _bezier.h
index 7e26796..fe6b170 100644 (file)
@@ -4,6 +4,7 @@
 ** $Id$
 **
 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** Copyright (c) 2007 Chris Moore
 **
 ** This package is free software; you can redistribute it and/or
 ** modify it under the terms of the GNU General Public License as
 
 /* === S T A R T =========================================================== */
 
-#ifndef __ETL_BEZIER_H
-#define __ETL_BEZIER_H
+#ifndef __ETL__BEZIER_H
+#define __ETL__BEZIER_H
 
 /* === H E A D E R S ======================================================= */
 
 #include "_curve_func.h"
-#include <ETL/fixed>
+#include <cmath>                               // for ldexp
+// #include <ETL/fixed>                        // not used
 
 /* === M A C R O S ========================================================= */
 
@@ -575,6 +577,7 @@ public:
        distance_type find_distance(time_type r, time_type s, int steps=7)const
        {
                const time_type inc((s-r)/steps);
+               if (!inc) return 0;
                distance_type ret(0);
                value_type last(operator()(r));
 
@@ -606,7 +609,7 @@ public:
        */
        void subdivide(bezier *left, bezier *right, const time_type &time = (time_type)0.5) const
        {
-               time_type t=(t-get_r())/get_dt();
+               time_type t=(time-get_r())/get_dt();
                bezier lt,rt;
 
                value_type temp;
@@ -925,7 +928,7 @@ private:
        /*
         *  NearestPointOnCurve :
         *      Compute the parameter value of the point on a Bezier
-        *              curve segment closest to some arbtitrary, user-input point.
+        *              curve segment closest to some arbitrary, user-input point.
         *              Return the point on the curve at that parameter value.
         *
         *    value_type&       P;                      The user-supplied point