LinearInterpolator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
#ifndef OSGPARTICLE_LINEARINTERPOLATOR
#define OSGPARTICLE_LINEARINTERPOLATOR
#include <osgParticle/Interpolator>
#include <osg/CopyOp>
#include <osg/Object>
#include <osg/Vec3>
#include <osg/Vec4>
namespace osgParticle
{
class LinearInterpolator: public Interpolator
{
public:
LinearInterpolator()
: Interpolator() {}
LinearInterpolator(const LinearInterpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY)
: Interpolator(copy, copyop) {}
META_Object(osgParticle, LinearInterpolator);
virtual float interpolate(float t, float y1, float y2) const
{
return y1 + (y2 - y1) * t;
}
virtual osg::Vec2 interpolate(float t, const osg::Vec2& y1, const osg::Vec2& y2) const
{
return y1 + (y2 - y1) * t;
}
virtual osg::Vec3 interpolate(float t, const osg::Vec3& y1, const osg::Vec3& y2) const
{
return y1 + (y2 - y1) * t;
}
virtual osg::Vec4 interpolate(float t, const osg::Vec4& y1, const osg::Vec4& y2) const
{
return y1 + (y2 - y1) * t;
}
protected:
virtual ~LinearInterpolator() {}
};
}
#endif
CopyOp
Object
Vec3
Vec4
osgParticle::Interpolator::Interpolator
Interpolator()
Definition osgParticle/Interpolator:32
osgParticle::LinearInterpolator::interpolate
virtual osg::Vec2 interpolate(float t, const osg::Vec2 &y1, const osg::Vec2 &y2) const
Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separate...
Definition LinearInterpolator:45
osgParticle::LinearInterpolator::LinearInterpolator
LinearInterpolator(const LinearInterpolator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition LinearInterpolator:35
osgParticle::LinearInterpolator::interpolate
virtual osg::Vec4 interpolate(float t, const osg::Vec4 &y1, const osg::Vec4 &y2) const
Interpolate between 4-dimensional vectors. Default behavior is to interpolate each component separate...
Definition LinearInterpolator:55
osgParticle::LinearInterpolator::META_Object
META_Object(osgParticle, LinearInterpolator)
osgParticle::LinearInterpolator::~LinearInterpolator
virtual ~LinearInterpolator()
Definition LinearInterpolator:61
osgParticle::LinearInterpolator::interpolate
virtual float interpolate(float t, float y1, float y2) const
Interpolate between floats. Must be overridden in descendant classes.
Definition LinearInterpolator:40
osgParticle::LinearInterpolator::interpolate
virtual osg::Vec3 interpolate(float t, const osg::Vec3 &y1, const osg::Vec3 &y2) const
Interpolate between 3-dimensional vectors. Default behavior is to interpolate each component separate...
Definition LinearInterpolator:50
osgParticle::LinearInterpolator::LinearInterpolator
LinearInterpolator()
Definition LinearInterpolator:32
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osgParticle
Definition AccelOperator:27
osg::Vec2
Vec2f Vec2
Definition Vec2:21
osg::Vec3
Vec3f Vec3
Definition Vec3:21
osg::Vec4
Vec4f Vec4
Definition Vec4:21
Interpolator