]> Dogcows Code - chaz/yoink/blobdiff - src/moof/interpolator.hh
remove some unused stlplus modules
[chaz/yoink] / src / moof / interpolator.hh
index 0a7aa012b480747e69c7e3577c1c6f3c8546f9f8..83dd0c9bdf095d1f289f8d8ec15896c294afd0b5 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_INTERPOLATOR_HH_
 #define _MOOF_INTERPOLATOR_HH_
@@ -40,10 +38,9 @@ public:
        {
                stop            = 0,    /// Interpolator will stop when done.
                repeat          = 1,    /// Interpolator will go back to the beginning.
-               oscillate       = 2             /// Interpolator will reverse direction.
+               oscillate       = 2     /// Interpolator will reverse direction.
        };
 
-
        /**
         * Construct an uninitialized interpolator.
         */
@@ -57,7 +54,8 @@ public:
         * \param t The duration of the interpolation.
         * \param mode The interpolation mode.
         */
-       interpolator(const T& a, const T& b, scalar t = 1.0, mode mode = stop) :
+       interpolator(const T& a, const T& b,
+                       scalar t = 1.0, mode mode = stop) :
                state_(a),
                prior_(a),
                a_(a),
@@ -86,7 +84,6 @@ public:
                is_done_ = false;
        }
 
-
        /**
         * Update the interpolation state with a timeslice.
         * \param t The total time in seconds.
@@ -104,42 +101,40 @@ public:
                        {
                                switch (mode_)
                                {
-                                       case stop:
-                                               alpha_ = SCALAR(1.0);
-                                               is_done_ = true;
-                                               break;
-                                       case repeat:
-                                               alpha_ -= SCALAR(1.0);
-                                               break;
-                                       case oscillate:
-                                               alpha_ = SCALAR(2.0) - alpha_;
-                                               scale_ = -scale_;
-                                               break;
+                               case stop:
+                                       alpha_ = SCALAR(1.0);
+                                       is_done_ = true;
+                                       break;
+                               case repeat:
+                                       alpha_ -= SCALAR(1.0);
+                                       break;
+                               case oscillate:
+                                       alpha_ = SCALAR(2.0) - alpha_;
+                                       scale_ = -scale_;
+                                       break;
                                }
                        }
                        else if (alpha_ < 0.0)
                        {
                                switch (mode_)
                                {
-                                       case stop:
-                                               alpha_ = SCALAR(0.0);
-                                               is_done_ = true;
-                                               break;
-                                       case repeat:
-                                               alpha_ += SCALAR(1.0);
-                                               break;
-                                       case oscillate:
-                                               alpha_ = -alpha_;
-                                               scale_ = -scale_;
-                                               break;
+                               case stop:
+                                       alpha_ = SCALAR(0.0);
+                                       is_done_ = true;
+                                       break;
+                               case repeat:
+                                       alpha_ += SCALAR(1.0);
+                                       break;
+                               case oscillate:
+                                       alpha_ = -alpha_;
+                                       scale_ = -scale_;
+                                       break;
                                }
                        }
-
                        state_ = function_(a_, b_, alpha_);
                }
        }
 
-
        /**
         * Get the interpolated value.
         * \return The interpolated value.
@@ -169,7 +164,6 @@ public:
                return is_done_;
        }
 
-
 private:
 
        T       state_;
@@ -195,7 +189,6 @@ struct linear_interpolation_function
        }
 };
 
-
 typedef interpolator<linear_interpolation_function> lerp_scalar;
 
 
This page took 0.027182 seconds and 4 git commands to generate.