Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef _DEBUG
Toshihiro Shimizu 890ddd
#define _STLP_DEBUG 1
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#include "ext/SmoothDeformation.h"
Toshihiro Shimizu 890ddd
#include "ext/StrokeDeformation.h"
Toshihiro Shimizu 890ddd
//#include "ext/SquarePotential.h"
Toshihiro Shimizu 890ddd
//#include "ext/StrokeParametricDeformer.h"
MCCCS a0ce32
#include "ext/NotSymmetricBezierPotential.h"
Toshihiro Shimizu 890ddd
#include "ext/ContextStatus.h"
Toshihiro Shimizu 890ddd
#include "ext/Designer.h"
Toshihiro Shimizu 890ddd
//#include "ext/TriParam.h"
Toshihiro Shimizu 890ddd
#include "ext/ExtUtil.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "DeformationSelector.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//#include <tcurves.h></tcurves.h>
Toshihiro Shimizu 890ddd
//#include <tstrokeutil.h></tstrokeutil.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <algorithm></algorithm>
Toshihiro Shimizu 890ddd
#include <iterator></iterator>
Toshihiro Shimizu 890ddd
#include <vector></vector>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <tstroke.h></tstroke.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
using namespace ToonzExt;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
REGISTER(SmoothDeformation, 1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
SmoothDeformation::SmoothDeformation() {
MCCCS a0ce32
  setPotential(new NotSymmetricBezierPotential);
Shinya Kitaoka 120a6e
  shortcutKey_ = ContextStatus::ALT;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
SmoothDeformation::~SmoothDeformation() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void SmoothDeformation::draw(Designer *designer) {
Shinya Kitaoka 120a6e
  StrokeDeformationImpl::draw(0);
Shinya Kitaoka 120a6e
  designer->draw(this);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool SmoothDeformation::check_(const ContextStatus *status) {
Shinya Kitaoka 120a6e
  assert(status && "Not status available");
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (!isASpireCorner(status->stroke2change_, status->w_, status->cornerSize_,
Shinya Kitaoka 120a6e
                      &this->getSpiresList()))
Shinya Kitaoka 120a6e
    return true;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return false;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
bool SmoothDeformation::findExtremes_(const ContextStatus *status,
Shinya Kitaoka 120a6e
                                      Interval &ret) {
Shinya Kitaoka 120a6e
  return ToonzExt::findNearestSpireCorners(status->stroke2change_, status->w_,
Shinya Kitaoka 120a6e
                                           ret, status->cornerSize_,
Shinya Kitaoka 120a6e
                                           &this->getSpiresList());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
double SmoothDeformation::findActionLength() {
Shinya Kitaoka 120a6e
  // this means that all length needs to be used
Shinya Kitaoka 120a6e
  return 2.0 * stroke2manipulate_->getLength();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
SmoothDeformation *SmoothDeformation::instance() {
Shinya Kitaoka 120a6e
  static SmoothDeformation singleton;
Shinya Kitaoka 120a6e
  return &singleton;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  End Of File
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------