Add my copyright to files I've modified.
[synfig.git] / ETL / trunk / ETL / _bezier.h
index 7e26796..67adc32 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
@@ -551,7 +552,8 @@ public:
                                bezier<V,T>::operator[](1),
                                bezier<V,T>::operator[](2),
                                bezier<V,T>::operator[](3)};
-                       return NearestPointOnCurve(x, array);
+                       float t = NearestPointOnCurve(x, array);
+                       return t > 0.999999 ? 0.999999 : t < 0.000001 ? 0.000001 : t;
            }
            else
            {
@@ -606,7 +608,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 +927,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