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

81 lines
2.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
2016-09-06 01:20:21 +12:00
#ifndef NOT_Symmetric_EXP_POTENTIAL_H
#define NOT_Symmetric_EXP_POTENTIAL_H
2016-03-19 06:57:51 +13:00
/**
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
*/
/**
* @brief This class is to use a not symmetric exponential potential.
2016-06-15 18:43:10 +12:00
*
2016-03-19 06:57:51 +13:00
* @code
* __|_
2016-06-15 18:43:10 +12:00
* / | |
2016-03-19 06:57:51 +13:00
* __/ | \___
*
* 2
* { -[(x - t) / d1]
* { e [ ] for x < 0
* {
* potential(x)= {
* { 2
2016-06-15 18:43:10 +12:00
* { -[(x - t) / d2]
2016-03-19 06:57:51 +13:00
* { e [ ] for x >= 0
2016-06-15 18:43:10 +12:00
*
2016-03-19 06:57:51 +13:00
* con d min( length_at_param, action_length *0.5)
2016-06-15 18:43:10 +12:00
* 1
2016-09-06 01:20:21 +12:00
* ed d min( curve_length - length_at_param, action_length *0.5)
2016-03-19 06:57:51 +13:00
* 2
* @endcode
*/
#include "tcommon.h"
#include "tstroke.h"
#include "ext/Potential.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
2016-06-15 18:43:10 +12:00
namespace ToonzExt {
2016-09-06 01:20:21 +12:00
class DVAPI NotSymmetricExpPotential final : public Potential {
2016-03-19 06:57:51 +13:00
public:
2016-09-06 01:20:21 +12:00
virtual ~NotSymmetricExpPotential();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// chiama compute_value ma effettua un controllo del parametro
2016-06-19 20:06:29 +12:00
double value_(double radiusToTest) const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void setParameters_(const TStroke *ref, double par, double al) override;
Potential *clone() override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
double compute_shape(double) const; // funzione ausiliaria per
// il calcolo del parametro
// da usare
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
double compute_value(double) const; // funzione ausiliaria per
// il calcolo del potenziale senza
// controllo del parametro
const TStroke *ref_;
double range_; // range of mapping
double par_;
double actionLength_; // lunghezza dell'azione
double strokeLength_; // lunghezza stroke
2016-09-06 01:20:21 +12:00
double lengthAtParam_; // lunghezza nel pto di movimento
2016-06-15 18:43:10 +12:00
double leftFactor_; // fattore di shape x la curva a sinistra
double rightFactor_; // fattore di shape x la curva a dx
2016-03-19 06:57:51 +13:00
};
}
2016-09-06 01:20:21 +12:00
#endif /* NOT_Symmetric_EXP_POTENTIAL_H */
2016-03-19 06:57:51 +13:00
//-----------------------------------------------------------------------------
// End Of File
//-----------------------------------------------------------------------------