OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinearInterpolator.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 //osgParticle - Copyright (C) 2002 Marco Jez
14 
15 #ifndef OSGPARTICLE_LINEARINTERPOLATOR
16 #define OSGPARTICLE_LINEARINTERPOLATOR
17 
18 #include <osgParticle/Interpolator>
19 
20 #include <osg/CopyOp>
21 #include <osg/Object>
22 #include <osg/Vec3>
23 #include <osg/Vec4>
24 
25 namespace osgParticle
26 {
27 
30  {
31  public:
33  : Interpolator() {}
34 
36  : Interpolator(copy, copyop) {}
37 
39 
40  virtual float interpolate(float t, float y1, float y2) const
41  {
42  return y1 + (y2 - y1) * t;
43  }
44 
45  protected:
46  virtual ~LinearInterpolator() {}
47  };
48 
49 }
50 
51 #endif
An abstract base class for implementing interpolators.
Definition: Interpolator.h:30
virtual float interpolate(float t, float y1, float y2) const
Interpolate between floats. Must be overriden in descendant classes.
LinearInterpolator(const LinearInterpolator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
META_Object(osgParticle, LinearInterpolator)