tahoma2d/toonz/sources/include/ext/Potential.h

97 lines
2 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef POTENTIAL_H
#define POTENTIAL_H
/**
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
*/
#include "tcommon.h"
#undef DVAPI
#undef DVVAR
#ifdef TNZEXT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
#include <assert.h>
#include <stdexcept>
#include <string>
class TStroke;
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
2016-03-19 06:57:51 +13:00
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4290)
#endif
2016-06-15 18:43:10 +12:00
namespace ToonzExt {
2016-03-19 06:57:51 +13:00
/**
2016-06-15 18:43:10 +12:00
* @brief Potential is an abstraction to maintain a
* mathematical potential function.
2016-03-19 06:57:51 +13:00
*
2016-06-15 18:43:10 +12:00
* It is used from StrokeDeformation to change
2016-03-19 06:57:51 +13:00
* the behaviour of deformation that user need to do.
*/
2016-06-15 18:43:10 +12:00
class DVAPI Potential {
bool isValid_;
2016-03-19 06:57:51 +13:00
protected:
2016-06-15 18:43:10 +12:00
/**
*@brief The value of potential at parameter w on
* the stroke.
*@param w The parameter on stroke.
*/
virtual double value_(double w) const = 0;
/**
*@brief Change the parameter of object that has been created.
*
*This method is the real implementation that a potential
*needs to implement.
*@param theStroke The stroke to change.
*@param w The parameter on stroke.
*@param actionLength How many stroke to change.
*/
virtual void setParameters_(const TStroke *theStroke, double w,
double actionLength) = 0;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
Potential();
/**
*@brief Just a wrapper for setParameters_.
*@sa setParameters_
*/
void setParameters(const TStroke *ref, double w, double actionLength);
/**
*@brief Just a wrapper for value_.
*@sa value_
*/
double value(double at) const;
/**
*@brief This is method required to use a Prototype Pattern.
*/
virtual Potential *clone() = 0;
virtual ~Potential() {}
2016-03-19 06:57:51 +13:00
};
}
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
2016-03-19 06:57:51 +13:00
#pragma warning(pop)
#endif
#endif /* POTENTIAL_H */
//-----------------------------------------------------------------------------
// End Of File
//-----------------------------------------------------------------------------