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