From a0ce326e1b85fda512c860d78f4ad49594428317 Mon Sep 17 00:00:00 2001 From: MCCCS Date: Sep 07 2016 13:28:50 +0000 Subject: :bug: Fix spelling mistakes --- diff --git a/toonz/sources/common/tapptools/tcolorutils.cpp b/toonz/sources/common/tapptools/tcolorutils.cpp index d18f22b..8c8a6fb 100644 --- a/toonz/sources/common/tapptools/tcolorutils.cpp +++ b/toonz/sources/common/tapptools/tcolorutils.cpp @@ -183,7 +183,7 @@ void chooseLeafToClusterize(ClusterContainer::iterator &itRet, assert(!ISNAN(clusterCovariance[0])); // calcola gli autovalori della matrice di covarianza della statistica - // del cluster (siccome la matrice e' simmetrica gli autovalori + // del cluster (siccome la matrice e' symmetrica gli autovalori // sono tutti reali) KEYER_FLOAT eigenValues[3]; tmpMulteplicity = calcCovarianceEigenValues(clusterCovariance, eigenValues); diff --git a/toonz/sources/common/tgeometry/tcurveutil.cpp b/toonz/sources/common/tgeometry/tcurveutil.cpp index bc0807e..02820d6 100644 --- a/toonz/sources/common/tgeometry/tcurveutil.cpp +++ b/toonz/sources/common/tgeometry/tcurveutil.cpp @@ -439,8 +439,8 @@ bool isCloseToSegment(const TPointD &point, const TSegment &segment, double distance) { TPointD a = segment.getP0(); TPointD b = segment.getP1(); - double lenght2 = tdistance2(a, b); - if (lenght2 < tdistance2(a, point) || lenght2 < tdistance2(point, b)) + double length2 = tdistance2(a, b); + if (length2 < tdistance2(a, point) || length2 < tdistance2(point, b)) return false; if (a.x == b.x) return fabs(point.x - a.x) <= distance; if (a.y == b.y) return fabs(point.y - a.y) <= distance; diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp index fb03365..951f894 100644 --- a/toonz/sources/common/tvectorimage/tstroke.cpp +++ b/toonz/sources/common/tvectorimage/tstroke.cpp @@ -556,7 +556,7 @@ struct TStroke::Imp { BYTE m_flag; //! This flag checks if changes occurs and if it is neccessary to update - //! lenght. + //! length. bool m_isValidLength; //! This flag checks if changes occurs and if it is neccessary to update @@ -570,7 +570,7 @@ struct TStroke::Imp { TRectD m_bBox; //! This vector contains length computed for each control point of stroke. - DoubleArray m_partialLenghtArray; + DoubleArray m_partialLengthArray; //! This vector contains parameter computed for each control point of stroke. DoubleArray m_parameterValueAtControlPoint; @@ -659,7 +659,7 @@ false -> ok bool retrieveChunkAndItsParamameter(double w, int &chunk, double &t); /*! -From lenght s retrieves chunk and its parameter ( t in [0,1] ). +From length s retrieves chunk and its parameter ( t in [0,1] ). Return true -> error (parameter w out of range, etc) false -> ok @@ -793,7 +793,7 @@ void TStroke::Imp::swapGeometry(Imp &other) throw() { std::swap(m_isOutlineValid, other.m_isOutlineValid); std::swap(m_areDisabledComputeOfCaches, other.m_areDisabledComputeOfCaches); std::swap(m_bBox, other.m_bBox); - std::swap(m_partialLenghtArray, other.m_partialLenghtArray); + std::swap(m_partialLengthArray, other.m_partialLengthArray); std::swap(m_parameterValueAtControlPoint, other.m_parameterValueAtControlPoint); std::swap(m_centerLineArray, other.m_centerLineArray); @@ -820,10 +820,10 @@ void TStroke::Imp::computeCacheVector() { if (getChunkCount() > 0) // se ci sono cionchi { // (re)inizializzo un vettore - m_partialLenghtArray.resize(getControlPointCount(), + m_partialLengthArray.resize(getControlPointCount(), (std::numeric_limits::max)()); - m_partialLenghtArray[0] = 0.0; + m_partialLengthArray[0] = 0.0; double length = 0.0; int j = 0; @@ -835,15 +835,15 @@ void TStroke::Imp::computeCacheVector() { assert(j <= getControlPointCount()); tq = getChunk(i); lengthEvaluator.setQuad(*tq); - m_partialLenghtArray[j++] = length; - m_partialLenghtArray[j++] = length + lengthEvaluator.getLengthAt(0.5); + m_partialLengthArray[j++] = length; + m_partialLengthArray[j++] = length + lengthEvaluator.getLengthAt(0.5); length += lengthEvaluator.getLengthAt(1.0); } - m_partialLenghtArray[j++] = length; + m_partialLengthArray[j++] = length; assert(j == getControlPointCount()); // assert( m_parameterValueAtControlPoint.size() == - // m_partialLenghtArray.size() ); + // m_partialLengthArray.size() ); } m_isValidLength = true; } @@ -932,18 +932,18 @@ bool TStroke::Imp::retrieveChunkAndItsParamameterAtLength(double s, int &chunk, vector::iterator first; // cerco nella cache la posizione che compete alla lunghezza s - first = std::upper_bound(m_partialLenghtArray.begin(), - m_partialLenghtArray.end(), s); + first = std::upper_bound(m_partialLengthArray.begin(), + m_partialLengthArray.end(), s); // se s e' interna al vettore di cache - if (first != m_partialLenghtArray.end()) { + if (first != m_partialLengthArray.end()) { // individuo il punto di controllo della stroke... - int controlPointOffset = distance(m_partialLenghtArray.begin(), first); + int controlPointOffset = distance(m_partialLengthArray.begin(), first); // ...e da questo il cionco relativo. chunk = retrieveChunkFromControlPointIndex(controlPointOffset); - if (first != m_partialLenghtArray.begin() && s == *(first - 1)) { + if (first != m_partialLengthArray.begin() && s == *(first - 1)) { controlPointOffset--; if (controlPointOffset & 1) { const DoublePair &p = retrieveParametersFromChunk(chunk); @@ -956,9 +956,9 @@ bool TStroke::Imp::retrieveChunkAndItsParamameterAtLength(double s, int &chunk, } // fisso un offset per l'algoritmo di bisezione - double offset = (first == m_partialLenghtArray.begin()) + double offset = (first == m_partialLengthArray.begin()) ? s - : s - m_partialLenghtArray[chunk * 2]; + : s - m_partialLengthArray[chunk * 2]; // cerco il parametro minimo a meno di una tolleranza epsilon @@ -974,7 +974,7 @@ bool TStroke::Imp::retrieveChunkAndItsParamameterAtLength(double s, int &chunk, // se l'algoritmo di ricerca ha fallito fissa il valore ad uno dei due // estremi if (t == -1) { - if (s <= m_partialLenghtArray[controlPointOffset]) t = 0.0; + if (s <= m_partialLengthArray[controlPointOffset]) t = 0.0; t = 1.0; } @@ -984,7 +984,7 @@ bool TStroke::Imp::retrieveChunkAndItsParamameterAtLength(double s, int &chunk, if (s <= 0.0) { chunk = 0; t = 0.0; - } else if (s >= m_partialLenghtArray.back()) { + } else if (s >= m_partialLengthArray.back()) { chunk = getChunkCount() - 1; t = 1.0; } @@ -1156,8 +1156,8 @@ void TStroke::Imp::print(ostream &os) { os << "m_bBox:" << m_bBox << endl; - os << "m_partialLenghtArray"; - printContainer(os, m_partialLenghtArray); + os << "m_partialLengthArray"; + printContainer(os, m_partialLengthArray); os << endl; os << "m_parameterValueAtControlPoint"; @@ -1242,9 +1242,9 @@ TStroke::TStroke(const TStroke &other) // other.m_imp->m_centerLineArray.end(), // TThickQuadraticArrayInsertIterator(m_imp->m_centerLineArray)); - copy(other.m_imp->m_partialLenghtArray.begin(), - other.m_imp->m_partialLenghtArray.end(), - back_inserter(m_imp->m_partialLenghtArray)); + copy(other.m_imp->m_partialLengthArray.begin(), + other.m_imp->m_partialLengthArray.end(), + back_inserter(m_imp->m_partialLengthArray)); copy(other.m_imp->m_parameterValueAtControlPoint.begin(), other.m_imp->m_parameterValueAtControlPoint.end(), back_inserter(m_imp->m_parameterValueAtControlPoint)); @@ -1507,7 +1507,7 @@ void TStroke::reshape(const TThickPoint pos[], int count) { double TStroke::getApproximateLength(double w0, double w1, double error) const { m_imp->computeCacheVector(); - assert((int)m_imp->m_partialLenghtArray.size() == getControlPointCount()); + assert((int)m_imp->m_partialLengthArray.size() == getControlPointCount()); if (w0 == w1) return 0.0; @@ -1529,7 +1529,7 @@ double TStroke::getApproximateLength(double w0, double w1, double error) const { *first < w1 + TConsts::epsilon) { int offset = distance(m_imp->m_parameterValueAtControlPoint.begin(), first); - return m_imp->m_partialLenghtArray[offset]; + return m_imp->m_partialLengthArray[offset]; } } @@ -1594,11 +1594,11 @@ double TStroke::getLength(double w0, double w1) const { double TStroke::getLength(int chunk, double t) const { // Compute length caches m_imp->computeCacheVector(); - assert((int)m_imp->m_partialLenghtArray.size() == getControlPointCount()); + assert((int)m_imp->m_partialLengthArray.size() == getControlPointCount()); if (t == 1.0) ++chunk, t = 0.0; - double s = m_imp->m_partialLenghtArray[chunk << 1]; + double s = m_imp->m_partialLengthArray[chunk << 1]; if (t > 0.0) s += getChunk(chunk)->getLength(t); return s; @@ -2184,11 +2184,11 @@ TPointD TStroke::getSpeedAtLength(double s) const { double TStroke::getLengthAtControlPoint(int n) const { m_imp->computeCacheVector(); - if (n >= getControlPointCount()) return m_imp->m_partialLenghtArray.back(); + if (n >= getControlPointCount()) return m_imp->m_partialLengthArray.back(); - if (n <= 0) return m_imp->m_partialLenghtArray.front(); + if (n <= 0) return m_imp->m_partialLengthArray.front(); - return m_imp->m_partialLenghtArray[n]; + return m_imp->m_partialLengthArray[n]; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index c70f1b9..ac58b7a 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -940,8 +940,8 @@ void transferColors(const std::list &oldList, #if 0 list::const_iterator it1; #endif - double totLenght; - if (isStrokeChanged) totLenght = newList.front()->m_s->getLength(); + double totLength; + if (isStrokeChanged) totLength = newList.front()->m_s->getLength(); for (it = newList.begin(); it != newList.end(); ++it) { int newStyle = -1; // ErrorStyle; // unused variable @@ -955,8 +955,8 @@ list::const_iterator it1; if ((*it)->m_w0 > (*it)->m_w1) { reversed = !isFlipped; if (isStrokeChanged) { - l0 = (*it)->m_s->getLength((*it)->m_w1) / totLenght; - l1 = (*it)->m_s->getLength((*it)->m_w0) / totLenght; + l0 = (*it)->m_s->getLength((*it)->m_w1) / totLength; + l1 = (*it)->m_s->getLength((*it)->m_w0) / totLength; } else { l0 = (*it)->m_w1; l1 = (*it)->m_w0; @@ -964,8 +964,8 @@ list::const_iterator it1; } else { reversed = isFlipped; if (isStrokeChanged) { - l0 = (*it)->m_s->getLength((*it)->m_w0) / totLenght; - l1 = (*it)->m_s->getLength((*it)->m_w1) / totLenght; + l0 = (*it)->m_s->getLength((*it)->m_w0) / totLength; + l1 = (*it)->m_s->getLength((*it)->m_w1) / totLength; } else { l0 = (*it)->m_w0; l1 = (*it)->m_w1; @@ -986,12 +986,12 @@ list::const_iterator it1; continue; double _l0, _l1; if (isStrokeChanged) { - double totLenght1 = (*it1)->m_s->getLength(); + double totLength1 = (*it1)->m_s->getLength(); _l0 = (*it1)->m_s->getLength(std::min((*it1)->m_w0, (*it1)->m_w1)) / - totLenght1; + totLength1; _l1 = (*it1)->m_s->getLength(std::max((*it1)->m_w0, (*it1)->m_w1)) / - totLenght1; + totLength1; } else { _l0 = std::min((*it1)->m_w0, (*it1)->m_w1); _l1 = std::max((*it1)->m_w0, (*it1)->m_w1); @@ -1634,14 +1634,14 @@ void TVectorImage::getUsedStyles(std::set &styles) const { inline double recomputeW1(double oldW, const TStroke &oldStroke, const TStroke &newStroke, double startW) { - double oldLenght = oldStroke.getLength(); - double newLenght = newStroke.getLength(); + double oldLength = oldStroke.getLength(); + double newLength = newStroke.getLength(); assert(startW <= oldW); - assert(newLenght < oldLenght); + assert(newLength < oldLength); double s = oldStroke.getLength(startW, oldW); - assert(s <= newLenght || areAlmostEqual(s, newLenght, 1e-5)); + assert(s <= newLength || areAlmostEqual(s, newLength, 1e-5)); return newStroke.getParameterAtLength(s); } @@ -1657,13 +1657,13 @@ inline double recomputeW2(double oldW, const TStroke &oldStroke, inline double recomputeW(double oldW, const TStroke &oldStroke, const TStroke &newStroke, bool isAtBegin) { - double oldLenght = oldStroke.getLength(); - double newLenght = newStroke.getLength(); + double oldLength = oldStroke.getLength(); + double newLength = newStroke.getLength(); - assert(newLenght < oldLenght); + assert(newLength < oldLength); double s = - oldStroke.getLength(oldW) - ((isAtBegin) ? 0 : oldLenght - newLenght); - assert(s <= newLenght || areAlmostEqual(s, newLenght, 1e-5)); + oldStroke.getLength(oldW) - ((isAtBegin) ? 0 : oldLength - newLength); + assert(s <= newLength || areAlmostEqual(s, newLength, 1e-5)); return newStroke.getParameterAtLength(s); } @@ -1946,12 +1946,12 @@ static void computeEdgeList(TStroke *newS, const std::list &edgeList1, if (!edgeList1.empty()) { TStroke *s1 = edgeList1.front()->m_s; - double lenght1 = s1->getLength(); + double length1 = s1->getLength(); ; for (it = edgeList1.begin(); it != edgeList1.end(); ++it) { double l0 = s1->getLength((*it)->m_w0), l1 = s1->getLength((*it)->m_w1); - if (join1AtBegin) l0 = lenght1 - l0, l1 = lenght1 - l1; + if (join1AtBegin) l0 = length1 - l0, l1 = length1 - l1; TEdge *e = new TEdge(); e->m_toBeDeleted = true; @@ -1967,10 +1967,10 @@ static void computeEdgeList(TStroke *newS, const std::list &edgeList1, if (!edgeList2.empty()) { TStroke *s2 = edgeList2.front()->m_s; double offset = newS->getLength(newS->getW(s2->getPoint(0.0))); - double lenght2 = s2->getLength(); + double length2 = s2->getLength(); for (it = edgeList2.begin(); it != edgeList2.end(); ++it) { double l0 = s2->getLength((*it)->m_w0), l1 = s2->getLength((*it)->m_w1); - if (!join2AtBegin) l0 = lenght2 - l0, l1 = lenght2 - l1; + if (!join2AtBegin) l0 = length2 - l0, l1 = length2 - l1; TEdge *e = new TEdge(); e->m_toBeDeleted = true; diff --git a/toonz/sources/common/tvrender/tstrokedeformations.cpp b/toonz/sources/common/tvrender/tstrokedeformations.cpp index 5662211..6a49806 100644 --- a/toonz/sources/common/tvrender/tstrokedeformations.cpp +++ b/toonz/sources/common/tvrender/tstrokedeformations.cpp @@ -95,7 +95,7 @@ double derivateOfWyvillPotential(double r, double R) { return inv_of_R * nine_inv * (68.0 * ratio3 - (24.0 * ratio5 + 66.0 * ratio)); } -const double c_maxLenghtOfGaussian = 3.0; +const double c_maxLengthOfGaussian = 3.0; /* */ @@ -274,7 +274,7 @@ TStrokeParamDeformation::TStrokeParamDeformation(const TStroke *ref, double s, TThickPoint TStrokeParamDeformation::getDisplacementForControlPoint( const TStroke &stroke, UINT n) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double diff = stroke.getLengthAtControlPoint(n); diff = diff - m_startParameter; @@ -283,7 +283,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPoint( // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; if (m_vect) return gaussianPotential(diff) * TThickPoint(*m_vect, 0); @@ -299,7 +299,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPoint( TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen( const TStroke &stroke, double cpLenDiff) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] // double diff = stroke.getLengthAtControlPoint(n); // double diff = cpLen; @@ -309,7 +309,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen( // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; if (m_vect) return gaussianPotential(diff) * TThickPoint(*m_vect, 0); @@ -327,7 +327,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen( TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke, double w) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double diff = stroke.getLength(w); diff = diff - m_startParameter; @@ -336,7 +336,7 @@ TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke, // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; if (m_vect) return gaussianPotential(diff) * TThickPoint(*m_vect, 0); @@ -354,7 +354,7 @@ TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke, double TStrokeParamDeformation::getDelta(const TStroke &stroke, double w) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double diff = stroke.getLength(w); diff = diff - m_startParameter; @@ -363,7 +363,7 @@ double TStrokeParamDeformation::getDelta(const TStroke &stroke, // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; return derivateOfGaussianPotential(diff); } @@ -430,7 +430,7 @@ double TStrokeBenderDeformation::getMaxDiff() const { TThickPoint TStrokeBenderDeformation::getDisplacementForControlPoint( const TStroke &s, UINT n) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double strokeLengthAtParameter = s.getLengthAtControlPoint(n); double diff = strokeLengthAtParameter - m_startLength; @@ -438,11 +438,11 @@ TThickPoint TStrokeBenderDeformation::getDisplacementForControlPoint( double outVal = 0; if (fabs(diff) <= m_lengthOfDeformation && m_versus == INNER) { - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; outVal = gaussianPotential(diff); } else if (m_versus == OUTER) { - double valForGaussian = -c_maxLenghtOfGaussian + - 2 * c_maxLenghtOfGaussian / + double valForGaussian = -c_maxLengthOfGaussian + + 2 * c_maxLengthOfGaussian / m_lengthOfDeformation * strokeLengthAtParameter; outVal = 1.0 - gaussianPotential(valForGaussian); @@ -472,7 +472,7 @@ TThickPoint TStrokeBenderDeformation::getDisplacementForControlPointLen( TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s, double w) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double strokeLengthAtParameter = s.getLength(w); double diff = strokeLengthAtParameter - m_startLength; @@ -481,11 +481,11 @@ TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s, if (fabs(diff) <= m_lengthOfDeformation) if (m_versus == INNER) { - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; outVal = gaussianPotential(diff); } else if (m_versus == OUTER) { - double valForGaussian = -c_maxLenghtOfGaussian + - 2 * c_maxLenghtOfGaussian / + double valForGaussian = -c_maxLengthOfGaussian + + 2 * c_maxLengthOfGaussian / m_lengthOfDeformation * strokeLengthAtParameter; outVal = 1.0 - gaussianPotential(valForGaussian); @@ -507,10 +507,10 @@ TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s, //----------------------------------------------------------------------------- double TStrokeBenderDeformation::getDelta(const TStroke &s, double w) const { - double totalLenght = s.getLength(); + double totalLength = s.getLength(); - if (totalLenght != 0) { - double val = s.getLength(w) / totalLenght * (M_PI * 10.0); + if (totalLength != 0) { + double val = s.getLength(w) / totalLength * (M_PI * 10.0); return sin(val); } @@ -564,11 +564,11 @@ vector vres; if(intersect( stroke, m_center, m_outerRadius, vres)) { -double totalLenght = stroke.getLength(); +double totalLength = stroke.getLength(); -if(totalLenght != 0) +if(totalLength != 0) { -double val = stroke.getLength(s)/totalLenght * (M_PI * 11.0); +double val = stroke.getLength(s)/totalLength * (M_PI * 11.0); return sin(val); } @@ -615,7 +615,7 @@ TStrokeThicknessDeformation::TStrokeThicknessDeformation(const TStroke *ref, TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPoint( const TStroke &stroke, UINT n) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double diff = stroke.getLengthAtControlPoint(n); diff = diff - m_startParameter; @@ -625,7 +625,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPoint( // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; TThickPoint delta; @@ -651,7 +651,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPointLen( // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; TThickPoint delta; @@ -673,7 +673,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPointLen( TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke, double w) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double diff = stroke.getLength(w); diff = diff - m_startParameter; @@ -683,7 +683,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke, // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; if (m_vect) return gaussianPotential(diff) * TThickPoint(*m_vect, 0); @@ -701,7 +701,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke, double TStrokeThicknessDeformation::getDelta(const TStroke &stroke, double w) const { // potenziale exp^(-x^2) limitato tra - // [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian] + // [-c_maxLengthOfGaussian,c_maxLengthOfGaussian] double diff = stroke.getLength(w); diff = diff - m_startParameter; @@ -711,7 +711,7 @@ double TStrokeThicknessDeformation::getDelta(const TStroke &stroke, // il termine (1.0/m_lengthOfDeformation) * 3 scala // il punto in diff su un sistema di coordinate // normalizzato, associato con la curva exp^(-x^2) - diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian; + diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; return derivateOfGaussianPotential(diff); } diff --git a/toonz/sources/image/pli/pli_io.cpp b/toonz/sources/image/pli/pli_io.cpp index b8c37a3..d712b4e 100644 --- a/toonz/sources/image/pli/pli_io.cpp +++ b/toonz/sources/image/pli/pli_io.cpp @@ -244,9 +244,9 @@ inline MyIfstream &MyIfstream::operator>>(TUINT32 &un) { inline MyIfstream &MyIfstream::operator>>(string &un) { string s = ""; - USHORT lenght; - (*this) >> lenght; - for (UINT i = 0; i < lenght; i++) { + USHORT length; + (*this) >> length; + for (UINT i = 0; i < length; i++) { UCHAR ch; (*this) >> ch; s.append(1, ch); @@ -530,7 +530,7 @@ ParsedPliImp::ParsedPliImp(const TFilePath &filename, bool readInfo) , m_precisionScale(REGION_COMPUTING_PRECISION) , m_creator("") { TUINT32 magic; - // TUINT32 fileLenght; + // TUINT32 fileLength; TagElem *tagElem; UCHAR maxThickness; @@ -583,9 +583,9 @@ ParsedPliImp::ParsedPliImp(const TFilePath &filename, bool readInfo) m_iChan >> m_creator; if (m_majorVersionNumber < 5) { - TUINT32 fileLenght; + TUINT32 fileLength; - m_iChan >> fileLenght; + m_iChan >> fileLength; m_iChan >> m_framesNumber; m_iChan >> maxThickness; m_thickRatio = maxThickness / 255.0; @@ -633,9 +633,9 @@ const TFrameId &ParsedPli::getFrameNumber(int index) { void ParsedPliImp::loadInfo(bool readPlt, TPalette *&palette, TContentHistory *&history) { - TUINT32 fileLenght; + TUINT32 fileLength; - m_iChan >> fileLenght; + m_iChan >> fileLength; m_iChan >> m_framesNumber; if (!((m_majorVersionNumber == 5 && m_minorVersionNumber >= 7) || (m_majorVersionNumber > 5))) { @@ -1306,7 +1306,7 @@ PliTag *ParsedPliImp::readColorTag() { PliTag *ParsedPliImp::readStyleTag() { std::vector paramArray; TUINT32 bufOffs = 0; - int lenght = m_tagLength; + int length = m_tagLength; UINT i; USHORT id = 0; USHORT pageIndex = 0; @@ -1315,36 +1315,36 @@ PliTag *ParsedPliImp::readStyleTag() { m_currDinamicTypeBytesNum = 2; readUShortData(id, bufOffs); - lenght -= 2; + length -= 2; if (m_majorVersionNumber > 5 || (m_majorVersionNumber == 5 && m_minorVersionNumber >= 6)) { readUShortData(pageIndex, bufOffs); - lenght -= 2; + length -= 2; } - while (lenght > 0) { + while (length > 0) { TStyleParam param; param.m_type = (enum TStyleParam::Type)m_buf[bufOffs++]; - lenght--; + length--; switch (param.m_type) { case TStyleParam::SP_BYTE: param.m_numericVal = m_buf[bufOffs++]; - lenght--; + length--; break; case TStyleParam::SP_USHORT: { USHORT val; readUShortData(val, bufOffs); param.m_numericVal = val; - lenght -= 2; + length -= 2; break; } case TStyleParam::SP_INT: case TStyleParam::SP_DOUBLE: readFloatData(param.m_numericVal, bufOffs); - lenght -= 4; + length -= 4; break; case TStyleParam::SP_RASTER: - lenght -= readRasterData(param.m_r, bufOffs); + length -= readRasterData(param.m_r, bufOffs); break; case TStyleParam::SP_STRING: { USHORT strLen; @@ -1354,7 +1354,7 @@ PliTag *ParsedPliImp::readStyleTag() { for (i = 0; i < strLen; i++) { param.m_string.append(1, m_buf[bufOffs++]); } - lenght -= strLen + sizeof(USHORT); + length -= strLen + sizeof(USHORT); break; } default: @@ -2502,7 +2502,7 @@ bool ParsedPliImp::writePli(const TFilePath &filename) { *m_oChan << m_creator; - *m_oChan << (TUINT32)0; // fileLenght; + *m_oChan << (TUINT32)0; // fileLength; *m_oChan << m_framesNumber; UCHAR s, i, d; diff --git a/toonz/sources/image/svg/tiio_svg.cpp b/toonz/sources/image/svg/tiio_svg.cpp index 51c23ae..f4346f0 100644 --- a/toonz/sources/image/svg/tiio_svg.cpp +++ b/toonz/sources/image/svg/tiio_svg.cpp @@ -50,7 +50,7 @@ struct NSVGimage { #define NSVG_PI 3.14159265358979323846264338327f #define NSVG_KAPPA90 \ - 0.5522847493f // Lenght proportional to radius of a cubic bezier handle for + 0.5522847493f // Length proportional to radius of a cubic bezier handle for // 90deg arcs. #ifdef _MSC_VER diff --git a/toonz/sources/include/ext/ExtUtil.h b/toonz/sources/include/ext/ExtUtil.h index 6318a2c..277bd68 100644 --- a/toonz/sources/include/ext/ExtUtil.h +++ b/toonz/sources/include/ext/ExtUtil.h @@ -106,13 +106,13 @@ DVAPI bool findNearestCorners(const TStroke *stroke, double w, Interval &out, * @brief Rotate the control point at even position [0,2,4,...] in a * new position along the close path of a selfLoop stroke. * - * The new position is: @b atLenght. + * The new position is: @b atLength. * @return 0 if some problem occurs, else the new stroke. * @todo Some refactoring required, code duplication. */ DVAPI TStroke *rotateControlPoint(const TStroke *stroke, const ToonzExt::EvenInt &even, - double atLenght); + double atLength); /** * Retrieve all parameters where stroke has a minimum. diff --git a/toonz/sources/include/ext/LinearPotential.h b/toonz/sources/include/ext/LinearPotential.h index c289b7b..1c8f7ae 100644 --- a/toonz/sources/include/ext/LinearPotential.h +++ b/toonz/sources/include/ext/LinearPotential.h @@ -54,7 +54,7 @@ private: par_, //! Parameter of selection. actionLength_, //! Action length, how many units to move. strokeLength_, //! Stroke Length. - lenghtAtParam_, //! Length at par_ + lengthAtParam_, //! Length at par_ leftFactor_, //! How many units to move on the left of curve. rightFactor_; //! How many units to move on the right of curve. }; diff --git a/toonz/sources/include/ext/NotSimmetricBezierPotential.h b/toonz/sources/include/ext/NotSimmetricBezierPotential.h deleted file mode 100644 index 397ab80..0000000 --- a/toonz/sources/include/ext/NotSimmetricBezierPotential.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#ifndef NOT_SIMMETRIC_BEZIER_POTENTIAL_H -#define NOT_SIMMETRIC_BEZIER_POTENTIAL_H - -/** - * @author Fabrizio Morciano - */ - -//#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 - -namespace ToonzExt { -class DVAPI NotSimmetricBezierPotential final : public Potential { -public: - virtual ~NotSimmetricBezierPotential(); - - // chiama compute_value ma effettua un controllo del parametro - double value_(double radiusToTest) const override; - - void setParameters_(const TStroke *ref, double w, - double actionLength) override; - - Potential *clone() override; - -private: - double compute_shape(double) const; // funzione ausiliaria per - // il calcolo del parametro - // da usare - - 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 - double lenghtAtParam_; // lunghezza nel pto di movimento - double leftFactor_; // fattore di shape x la curva a sinistra - double rightFactor_; // fattore di shape x la curva a dx -}; -} -#endif /* NOT_SIMMETRIC_BEZIER_POTENTIAL_H */ -//----------------------------------------------------------------------------- -// End Of File -//----------------------------------------------------------------------------- diff --git a/toonz/sources/include/ext/NotSimmetricExpPotential.h b/toonz/sources/include/ext/NotSimmetricExpPotential.h deleted file mode 100644 index 6ca337d..0000000 --- a/toonz/sources/include/ext/NotSimmetricExpPotential.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#ifndef NOT_SIMMETRIC_EXP_POTENTIAL_H -#define NOT_SIMMETRIC_EXP_POTENTIAL_H - -/** - * @author Fabrizio Morciano - */ - -/** - * @brief This class is to use a not symmetric exponential potential. - * - * @code - * __|_ - * / | | - * __/ | \___ - * - * 2 - * { -[(x - t) / d1] - * { e [ ] for x < 0 - * { - * potential(x)= { - * { 2 - * { -[(x - t) / d2] - * { e [ ] for x >= 0 - * - * con d min( length_at_param, action_length *0.5) - * 1 - * ed d min( curve_lenght - length_at_param, action_length *0.5) - * 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 - -namespace ToonzExt { -class DVAPI NotSimmetricExpPotential final : public Potential { -public: - virtual ~NotSimmetricExpPotential(); - - // chiama compute_value ma effettua un controllo del parametro - double value_(double radiusToTest) const override; - - void setParameters_(const TStroke *ref, double par, double al) override; - Potential *clone() override; - -private: - double compute_shape(double) const; // funzione ausiliaria per - // il calcolo del parametro - // da usare - - 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 - double lenghtAtParam_; // lunghezza nel pto di movimento - double leftFactor_; // fattore di shape x la curva a sinistra - double rightFactor_; // fattore di shape x la curva a dx -}; -} -#endif /* NOT_SIMMETRIC_EXP_POTENTIAL_H */ -//----------------------------------------------------------------------------- -// End Of File -//----------------------------------------------------------------------------- diff --git a/toonz/sources/include/ext/NotSymmetricBezierPotential.h b/toonz/sources/include/ext/NotSymmetricBezierPotential.h new file mode 100644 index 0000000..9d985e8 --- /dev/null +++ b/toonz/sources/include/ext/NotSymmetricBezierPotential.h @@ -0,0 +1,59 @@ +#pragma once + +#ifndef NOT_Symmetric_BEZIER_POTENTIAL_H +#define NOT_Symmetric_BEZIER_POTENTIAL_H + +/** + * @author Fabrizio Morciano + */ + +//#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 + +namespace ToonzExt { +class DVAPI NotSymmetricBezierPotential final : public Potential { +public: + virtual ~NotSymmetricBezierPotential(); + + // chiama compute_value ma effettua un controllo del parametro + double value_(double radiusToTest) const override; + + void setParameters_(const TStroke *ref, double w, + double actionLength) override; + + Potential *clone() override; + +private: + double compute_shape(double) const; // funzione ausiliaria per + // il calcolo del parametro + // da usare + + 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 + double lengthAtParam_; // lunghezza nel pto di movimento + double leftFactor_; // fattore di shape x la curva a sinistra + double rightFactor_; // fattore di shape x la curva a dx +}; +} +#endif /* NOT_Symmetric_BEZIER_POTENTIAL_H */ +//----------------------------------------------------------------------------- +// End Of File +//----------------------------------------------------------------------------- diff --git a/toonz/sources/include/ext/NotSymmetricExpPotential.h b/toonz/sources/include/ext/NotSymmetricExpPotential.h new file mode 100644 index 0000000..868e3bc --- /dev/null +++ b/toonz/sources/include/ext/NotSymmetricExpPotential.h @@ -0,0 +1,80 @@ +#pragma once + +#ifndef NOT_Symmetric_EXP_POTENTIAL_H +#define NOT_Symmetric_EXP_POTENTIAL_H + +/** + * @author Fabrizio Morciano + */ + +/** + * @brief This class is to use a not symmetric exponential potential. + * + * @code + * __|_ + * / | | + * __/ | \___ + * + * 2 + * { -[(x - t) / d1] + * { e [ ] for x < 0 + * { + * potential(x)= { + * { 2 + * { -[(x - t) / d2] + * { e [ ] for x >= 0 + * + * con d min( length_at_param, action_length *0.5) + * 1 + * ed d min( curve_length - length_at_param, action_length *0.5) + * 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 + +namespace ToonzExt { +class DVAPI NotSymmetricExpPotential final : public Potential { +public: + virtual ~NotSymmetricExpPotential(); + + // chiama compute_value ma effettua un controllo del parametro + double value_(double radiusToTest) const override; + + void setParameters_(const TStroke *ref, double par, double al) override; + Potential *clone() override; + +private: + double compute_shape(double) const; // funzione ausiliaria per + // il calcolo del parametro + // da usare + + 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 + double lengthAtParam_; // lunghezza nel pto di movimento + double leftFactor_; // fattore di shape x la curva a sinistra + double rightFactor_; // fattore di shape x la curva a dx +}; +} +#endif /* NOT_Symmetric_EXP_POTENTIAL_H */ +//----------------------------------------------------------------------------- +// End Of File +//----------------------------------------------------------------------------- diff --git a/toonz/sources/include/ext/SquarePotential.h b/toonz/sources/include/ext/SquarePotential.h index 07b5067..5feafc5 100644 --- a/toonz/sources/include/ext/SquarePotential.h +++ b/toonz/sources/include/ext/SquarePotential.h @@ -49,7 +49,7 @@ private: double par_; double actionLength_; // lunghezza dell'azione double strokeLength_; // lunghezza stroke - double lenghtAtParam_; // lunghezza nel pto di movimento + double lengthAtParam_; // lunghezza nel pto di movimento double leftFactor_; // fattore di shape x la curva a sinistra double rightFactor_; // fattore di shape x la curva a dx }; diff --git a/toonz/sources/include/ext/StrokeParametricDeformer.h b/toonz/sources/include/ext/StrokeParametricDeformer.h index d2a0d70..dbfc757 100644 --- a/toonz/sources/include/ext/StrokeParametricDeformer.h +++ b/toonz/sources/include/ext/StrokeParametricDeformer.h @@ -37,7 +37,7 @@ class Potential; */ class DVAPI StrokeParametricDeformer final : public TStrokeDeformation { public: - StrokeParametricDeformer(double actionLenght, double startParameter, + StrokeParametricDeformer(double actionLength, double startParameter, TStroke *s, Potential *); ~StrokeParametricDeformer(); @@ -112,11 +112,11 @@ private: // parameter where is applicated action double startParameter_; - // like startParameter_ but recover lenght - double startLenght_; + // like startParameter_ but recover length + double startLength_; // how many traits move - double actionLenght_; + double actionLength_; // deformation shape Potential *pot_; diff --git a/toonz/sources/include/ext/StrokeStatus.h b/toonz/sources/include/ext/StrokeStatus.h index 2a97b43..11a595c 100644 --- a/toonz/sources/include/ext/StrokeStatus.h +++ b/toonz/sources/include/ext/StrokeStatus.h @@ -33,7 +33,7 @@ class DVAPI StrokeStatus : public CompositeStatus { // parameter of selected stroke double w_; - // lenght of selected stroke + // length of selected stroke double strokeLength_; public: diff --git a/toonz/sources/include/toonz4.6/tnzmovie.h b/toonz/sources/include/toonz4.6/tnzmovie.h index 8b87c3d..a4e3343 100644 --- a/toonz/sources/include/toonz4.6/tnzmovie.h +++ b/toonz/sources/include/toonz4.6/tnzmovie.h @@ -128,7 +128,7 @@ TNZAPI TBOOL tm_append_raster(TNZMOVIE movie, MY_RASTER r); /************************************************************** Append a .wav(NT) or .aiff(IRIX) audio file to the movie. -The lenght of the resulting movie is forced to be equal to the video track, +The length of the resulting movie is forced to be equal to the video track, so any overflowing audio is truncated. For this reason, is adviced to add the audio when the video part has been completely added. The position can be a negative value too; diff --git a/toonz/sources/include/toonzqt/doublefield.h b/toonz/sources/include/toonzqt/doublefield.h index 227a1ba..a390af3 100644 --- a/toonz/sources/include/toonzqt/doublefield.h +++ b/toonz/sources/include/toonzqt/doublefield.h @@ -184,9 +184,9 @@ public: validator minimum and maximum value. */ void getRange(double &minValue, double &maxValue) override; - /*! Set lenght of field value decimal part to \b decimals. */ + /*! Set length of field value decimal part to \b decimals. */ void setDecimals(int decimals); - /*! Return lenght of field value decimal part. */ + /*! Return length of field value decimal part. */ int getDecimals() override; }; diff --git a/toonz/sources/include/toonzqt/doublepairfield.h b/toonz/sources/include/toonzqt/doublepairfield.h index 404dbc2..9fcaf7f 100644 --- a/toonz/sources/include/toonzqt/doublepairfield.h +++ b/toonz/sources/include/toonzqt/doublepairfield.h @@ -42,7 +42,7 @@ namespace DVGui { the slider and the other pair [lebel,text field]. Object size width is not fixed, while height is equal to DVGui::WidgetHeight, 20; - labels width depend from its text lenght, text fields has fixed + labels width depend from its text length, text fields has fixed size, while slider width change in according with widget size. diff --git a/toonz/sources/include/toonzqt/intpairfield.h b/toonz/sources/include/toonzqt/intpairfield.h index e73c476..1d62613 100644 --- a/toonz/sources/include/toonzqt/intpairfield.h +++ b/toonz/sources/include/toonzqt/intpairfield.h @@ -41,7 +41,7 @@ namespace DVGui { the slider and the other pair [lebel,text field]. Object size width is not fixed, while height is equal to DVGui::WidgetHeight, 20; - labels width depend from its text lenght, text fields has fixed + labels width depend from its text length, text fields has fixed size, while slider width change in according with widget size. diff --git a/toonz/sources/sound/wav/tsio_wav.cpp b/toonz/sources/sound/wav/tsio_wav.cpp index 5521b83..51afc5e 100644 --- a/toonz/sources/sound/wav/tsio_wav.cpp +++ b/toonz/sources/sound/wav/tsio_wav.cpp @@ -337,12 +337,12 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) { if (sndtrack->getBitPerSample() == 8 && sndtrack->isSampleSigned()) throw TException("The format (8 bit signed) is incompatible with WAV file"); - TINT32 soundDataLenght = + TINT32 soundDataLength = (TINT32)(sndtrack->getSampleCount() * (sndtrack->getBitPerSample() / 8) * sndtrack->getChannelCount() /*sndtrack->getSampleSize()*/); TINT32 RIFFChunkLength = - TFMTChunk::LENGTH + TWAVChunk::HDR_LENGTH + soundDataLenght; + TFMTChunk::LENGTH + TWAVChunk::HDR_LENGTH + soundDataLength; TFileStatus fs(m_path); if (fs.doesExist() && !fs.isWritable()) @@ -363,9 +363,9 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) { fmtChunk.m_chans; // sndtrack->getSampleSize(); fmtChunk.m_bitPerSample = sndtrack->getBitPerSample(); - TDATAChunk dataChunk(soundDataLenght); + TDATAChunk dataChunk(soundDataLength); - std::unique_ptr waveData(new UCHAR[soundDataLenght]); + std::unique_ptr waveData(new UCHAR[soundDataLength]); if (!TNZ_LITTLE_ENDIAN) RIFFChunkLength = swapTINT32(RIFFChunkLength); @@ -373,7 +373,7 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) { #if (!TNZ_LITTLE_ENDIAN) { if (fmtChunk.m_bitPerSample == 8) - memcpy((void *)waveData, (void *)sndtrack->getRawData(), soundDataLenght); + memcpy((void *)waveData, (void *)sndtrack->getRawData(), soundDataLength); else if (fmtChunk.m_bitPerSample == 16) { swapAndCopySamples((short *)sndtrack->getRawData(), (short *)waveData, sndtrack->getSampleCount() * fmtChunk.m_chans); @@ -391,7 +391,7 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) { { if (fmtChunk.m_bitPerSample != 24) memcpy((void *)waveData.get(), (void *)sndtrack->getRawData(), - soundDataLenght); + soundDataLength); else { // togliere quarto byte UCHAR *begin = (UCHAR *)sndtrack->getRawData(); for (int i = 0; i < (int)sndtrack->getSampleCount() * fmtChunk.m_chans; diff --git a/toonz/sources/tnzext/CMakeLists.txt b/toonz/sources/tnzext/CMakeLists.txt index 9fd2f0d..ac82112 100644 --- a/toonz/sources/tnzext/CMakeLists.txt +++ b/toonz/sources/tnzext/CMakeLists.txt @@ -12,8 +12,8 @@ set(HEADERS ../include/ext/StrokeDeformation.h ../include/ext/StrokeDeformationImpl.h ../include/ext/LinearPotential.h - ../include/ext/NotSimmetricBezierPotential.h - ../include/ext/NotSimmetricExpPotential.h + ../include/ext/NotSymmetricBezierPotential.h + ../include/ext/NotSymmetricExpPotential.h ../include/ext/Potential.h ../include/ext/SquarePotential.h DeformationSelector.h @@ -45,8 +45,8 @@ set(SOURCES StrokeParametricDeformer.cpp Types.cpp LinearPotential.cpp - NotSimmetricBezierPotential.cpp - NotSimmetricExpPotential.cpp + NotSymmetricBezierPotential.cpp + NotSymmetricExpPotential.cpp Potential.cpp SquarePotential.cpp CornerDeformation.cpp diff --git a/toonz/sources/tnzext/CornerDeformation.cpp b/toonz/sources/tnzext/CornerDeformation.cpp index d61107a..dc33a7c 100644 --- a/toonz/sources/tnzext/CornerDeformation.cpp +++ b/toonz/sources/tnzext/CornerDeformation.cpp @@ -7,7 +7,7 @@ #include "ext/StrokeDeformation.h" #include "ext/SquarePotential.h" //#include "ext/StrokeParametricDeformer.h" -//#include "ext/NotSimmetricBezierPotential.h" +//#include "ext/NotSymmetricBezierPotential.h" #include "ext/ContextStatus.h" #include "ext/Designer.h" //#include "ext/TriParam.h" diff --git a/toonz/sources/tnzext/DraggerStatus.cpp b/toonz/sources/tnzext/DraggerStatus.cpp index 45a497c..c25cc45 100644 --- a/toonz/sources/tnzext/DraggerStatus.cpp +++ b/toonz/sources/tnzext/DraggerStatus.cpp @@ -18,13 +18,13 @@ void ToonzExt::DraggerStatus::init() { dist2_ = -1.0; n_ = -1; w_ = -1; - strokeLenght_ = -1; + strokeLength_ = -1; deformerSensibility_ = -1; stroke2change_ = 0; lengthOfAction_ = 50; deformer_ = 0; - leftActionLenght_ = -1; - rightActionLenght_ = -1; + leftActionLength_ = -1; + rightActionLength_ = -1; pixelSize_ = 1.0; cornerSize_ = 90; } diff --git a/toonz/sources/tnzext/ExtUtil.cpp b/toonz/sources/tnzext/ExtUtil.cpp index 7860e53..2828cc4 100644 --- a/toonz/sources/tnzext/ExtUtil.cpp +++ b/toonz/sources/tnzext/ExtUtil.cpp @@ -1036,7 +1036,7 @@ DVAPI bool ToonzExt::cornersDetector(const TStroke *stroke, int minDegree, assert(0.0 <= minSin && minSin <= 1.0); - // first step remove chunks with null lenght + // first step remove chunks with null length const TThickQuadratic *quad1 = 0, *quad2 = 0; diff --git a/toonz/sources/tnzext/LinearPotential.cpp b/toonz/sources/tnzext/LinearPotential.cpp index 7d7f51e..5cbce58 100644 --- a/toonz/sources/tnzext/LinearPotential.cpp +++ b/toonz/sources/tnzext/LinearPotential.cpp @@ -16,13 +16,13 @@ void ToonzExt::LinearPotential::setParameters_(const TStroke *ref, double par, actionLength_ = al; strokeLength_ = ref->getLength(); - lenghtAtParam_ = ref->getLength(par); + lengthAtParam_ = ref->getLength(par); // lunghezza dal pto di click all'inizio della curva - leftFactor_ = lenghtAtParam_; + leftFactor_ = lengthAtParam_; // lunghezza dal pto di click alla fine - rightFactor_ = strokeLength_ - lenghtAtParam_; + rightFactor_ = strokeLength_ - lengthAtParam_; // considero come intervallo di mapping [-range,range]. // 4 ha come valore c.a. 10exp-6 @@ -48,7 +48,7 @@ double ToonzExt::LinearPotential::compute_shape(double value2test) const { double x = ref_->getLength(value2test); double shape = this->actionLength_ * 0.5; if (isAlmostZero(shape)) shape = 1.0; - x = ((x - lenghtAtParam_) * range_) / shape; + x = ((x - lengthAtParam_) * range_) / shape; return x; } @@ -63,7 +63,7 @@ double ToonzExt::LinearPotential::compute_value(double value2test) const { double x = 0.0; double res = 0.0; - // lenght at parameter + // length at parameter x = ref_->getLength(value2test); double tmp_al = actionLength_ * 0.5; @@ -83,10 +83,10 @@ double ToonzExt::LinearPotential::compute_value(double value2test) const { else if (rightFactor_ == 0.0) x = (x - (strokeLength_ - tmp_al)) / tmp_al; else { - if (x <= lenghtAtParam_ && ((lenghtAtParam_ - x) <= leftFactor_)) - x = (x - (lenghtAtParam_ - leftFactor_)) / leftFactor_; - else if (x > lenghtAtParam_ && ((x - lenghtAtParam_) < rightFactor_)) - x = (rightFactor_ - (x - lenghtAtParam_)) / rightFactor_; + if (x <= lengthAtParam_ && ((lengthAtParam_ - x) <= leftFactor_)) + x = (x - (lengthAtParam_ - leftFactor_)) / leftFactor_; + else if (x > lengthAtParam_ && ((x - lengthAtParam_) < rightFactor_)) + x = (rightFactor_ - (x - lengthAtParam_)) / rightFactor_; else x = -1; } diff --git a/toonz/sources/tnzext/NotSimmetricBezierPotential.cpp b/toonz/sources/tnzext/NotSimmetricBezierPotential.cpp deleted file mode 100644 index 955c06a..0000000 --- a/toonz/sources/tnzext/NotSimmetricBezierPotential.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "ext/NotSimmetricBezierPotential.h" -#include "tstroke.h" - -#include -#include - -#include - -using namespace std; - -using namespace std; -using namespace ToonzExt; -//----------------------------------------------------------------------------- - -namespace { -typedef unary_function unary_functionDD; - -//--------------------------------------------------------------------------- - -class myBlendFunc : unary_functionDD { - // TCubic c; - TQuadratic curve; - -public: - myBlendFunc(double t = 0.0) { - curve.setP0(TPointD(0.0, 1.0)); - curve.setP1(TPointD(0.5 * (1.0 - t), 1.0)); - curve.setP2(TPointD(1.0, 0.0)); - } - - result_type operator()(argument_type x) { - result_type out = 0.0; - x = fabs(x); - if (x >= 1.0) return 0.0; - out = curve.getPoint(x).y; - return out; - } -}; -} - -//----------------------------------------------------------------------------- - -ToonzExt::NotSimmetricBezierPotential::~NotSimmetricBezierPotential() {} - -//----------------------------------------------------------------------------- - -void ToonzExt::NotSimmetricBezierPotential::setParameters_(const TStroke *ref, - double w, - double al) { - assert(ref); - ref_ = ref; - par_ = w; - actionLength_ = al; - - strokeLength_ = ref->getLength(); - lenghtAtParam_ = ref->getLength(par_); - - // lunghezza dal pto di click all'inizio della curva - leftFactor_ = min(lenghtAtParam_, - actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_; - - // lunghezza dal pto di click alla fine - rightFactor_ = min(strokeLength_ - lenghtAtParam_, actionLength_ * 0.5); -} - -//----------------------------------------------------------------------------- - -double ToonzExt::NotSimmetricBezierPotential::value_(double value2test) const { - assert(0.0 <= value2test && value2test <= 1.0); - return this->compute_value(value2test); -} - -//----------------------------------------------------------------------------- - -// normalization of parameter in range interval -double ToonzExt::NotSimmetricBezierPotential::compute_shape( - double value2test) const { - double x = ref_->getLength(value2test); - double shape = this->actionLength_ * 0.5; - if (isAlmostZero(shape)) shape = 1.0; - x = (x - lenghtAtParam_) / shape; - return x; -} - -//----------------------------------------------------------------------------- - -double ToonzExt::NotSimmetricBezierPotential::compute_value( - double value2test) const { - myBlendFunc me; - - // on extremes use - // 2 - // 1-x - // - - // when is near to extreme uses a mix notation - double x = 0.0; - double res = 0.0; - - // lenght at parameter - x = ref_->getLength(value2test); - - const double tolerance = 0.0; // need to be pixel based - - // if is an extreme - if (max(lenghtAtParam_, 0.0) < tolerance || - max(strokeLength_ - lenghtAtParam_, 0.0) < tolerance) { - double tmp_al = actionLength_ * 0.5; - - // compute correct parameter considering offset - // try to have a square curve like shape - // - // 2 - // m = x - // - if (leftFactor_ <= tolerance) - x = 1.0 - x / tmp_al; - else - x = (x - (strokeLength_ - tmp_al)) / tmp_al; - - if (x < 0.0) return 0.0; - assert(0.0 <= x && x <= 1.0 + TConsts::epsilon); - x = std::min(x, 1.0); // just to avoid problem in production code - res = sq(x); - } else // when is not an extreme - { - double lenght_at_value2test = ref_->getLength(value2test); - - const double min_level = 0.01; - // if check a parameter over click point - if (lenght_at_value2test >= lenghtAtParam_) { - // check if extreme can be moved from this parameter configuration - double tmp_x = this->compute_shape(1.0); - double tmp_res = me(tmp_x); - if (tmp_res > min_level) { - // please note that in this case - // lenghtAtParam_ + rightFactor_ == strokeLength_ - // (by ctor). - if (rightFactor_ != 0.0) - x = (lenght_at_value2test - lenghtAtParam_) / rightFactor_; - else - x = 0.0; - - assert(0.0 - TConsts::epsilon <= x && x <= 1.0 + TConsts::epsilon); - if (isAlmostZero(x)) x = 0.0; - if (areAlmostEqual(x, 1.0)) x = 1.0; - - double how_many_of_shape = - (strokeLength_ - lenghtAtParam_) / (actionLength_ * 0.5); - assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); - - myBlendFunc bf(how_many_of_shape); - - return bf(x); - } - } else { - // leftFactor_ - double tmp_x = this->compute_shape(0.0); - double tmp_res = me(tmp_x); - if (tmp_res > min_level) { - double x = lenght_at_value2test / leftFactor_; - assert(0.0 <= x && x <= 1.0); - - // then movement use another shape - double diff = x - 1.0; - - double how_many_of_shape = lenghtAtParam_ / (actionLength_ * 0.5); - assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); - - myBlendFunc bf(how_many_of_shape); - return bf(diff); - } - } - - // default behaviour is an exp - x = this->compute_shape(value2test); - res = me(x); - } - return res; -} - -//----------------------------------------------------------------------------- - -ToonzExt::Potential *ToonzExt::NotSimmetricBezierPotential::clone() { - return new NotSimmetricBezierPotential; -} - -//----------------------------------------------------------------------------- -// End Of File -//----------------------------------------------------------------------------- diff --git a/toonz/sources/tnzext/NotSimmetricExpPotential.cpp b/toonz/sources/tnzext/NotSimmetricExpPotential.cpp deleted file mode 100644 index cf24555..0000000 --- a/toonz/sources/tnzext/NotSimmetricExpPotential.cpp +++ /dev/null @@ -1,228 +0,0 @@ - - -#include "ext/NotSimmetricExpPotential.h" - -#include -#include - -using namespace std; - -//----------------------------------------------------------------------------- - -namespace { -typedef unary_function unary_functionDD; - -//--------------------------------------------------------------------------- - -class mySqr : unary_functionDD { -public: - result_type operator()(argument_type x) { return 1.0 - sq(x); } -}; - -//--------------------------------------------------------------------------- - -class myExp : unary_functionDD { -public: - result_type operator()(argument_type x) { return exp(-sq(x)); } -}; - -//--------------------------------------------------------------------------- -struct blender { - double operator()(double a, double b, double t) { - assert(0.0 <= t && t <= 1.0); - - return (a * (1.0 - t) + b * t); - } -}; - -//--------------------------------------------------------------------------- - -struct blender_2 { - double operator()(double a, double b, double t) { - assert(0.0 <= t && t <= 1.0); - - // a(1-t)^2 + 2t*(1-t) + t^2 - double one_t = 1.0 - t; - double num = 3.0; - double den = 4.0; - // solution of a(1-t)^2 + P*2t(1-t) + b*t^2 = (a+b)/2 - // with t = num/den - double middle = - sq(den) / (2.0 * num) * ((a + b) * 0.5 - (a + sq(num) * b) / sq(den)); - - return a * sq(one_t) + middle * t * one_t + b * sq(t); - } -}; -} - -//----------------------------------------------------------------------------- - -void ToonzExt::NotSimmetricExpPotential::setParameters_(const TStroke *ref, - double par, double al) { - ref_ = ref; - par_ = par; - actionLength_ = al; - - assert(ref_); - - strokeLength_ = ref->getLength(); - lenghtAtParam_ = ref->getLength(par); - - // lunghezza dal pto di click all'inizio della curva - leftFactor_ = min(lenghtAtParam_, - actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_; - - // lunghezza dal pto di click alla fine - rightFactor_ = min(strokeLength_ - lenghtAtParam_, actionLength_ * 0.5); - - // considero come intervallo di mapping [-range,range]. - // 4 ha come valore c.a. 10exp-6 - // cioé sposterei un pixel su un movimento di un milione di pixel - range_ = 2.8; -} - -//----------------------------------------------------------------------------- - -ToonzExt::NotSimmetricExpPotential::~NotSimmetricExpPotential() {} - -//----------------------------------------------------------------------------- - -double ToonzExt::NotSimmetricExpPotential::value_(double value2test) const { - assert(0.0 <= value2test && value2test <= 1.0); - return this->compute_value(value2test); -} - -//----------------------------------------------------------------------------- - -// normalization of parameter in range interval -double ToonzExt::NotSimmetricExpPotential::compute_shape( - double value2test) const { - double x = ref_->getLength(value2test); - double shape = this->actionLength_ * 0.5; - if (isAlmostZero(shape)) shape = 1.0; - x = ((x - lenghtAtParam_) * range_) / shape; - return x; -} - -//----------------------------------------------------------------------------- - -double ToonzExt::NotSimmetricExpPotential::compute_value( - double value2test) const { - myExp me; - mySqr ms; - blender op; - - // usually use the form below - // ( ) 2 - // ( (x - l)*range_ ) - // - (--------------- ) - // ( factor ) - // l,r - // e - // - // where factor is computed like in constructor - - // on extremes use - // 2 - // 1-x - // - - // when is near to extreme uses a mix notation - double x = 0.0; - double res = 0.0; - - // lenght at parameter - x = ref_->getLength(value2test); - - const double tolerance = 2.0; // need to be pixel based - // if is an extreme - if (max(lenghtAtParam_, 0.0) < tolerance || - max(strokeLength_ - lenghtAtParam_, 0.0) < tolerance) { - double tmp_al = actionLength_ * 0.5; - - // compute correct parameter considering offset - // try to have a square curve like shape - // - // 2 - // m = x - // - if (leftFactor_ <= tolerance) - x = 1.0 - x / tmp_al; - else - x = (x - (strokeLength_ - tmp_al)) / tmp_al; - - if (x < 0.0) return 0.0; - assert(0.0 <= x && x <= 1.0 + TConsts::epsilon); - res = sq(x); - } else // when is not an extreme - { - double lenght_at_value2test = ref_->getLength(value2test); - - const double min_level = 0.01; - // if check a parameter over click point - if (lenght_at_value2test >= lenghtAtParam_) { - // check if extreme can be moved from this parameter configuration - double tmp_x = this->compute_shape(1.0); - double tmp_res = me(tmp_x); - if (tmp_res > min_level) { - // please note that in this case - // lenghtAtParam_ + rightFactor_ == strokeLength_ - // (by ctor). - x = (lenght_at_value2test - lenghtAtParam_) / rightFactor_; - assert(0.0 <= x && x <= 1.0); - - // then movement use another shape - double exp_val = me(x * range_); - - double how_many_of_shape = - (strokeLength_ - lenghtAtParam_) / (actionLength_ * 0.5); - assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); - - // return ms(x); - return op(ms(x), exp_val, how_many_of_shape); - } - } else { - // leftFactor_ - double tmp_x = this->compute_shape(0.0); - double tmp_res = me(tmp_x); - if (tmp_res > min_level) { - double x = lenght_at_value2test / leftFactor_; - assert(0.0 <= x && x <= 1.0); - - // then movement use another shape - double diff = x - 1.0; - double exp_val = me(diff * range_); - double how_many_of_shape = lenghtAtParam_ / (actionLength_ * 0.5); - assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); - - // return ms(diff); - return op(ms(diff), exp_val, how_many_of_shape); - } - } - - // default behaviour is an exp - x = this->compute_shape(value2test); - res = me(x); - } - return res; -} - -//----------------------------------------------------------------------------- - -ToonzExt::Potential *ToonzExt::NotSimmetricExpPotential::clone() { - return new NotSimmetricExpPotential; -} - -// DEL double ToonzExt::NotSimmetricExpPotential::gradient(double value2test) -// const -// DEL { -// DEL assert(false); -// DEL //double x = this->compute_shape(value2test); -// DEL //double res = -(2.0*range_) / actionLength_ * x * exp(-sq(x)); -// DEL //return res; -// DEL return 0; -// DEL } - -//----------------------------------------------------------------------------- -// End Of File -//----------------------------------------------------------------------------- diff --git a/toonz/sources/tnzext/NotSymmetricBezierPotential.cpp b/toonz/sources/tnzext/NotSymmetricBezierPotential.cpp new file mode 100644 index 0000000..c8ff384 --- /dev/null +++ b/toonz/sources/tnzext/NotSymmetricBezierPotential.cpp @@ -0,0 +1,190 @@ +#include "ext/NotSymmetricBezierPotential.h" +#include "tstroke.h" + +#include +#include + +#include + +using namespace std; + +using namespace std; +using namespace ToonzExt; +//----------------------------------------------------------------------------- + +namespace { +typedef unary_function unary_functionDD; + +//--------------------------------------------------------------------------- + +class myBlendFunc : unary_functionDD { + // TCubic c; + TQuadratic curve; + +public: + myBlendFunc(double t = 0.0) { + curve.setP0(TPointD(0.0, 1.0)); + curve.setP1(TPointD(0.5 * (1.0 - t), 1.0)); + curve.setP2(TPointD(1.0, 0.0)); + } + + result_type operator()(argument_type x) { + result_type out = 0.0; + x = fabs(x); + if (x >= 1.0) return 0.0; + out = curve.getPoint(x).y; + return out; + } +}; +} + +//----------------------------------------------------------------------------- + +ToonzExt::NotSymmetricBezierPotential::~NotSymmetricBezierPotential() {} + +//----------------------------------------------------------------------------- + +void ToonzExt::NotSymmetricBezierPotential::setParameters_(const TStroke *ref, + double w, + double al) { + assert(ref); + ref_ = ref; + par_ = w; + actionLength_ = al; + + strokeLength_ = ref->getLength(); + lengthAtParam_ = ref->getLength(par_); + + // lunghezza dal pto di click all'inizio della curva + leftFactor_ = min(lengthAtParam_, + actionLength_ * 0.5); // lengthAtParam_ / strokeLength_; + + // lunghezza dal pto di click alla fine + rightFactor_ = min(strokeLength_ - lengthAtParam_, actionLength_ * 0.5); +} + +//----------------------------------------------------------------------------- + +double ToonzExt::NotSymmetricBezierPotential::value_(double value2test) const { + assert(0.0 <= value2test && value2test <= 1.0); + return this->compute_value(value2test); +} + +//----------------------------------------------------------------------------- + +// normalization of parameter in range interval +double ToonzExt::NotSymmetricBezierPotential::compute_shape( + double value2test) const { + double x = ref_->getLength(value2test); + double shape = this->actionLength_ * 0.5; + if (isAlmostZero(shape)) shape = 1.0; + x = (x - lengthAtParam_) / shape; + return x; +} + +//----------------------------------------------------------------------------- + +double ToonzExt::NotSymmetricBezierPotential::compute_value( + double value2test) const { + myBlendFunc me; + + // on extremes use + // 2 + // 1-x + // + + // when is near to extreme uses a mix notation + double x = 0.0; + double res = 0.0; + + // length at parameter + x = ref_->getLength(value2test); + + const double tolerance = 0.0; // need to be pixel based + + // if is an extreme + if (max(lengthAtParam_, 0.0) < tolerance || + max(strokeLength_ - lengthAtParam_, 0.0) < tolerance) { + double tmp_al = actionLength_ * 0.5; + + // compute correct parameter considering offset + // try to have a square curve like shape + // + // 2 + // m = x + // + if (leftFactor_ <= tolerance) + x = 1.0 - x / tmp_al; + else + x = (x - (strokeLength_ - tmp_al)) / tmp_al; + + if (x < 0.0) return 0.0; + assert(0.0 <= x && x <= 1.0 + TConsts::epsilon); + x = std::min(x, 1.0); // just to avoid problem in production code + res = sq(x); + } else // when is not an extreme + { + double length_at_value2test = ref_->getLength(value2test); + + const double min_level = 0.01; + // if check a parameter over click point + if (length_at_value2test >= lengthAtParam_) { + // check if extreme can be moved from this parameter configuration + double tmp_x = this->compute_shape(1.0); + double tmp_res = me(tmp_x); + if (tmp_res > min_level) { + // please note that in this case + // lengthAtParam_ + rightFactor_ == strokeLength_ + // (by ctor). + if (rightFactor_ != 0.0) + x = (length_at_value2test - lengthAtParam_) / rightFactor_; + else + x = 0.0; + + assert(0.0 - TConsts::epsilon <= x && x <= 1.0 + TConsts::epsilon); + if (isAlmostZero(x)) x = 0.0; + if (areAlmostEqual(x, 1.0)) x = 1.0; + + double how_many_of_shape = + (strokeLength_ - lengthAtParam_) / (actionLength_ * 0.5); + assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); + + myBlendFunc bf(how_many_of_shape); + + return bf(x); + } + } else { + // leftFactor_ + double tmp_x = this->compute_shape(0.0); + double tmp_res = me(tmp_x); + if (tmp_res > min_level) { + double x = length_at_value2test / leftFactor_; + assert(0.0 <= x && x <= 1.0); + + // then movement use another shape + double diff = x - 1.0; + + double how_many_of_shape = lengthAtParam_ / (actionLength_ * 0.5); + assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); + + myBlendFunc bf(how_many_of_shape); + return bf(diff); + } + } + + // default behaviour is an exp + x = this->compute_shape(value2test); + res = me(x); + } + return res; +} + +//----------------------------------------------------------------------------- + +ToonzExt::Potential *ToonzExt::NotSymmetricBezierPotential::clone() { + return new NotSymmetricBezierPotential; +} + +//----------------------------------------------------------------------------- +// End Of File +//----------------------------------------------------------------------------- diff --git a/toonz/sources/tnzext/NotSymmetricExpPotential.cpp b/toonz/sources/tnzext/NotSymmetricExpPotential.cpp new file mode 100644 index 0000000..7237573 --- /dev/null +++ b/toonz/sources/tnzext/NotSymmetricExpPotential.cpp @@ -0,0 +1,228 @@ + + +#include "ext/NotSymmetricExpPotential.h" + +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- + +namespace { +typedef unary_function unary_functionDD; + +//--------------------------------------------------------------------------- + +class mySqr : unary_functionDD { +public: + result_type operator()(argument_type x) { return 1.0 - sq(x); } +}; + +//--------------------------------------------------------------------------- + +class myExp : unary_functionDD { +public: + result_type operator()(argument_type x) { return exp(-sq(x)); } +}; + +//--------------------------------------------------------------------------- +struct blender { + double operator()(double a, double b, double t) { + assert(0.0 <= t && t <= 1.0); + + return (a * (1.0 - t) + b * t); + } +}; + +//--------------------------------------------------------------------------- + +struct blender_2 { + double operator()(double a, double b, double t) { + assert(0.0 <= t && t <= 1.0); + + // a(1-t)^2 + 2t*(1-t) + t^2 + double one_t = 1.0 - t; + double num = 3.0; + double den = 4.0; + // solution of a(1-t)^2 + P*2t(1-t) + b*t^2 = (a+b)/2 + // with t = num/den + double middle = + sq(den) / (2.0 * num) * ((a + b) * 0.5 - (a + sq(num) * b) / sq(den)); + + return a * sq(one_t) + middle * t * one_t + b * sq(t); + } +}; +} + +//----------------------------------------------------------------------------- + +void ToonzExt::NotSymmetricExpPotential::setParameters_(const TStroke *ref, + double par, double al) { + ref_ = ref; + par_ = par; + actionLength_ = al; + + assert(ref_); + + strokeLength_ = ref->getLength(); + lengthAtParam_ = ref->getLength(par); + + // lunghezza dal pto di click all'inizio della curva + leftFactor_ = min(lengthAtParam_, + actionLength_ * 0.5); // lengthAtParam_ / strokeLength_; + + // lunghezza dal pto di click alla fine + rightFactor_ = min(strokeLength_ - lengthAtParam_, actionLength_ * 0.5); + + // considero come intervallo di mapping [-range,range]. + // 4 ha come valore c.a. 10exp-6 + // cioé sposterei un pixel su un movimento di un milione di pixel + range_ = 2.8; +} + +//----------------------------------------------------------------------------- + +ToonzExt::NotSymmetricExpPotential::~NotSymmetricExpPotential() {} + +//----------------------------------------------------------------------------- + +double ToonzExt::NotSymmetricExpPotential::value_(double value2test) const { + assert(0.0 <= value2test && value2test <= 1.0); + return this->compute_value(value2test); +} + +//----------------------------------------------------------------------------- + +// normalization of parameter in range interval +double ToonzExt::NotSymmetricExpPotential::compute_shape( + double value2test) const { + double x = ref_->getLength(value2test); + double shape = this->actionLength_ * 0.5; + if (isAlmostZero(shape)) shape = 1.0; + x = ((x - lengthAtParam_) * range_) / shape; + return x; +} + +//----------------------------------------------------------------------------- + +double ToonzExt::NotSymmetricExpPotential::compute_value( + double value2test) const { + myExp me; + mySqr ms; + blender op; + + // usually use the form below + // ( ) 2 + // ( (x - l)*range_ ) + // - (--------------- ) + // ( factor ) + // l,r + // e + // + // where factor is computed like in constructor + + // on extremes use + // 2 + // 1-x + // + + // when is near to extreme uses a mix notation + double x = 0.0; + double res = 0.0; + + // length at parameter + x = ref_->getLength(value2test); + + const double tolerance = 2.0; // need to be pixel based + // if is an extreme + if (max(lengthAtParam_, 0.0) < tolerance || + max(strokeLength_ - lengthAtParam_, 0.0) < tolerance) { + double tmp_al = actionLength_ * 0.5; + + // compute correct parameter considering offset + // try to have a square curve like shape + // + // 2 + // m = x + // + if (leftFactor_ <= tolerance) + x = 1.0 - x / tmp_al; + else + x = (x - (strokeLength_ - tmp_al)) / tmp_al; + + if (x < 0.0) return 0.0; + assert(0.0 <= x && x <= 1.0 + TConsts::epsilon); + res = sq(x); + } else // when is not an extreme + { + double length_at_value2test = ref_->getLength(value2test); + + const double min_level = 0.01; + // if check a parameter over click point + if (length_at_value2test >= lengthAtParam_) { + // check if extreme can be moved from this parameter configuration + double tmp_x = this->compute_shape(1.0); + double tmp_res = me(tmp_x); + if (tmp_res > min_level) { + // please note that in this case + // lengthAtParam_ + rightFactor_ == strokeLength_ + // (by ctor). + x = (length_at_value2test - lengthAtParam_) / rightFactor_; + assert(0.0 <= x && x <= 1.0); + + // then movement use another shape + double exp_val = me(x * range_); + + double how_many_of_shape = + (strokeLength_ - lengthAtParam_) / (actionLength_ * 0.5); + assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); + + // return ms(x); + return op(ms(x), exp_val, how_many_of_shape); + } + } else { + // leftFactor_ + double tmp_x = this->compute_shape(0.0); + double tmp_res = me(tmp_x); + if (tmp_res > min_level) { + double x = length_at_value2test / leftFactor_; + assert(0.0 <= x && x <= 1.0); + + // then movement use another shape + double diff = x - 1.0; + double exp_val = me(diff * range_); + double how_many_of_shape = lengthAtParam_ / (actionLength_ * 0.5); + assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0); + + // return ms(diff); + return op(ms(diff), exp_val, how_many_of_shape); + } + } + + // default behaviour is an exp + x = this->compute_shape(value2test); + res = me(x); + } + return res; +} + +//----------------------------------------------------------------------------- + +ToonzExt::Potential *ToonzExt::NotSymmetricExpPotential::clone() { + return new NotSymmetricExpPotential; +} + +// DEL double ToonzExt::NotSymmetricExpPotential::gradient(double value2test) +// const +// DEL { +// DEL assert(false); +// DEL //double x = this->compute_shape(value2test); +// DEL //double res = -(2.0*range_) / actionLength_ * x * exp(-sq(x)); +// DEL //return res; +// DEL return 0; +// DEL } + +//----------------------------------------------------------------------------- +// End Of File +//----------------------------------------------------------------------------- diff --git a/toonz/sources/tnzext/SmoothDeformation.cpp b/toonz/sources/tnzext/SmoothDeformation.cpp index 73a656d..75f89ba 100644 --- a/toonz/sources/tnzext/SmoothDeformation.cpp +++ b/toonz/sources/tnzext/SmoothDeformation.cpp @@ -7,7 +7,7 @@ #include "ext/StrokeDeformation.h" //#include "ext/SquarePotential.h" //#include "ext/StrokeParametricDeformer.h" -#include "ext/NotSimmetricBezierPotential.h" +#include "ext/NotSymmetricBezierPotential.h" #include "ext/ContextStatus.h" #include "ext/Designer.h" //#include "ext/TriParam.h" @@ -31,7 +31,7 @@ REGISTER(SmoothDeformation, 1); //----------------------------------------------------------------------------- SmoothDeformation::SmoothDeformation() { - setPotential(new NotSimmetricBezierPotential); + setPotential(new NotSymmetricBezierPotential); shortcutKey_ = ContextStatus::ALT; } diff --git a/toonz/sources/tnzext/SquarePotential.cpp b/toonz/sources/tnzext/SquarePotential.cpp index 8440576..558b4e1 100644 --- a/toonz/sources/tnzext/SquarePotential.cpp +++ b/toonz/sources/tnzext/SquarePotential.cpp @@ -16,14 +16,14 @@ void ToonzExt::SquarePotential::setParameters_(const TStroke *ref, double par, assert(ref_); strokeLength_ = ref->getLength(); - lenghtAtParam_ = ref->getLength(par); + lengthAtParam_ = ref->getLength(par); // lunghezza dal pto di click all'inizio della curva - leftFactor_ = min(lenghtAtParam_, - actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_; + leftFactor_ = min(lengthAtParam_, + actionLength_ * 0.5); // lengthAtParam_ / strokeLength_; // lunghezza dal pto di click alla fine - rightFactor_ = min(strokeLength_ - lenghtAtParam_, actionLength_ * 0.5); + rightFactor_ = min(strokeLength_ - lengthAtParam_, actionLength_ * 0.5); // considero come intervallo di mapping [-range,range]. // 4 ha come valore c.a. 10exp-6 @@ -48,7 +48,7 @@ double ToonzExt::SquarePotential::compute_shape(double value2test) const { double x = ref_->getLength(value2test); double shape = this->actionLength_ * 0.5; if (isAlmostZero(shape)) shape = 1.0; - x = ((x - lenghtAtParam_) * range_) / shape; + x = ((x - lengthAtParam_) * range_) / shape; return x; } @@ -63,7 +63,7 @@ double ToonzExt::SquarePotential::compute_value(double value2test) const { double x = 0.0; double res = 0.0; - // lenght at parameter + // length at parameter x = ref_->getLength(value2test); double tmp_al = actionLength_ * 0.5; @@ -79,10 +79,10 @@ double ToonzExt::SquarePotential::compute_value(double value2test) const { else if (rightFactor_ == 0.0) x = (x - (strokeLength_ - tmp_al)) / tmp_al; else { - if (x <= lenghtAtParam_ && ((lenghtAtParam_ - x) <= leftFactor_)) - x = (x - (lenghtAtParam_ - leftFactor_)) / leftFactor_; - else if (x > lenghtAtParam_ && ((x - lenghtAtParam_) < rightFactor_)) - x = (rightFactor_ - (x - lenghtAtParam_)) / rightFactor_; + if (x <= lengthAtParam_ && ((lengthAtParam_ - x) <= leftFactor_)) + x = (x - (lengthAtParam_ - leftFactor_)) / leftFactor_; + else if (x > lengthAtParam_ && ((x - lengthAtParam_) < rightFactor_)) + x = (rightFactor_ - (x - lengthAtParam_)) / rightFactor_; else x = -1; } diff --git a/toonz/sources/tnzext/StraightCornerDeformation.cpp b/toonz/sources/tnzext/StraightCornerDeformation.cpp index 469cc3e..6b9862b 100644 --- a/toonz/sources/tnzext/StraightCornerDeformation.cpp +++ b/toonz/sources/tnzext/StraightCornerDeformation.cpp @@ -7,7 +7,7 @@ #include "ext/StrokeDeformation.h" #include "ext/LinearPotential.h" //#include "ext/StrokeParametricDeformer.h" -//#include "ext/NotSimmetricBezierPotential.h" +//#include "ext/NotSymmetricBezierPotential.h" #include "ext/ContextStatus.h" #include "ext/Designer.h" //#include "ext/TriParam.h" diff --git a/toonz/sources/tnzext/StrokeDeformation.cpp b/toonz/sources/tnzext/StrokeDeformation.cpp index daab9aa..e88bb11 100644 --- a/toonz/sources/tnzext/StrokeDeformation.cpp +++ b/toonz/sources/tnzext/StrokeDeformation.cpp @@ -10,7 +10,7 @@ #include "ext/StrokeDeformation.h" #include "ext/SquarePotential.h" #include "ext/StrokeParametricDeformer.h" -#include "ext/NotSimmetricBezierPotential.h" +#include "ext/NotSymmetricBezierPotential.h" #include "ext/SmoothDeformation.h" #include "ext/ContextStatus.h" #include "ext/Designer.h" diff --git a/toonz/sources/tnzext/StrokeDeformationImpl.cpp b/toonz/sources/tnzext/StrokeDeformationImpl.cpp index 969c1ba..e520365 100644 --- a/toonz/sources/tnzext/StrokeDeformationImpl.cpp +++ b/toonz/sources/tnzext/StrokeDeformationImpl.cpp @@ -11,7 +11,7 @@ #include "ext/StrokeDeformation.h" #include "ext/SquarePotential.h" #include "ext/StrokeParametricDeformer.h" -//#include "ext/NotSimmetricBezierPotential.h" +//#include "ext/NotSymmetricBezierPotential.h" #include "ext/ContextStatus.h" #include "ext/Designer.h" //#include "ext/TriParam.h" diff --git a/toonz/sources/tnzext/StrokeParametricDeformer.cpp b/toonz/sources/tnzext/StrokeParametricDeformer.cpp index b6363a5..1a0e455 100644 --- a/toonz/sources/tnzext/StrokeParametricDeformer.cpp +++ b/toonz/sources/tnzext/StrokeParametricDeformer.cpp @@ -5,8 +5,8 @@ */ #include "ext/StrokeParametricDeformer.h" -#include "ext/NotSimmetricExpPotential.h" -//#include "ext/NotSimmetricBezierPotential.h" +#include "ext/NotSymmetricExpPotential.h" +//#include "ext/NotSymmetricBezierPotential.h" //#include "ext/SquarePotential.h" #include @@ -18,9 +18,9 @@ using namespace std; //----------------------------------------------------------------------------- ToonzExt::StrokeParametricDeformer::StrokeParametricDeformer( - double actionLenght, double startParameter, TStroke *s, Potential *pot) + double actionLength, double startParameter, TStroke *s, Potential *pot) : startParameter_(startParameter) - , actionLenght_(actionLenght) + , actionLength_(actionLength) , vx_(1.0) , vy_(1.0) , pot_(0) { @@ -37,28 +37,28 @@ ToonzExt::StrokeParametricDeformer::StrokeParametricDeformer( // double // max_length = s->getLength(); - // if( actionLenght == -1 ) + // if( actionLength == -1 ) // { // assert(false && "Rispristina la vecchia gestione"); - // actionLenght_ = 2.0 * max_length; + // actionLength_ = 2.0 * max_length; // } // else // { - assert(0.0 <= actionLenght_); - // && actionLenght_ <= max_length ); + assert(0.0 <= actionLength_); + // && actionLength_ <= max_length ); - if (0.0 > actionLenght_) actionLenght_ = 0.0; - // else if ( actionLenght_ > max_length ) - // actionLenght_ = max_length; + if (0.0 > actionLength_) actionLength_ = 0.0; + // else if ( actionLength_ > max_length ) + // actionLength_ = max_length; //} pot_ = pot; if (!pot_) throw std::invalid_argument("Not Possible to have a ref of Potential!!!"); - pot_->setParameters(ref_copy_, startParameter_, actionLenght_); + pot_->setParameters(ref_copy_, startParameter_, actionLength_); assert(pot_); - startLenght_ = startParameter_; + startLength_ = startParameter_; } //----------------------------------------------------------------------------- @@ -157,13 +157,13 @@ double ToonzExt::StrokeParametricDeformer::getMaxDiff() const { return diff_; } void ToonzExt::StrokeParametricDeformer::getRange(double &from, double &to) { double x = ref_copy_->getLength(startParameter_); - double delta = x - actionLenght_ * 0.5; + double delta = x - actionLength_ * 0.5; if (delta > 0) from = ref_copy_->getParameterAtLength(delta); else from = 0.0; - delta = x + actionLenght_ * 0.5; + delta = x + actionLength_ * 0.5; if (delta < ref_copy_->getLength()) to = ref_copy_->getParameterAtLength(delta); else diff --git a/toonz/sources/tnztools/bendertool.cpp b/toonz/sources/tnztools/bendertool.cpp index b98ef9f..8d67966 100644 --- a/toonz/sources/tnztools/bendertool.cpp +++ b/toonz/sources/tnztools/bendertool.cpp @@ -21,7 +21,7 @@ namespace { const UINT MAX_SAMPLE = 2; const int MY_ERROR = -1; -const double c_LenghtOfBenderRegion = 10.0; +const double c_LengthOfBenderRegion = 10.0; const int IS_BEGIN = 0; const int IS_END = 1; diff --git a/toonz/sources/tnztools/selectiontool.cpp b/toonz/sources/tnztools/selectiontool.cpp index d1758ba..406e8ca 100644 --- a/toonz/sources/tnztools/selectiontool.cpp +++ b/toonz/sources/tnztools/selectiontool.cpp @@ -375,7 +375,7 @@ DragSelectionTool::DeformTool::DeformTool(SelectionTool *tool) //----------------------------------------------------------------------------- -int DragSelectionTool::DeformTool::getSimmetricPointIndex(int index) const { +int DragSelectionTool::DeformTool::getSymmetricPointIndex(int index) const { if (index == 0 || index == 4 || index == 1 || index == 5) return index + 2; return index - 2; } @@ -648,14 +648,14 @@ TPointD DragSelectionTool::Scale::computeScaleValue(int movedIndex, else return TPointD(scale2.x, scale1.y); } - int simmetricIndex = m_deformTool->getSimmetricPointIndex(movedIndex); - TPointD s = m_startBboxs[0].getPoint(simmetricIndex); + int symmetricIndex = m_deformTool->getSymmetricPointIndex(movedIndex); + TPointD s = m_startBboxs[0].getPoint(symmetricIndex); TPointD center = m_scaleInCenter ? m_startCenter : s; TPointD nearP = m_startBboxs[0].getPoint(m_deformTool->getBeforePointIndex(movedIndex)); TPointD pc = getIntersectionPoint(nearP, p, p, s, center); TPointD newp = newBbox.getPoint(movedIndex); - TPointD news = newBbox.getPoint(simmetricIndex); + TPointD news = newBbox.getPoint(symmetricIndex); TPointD newNearP = newBbox.getPoint(m_deformTool->getBeforePointIndex(movedIndex)); TPointD newpc = getIntersectionPoint(newNearP, newp, newp, news, center); @@ -690,8 +690,8 @@ TPointD DragSelectionTool::Scale::getScaledPoint(int index, const TPointD scaleValue, const TPointD center) { TPointD p = oldBbox.getPoint(index); - int simmetricIndex = m_deformTool->getSimmetricPointIndex(index); - TPointD s = oldBbox.getPoint(simmetricIndex); + int symmetricIndex = m_deformTool->getSymmetricPointIndex(index); + TPointD s = oldBbox.getPoint(symmetricIndex); if (index < 4) { int beforeIndex = m_deformTool->getBeforePointIndex(index); int nextIndex = m_deformTool->getNextPointIndex(index); @@ -704,7 +704,7 @@ TPointD DragSelectionTool::Scale::getScaledPoint(int index, } TPointD nearP = oldBbox.getPoint(m_deformTool->getBeforePointIndex(index)); TPointD nearS = - oldBbox.getPoint(m_deformTool->getBeforePointIndex(simmetricIndex)); + oldBbox.getPoint(m_deformTool->getBeforePointIndex(symmetricIndex)); TPointD pc = getIntersectionPoint(nearP, p, p, s, center); TPointD sc = getIntersectionPoint(nearS, s, p, s, center); if (center == pc) return pc; @@ -735,11 +735,11 @@ TPointD DragSelectionTool::Scale::getNewCenter(int index, const FourPoints bbox, FourPoints xBbox = bboxScale(xIndex, bbox, m_startCenter); TPointD xCenter = getScaledPoint( xIndex, xBbox, scaleValue, - xBbox.getPoint(m_deformTool->getSimmetricPointIndex(xIndex))); + xBbox.getPoint(m_deformTool->getSymmetricPointIndex(xIndex))); FourPoints yBbox = bboxScale(yIndex, bbox, m_startCenter); TPointD yCenter = getScaledPoint( yIndex, yBbox, scaleValue, - yBbox.getPoint(m_deformTool->getSimmetricPointIndex(yIndex))); + yBbox.getPoint(m_deformTool->getSymmetricPointIndex(yIndex))); TPointD in = getIntersectionPoint(bbox.getP00(), bbox.getP10(), bbox.getP10(), bbox.getP11(), xCenter); return getIntersectionPoint(in, xCenter, bbox.getP00(), bbox.getP10(), @@ -758,19 +758,19 @@ FourPoints DragSelectionTool::Scale::bboxScaleInCenter( FourPoints bbox = bboxScale(index, oldBbox, newPos); if (recomputeScaleValue) scaleValue = computeScaleValue(index, bbox); if (!m_scaleInCenter) return bbox; - int simmetricIndex = m_deformTool->getSimmetricPointIndex(index); + int symmetricIndex = m_deformTool->getSymmetricPointIndex(index); // Gestisco il caso particolare in cui uno dei fattori di scalatura e' -100% e // center e' al centro della bbox - if (bbox.getPoint(index) == oldBbox.getPoint(simmetricIndex)) { - bbox.setPoint(simmetricIndex, oldBbox.getPoint(index)); - bbox.setPoint(m_deformTool->getNextPointIndex(simmetricIndex), + if (bbox.getPoint(index) == oldBbox.getPoint(symmetricIndex)) { + bbox.setPoint(symmetricIndex, oldBbox.getPoint(index)); + bbox.setPoint(m_deformTool->getNextPointIndex(symmetricIndex), oldBbox.getPoint(m_deformTool->getBeforePointIndex(index))); - bbox.setPoint(m_deformTool->getBeforePointIndex(simmetricIndex), + bbox.setPoint(m_deformTool->getBeforePointIndex(symmetricIndex), oldBbox.getPoint(m_deformTool->getNextPointIndex(index))); } else bbox = - bboxScale(simmetricIndex, bbox, - getScaledPoint(simmetricIndex, oldBbox, scaleValue, center)); + bboxScale(symmetricIndex, bbox, + getScaledPoint(symmetricIndex, oldBbox, scaleValue, center)); return bbox; } @@ -806,9 +806,9 @@ void DragSelectionTool::Scale::leftButtonDrag(const TPointD &pos, delta = pos - m_deformTool->getCurPos(); else delta = pos - m_deformTool->getStartPos(); - int simmetricIndex = m_deformTool->getSimmetricPointIndex(selectedIndex); - TPointD simmetricPoint = tool->getBBox().getPoint(simmetricIndex); - TPointD v = normalize(point - simmetricPoint); + int symmetricIndex = m_deformTool->getSymmetricPointIndex(selectedIndex); + TPointD symmetricPoint = tool->getBBox().getPoint(symmetricIndex); + TPointD v = normalize(point - symmetricPoint); delta = v * (v * delta); newPos = point + delta; } diff --git a/toonz/sources/tnztools/selectiontool.h b/toonz/sources/tnztools/selectiontool.h index 1907dc1..0775533 100644 --- a/toonz/sources/tnztools/selectiontool.h +++ b/toonz/sources/tnztools/selectiontool.h @@ -182,7 +182,7 @@ public: void addTransformUndo() override = 0; - int getSimmetricPointIndex(int index) const; + int getSymmetricPointIndex(int index) const; /*! Return before point \b index between possible point index * {0,4,1,5,2,6,3,7}, include middle point. */ int getBeforePointIndex(int index) const; @@ -287,7 +287,7 @@ straight line for TPointD getNewCenter(int index, const FourPoints bbox, const TPointD scaleValue); /*! Scale \b bbox \b index point in pos and if \b m_scaleInCenter is true -scale in \b center \b bbox simmetric point; +scale in \b center \b bbox symmetric point; compute scaleValue. */ FourPoints bboxScaleInCenter(int index, const FourPoints &oldBbox, const TPointD newPos, TPointD &scaleValue, diff --git a/toonz/sources/tnztools/vectorselectiontool.cpp b/toonz/sources/tnztools/vectorselectiontool.cpp index 18dc880..6e64af6 100644 --- a/toonz/sources/tnztools/vectorselectiontool.cpp +++ b/toonz/sources/tnztools/vectorselectiontool.cpp @@ -841,7 +841,7 @@ TPointD DragSelectionTool::VectorScaleTool::transform(int index, FourPoints oldBbox = startBboxs[i]; TPointD frameCenter = scaleInCenter ? center - : oldBbox.getPoint(getSimmetricPointIndex(index)); + : oldBbox.getPoint(getSymmetricPointIndex(index)); TPointD newp = m_scale->getScaledPoint(index, oldBbox, scaleValue, frameCenter); FourPoints newBbox = m_scale->bboxScaleInCenter( diff --git a/toonz/sources/toonz/dvitemview.cpp b/toonz/sources/toonz/dvitemview.cpp index 5c7e0f6..ad6d955 100644 --- a/toonz/sources/toonz/dvitemview.cpp +++ b/toonz/sources/toonz/dvitemview.cpp @@ -456,9 +456,9 @@ bool ItemViewPlayWidget::PlayManager::isFrameIndexInRange() { //----------------------------------------------------------------------------- bool ItemViewPlayWidget::PlayManager::setCurrentFrameIndexFromXValue( - int xValue, int lenght) { + int xValue, int length) { if (m_fids.size() == 0) return false; - double d = (double)lenght / (double)(m_fids.size() - 1); + double d = (double)length / (double)(m_fids.size() - 1); int newIndex = tround((double)xValue / d); if (newIndex == m_currentFidIndex) return false; m_currentFidIndex = newIndex; @@ -468,9 +468,9 @@ bool ItemViewPlayWidget::PlayManager::setCurrentFrameIndexFromXValue( //----------------------------------------------------------------------------- -double ItemViewPlayWidget::PlayManager::currentFrameIndexToXValue(int lenght) { +double ItemViewPlayWidget::PlayManager::currentFrameIndexToXValue(int length) { if (m_fids.size() == 0) return false; - double d = (double)lenght / (double)(m_fids.size() - 1); + double d = (double)length / (double)(m_fids.size() - 1); return d * m_currentFidIndex; } @@ -536,23 +536,23 @@ void ItemViewPlayWidget::setIsPlaying(DvItemListModel *model, int index) { void ItemViewPlayWidget::setIsPlayingCurrentFrameIndex(DvItemListModel *model, int index, int xValue, - int lenght) { + int length) { m_isSliderMode = true; if (m_currentItemIndex == -1) { m_currentItemIndex = index; m_playManager->setInfo(model, index); } - if (!m_playManager->setCurrentFrameIndexFromXValue(xValue, lenght)) return; + if (!m_playManager->setCurrentFrameIndexFromXValue(xValue, length)) return; stop(); // Devo fare stop prima di cambiare il frame corrente play(); } //----------------------------------------------------------------------------- -int ItemViewPlayWidget::getCurrentFramePosition(int lenght) { +int ItemViewPlayWidget::getCurrentFramePosition(int length) { if (m_playManager->isFrameIndexInRange()) - return m_playManager->currentFrameIndexToXValue(lenght); + return m_playManager->currentFrameIndexToXValue(length); return 0; } diff --git a/toonz/sources/toonz/dvitemview.h b/toonz/sources/toonz/dvitemview.h index 4a77553..5f57f63 100644 --- a/toonz/sources/toonz/dvitemview.h +++ b/toonz/sources/toonz/dvitemview.h @@ -127,8 +127,8 @@ class ItemViewPlayWidget final : public QWidget { bool getCurrentFrame(); /*! Return true if current frame index is less than fids size. */ bool isFrameIndexInRange(); - bool setCurrentFrameIndexFromXValue(int xValue, int lenght); - double currentFrameIndexToXValue(int lenght); + bool setCurrentFrameIndexFromXValue(int xValue, int length); + double currentFrameIndexToXValue(int length); QPixmap getCurrentPixmap(); }; @@ -144,8 +144,8 @@ public: void setIsPlaying(DvItemListModel *model, int index); void setIsPlayingCurrentFrameIndex(DvItemListModel *model, int index, - int xValue, int lenght); - int getCurrentFramePosition(int lenght); + int xValue, int length); + int getCurrentFramePosition(int length); bool isIndexPlaying(int index) { return m_currentItemIndex == index; } bool isPlaying() { return m_currentItemIndex != -1; } diff --git a/toonz/sources/toonz/metnum.cpp b/toonz/sources/toonz/metnum.cpp index 0d03793..c2569d2 100644 --- a/toonz/sources/toonz/metnum.cpp +++ b/toonz/sources/toonz/metnum.cpp @@ -158,7 +158,7 @@ int MetNum::Approx(int n, int m, double **x, double y[], double c[]) { /* prepara la matrice dei coefficienti */ for (i = 0; i < m; i++) - for (j = 0; j <= i; j++) /* la matrice Š simmetrica */ + for (j = 0; j <= i; j++) /* la matrice Š symmetrica */ { A[i][j] = 0; for (k = 0; k < n; k++) A[i][j] += x[i][k] * x[j][k]; @@ -184,7 +184,7 @@ int MetNum::Approx(int n, int m, double **x, double y[], double c[]) { /*--------------------------- Cholesky ---------------------------------*/ /* SCOPO */ /*Esegue la fattorizzazione di Cholesky ( A = L*t(L) ) di una matrice */ -/*simmetrica definita positiva. */ +/*symmetrica definita positiva. */ /* */ /* SPECIFICHE */ /* int Cholesky(int n, double **A) */ @@ -202,7 +202,7 @@ int MetNum::Approx(int n, int m, double **x, double y[], double c[]) { /* precisamente pu• essere: */ /* 0 nessun errore */ /* -1 n<1 */ -/* k>0 la matrice non Š simmetrica def. positiva; */ +/* k>0 la matrice non Š symmetrica def. positiva; */ /* la riga k non Š accettabile */ /*------------------------------------------------------------------------*/ int MetNum::Cholesky(int n, double **A) { diff --git a/toonz/sources/toonzlib/avicodecrestrictions.cpp b/toonz/sources/toonzlib/avicodecrestrictions.cpp index e12d9f0..91d1af9 100644 --- a/toonz/sources/toonzlib/avicodecrestrictions.cpp +++ b/toonz/sources/toonzlib/avicodecrestrictions.cpp @@ -112,7 +112,7 @@ void AviCodecRestrictions::getRestrictions(const std::wstring &codecName, // Loop until we can find a width, height, and depth that works! int i; - // check the x lenght + // check the x length bi.bmiHeader.biBitCount = bpp; for (i = 3; i >= 0; i--) { bi.bmiHeader.biWidth = lx + (1 << i); @@ -125,7 +125,7 @@ void AviCodecRestrictions::getRestrictions(const std::wstring &codecName, restrictions = QObject::tr("video width must be a multiple of %1") .arg(QString::number(1 << (i + 1))); - // check the y lenght + // check the y length bi.bmiHeader.biWidth = 640; for (i = 3; i >= 0; i--) { bi.bmiHeader.biHeight = ly + (1 << i); @@ -136,7 +136,7 @@ void AviCodecRestrictions::getRestrictions(const std::wstring &codecName, } if (i >= 0) restrictions = restrictions + "\n" + - QObject::tr("video lenght must be a multiple of %1") + QObject::tr("video length must be a multiple of %1") .arg(QString::number(1 << (i + 1))); ICClose(hic); diff --git a/toonz/sources/toonzlib/imagepainter.cpp b/toonz/sources/toonzlib/imagepainter.cpp index 31f6153..e624282 100644 --- a/toonz/sources/toonzlib/imagepainter.cpp +++ b/toonz/sources/toonzlib/imagepainter.cpp @@ -367,7 +367,7 @@ void Painter::doFlushRasterImages(const TRasterP &rin, int bg, // Following lines are used to solve a problem that occurs with some // graphics cards! - // It seems that the glReadPixels() function is very slow if the lx lenght + // It seems that the glReadPixels() function is very slow if the lx length // isn't a multiple of 8! TDimension backgroundDim(lx, ly); backgroundDim.lx = (lx & 0x7) == 0 ? lx : lx + 8 - (lx & 0x7); diff --git a/toonz/sources/toonzlib/imagestyles.cpp b/toonz/sources/toonzlib/imagestyles.cpp index 2175e00..7e80808 100644 --- a/toonz/sources/toonzlib/imagestyles.cpp +++ b/toonz/sources/toonzlib/imagestyles.cpp @@ -39,10 +39,10 @@ PointPair computeTexParameters(const TPointD &p1, const TPointD &p2, TPointD v = (newP.first + newP.second) * 0.5 - (p2 + p1) * 0.5; // compute length of opposite segment - double lenghtNextP1NextP2 = tdistance(newP.first, newP.second); + double lengthNextP1NextP2 = tdistance(newP.first, newP.second); // compute parameter texture offset starting from 0.5 - double texParameterOffset = lenghtNextP1NextP2 / size.lx * 0.5; + double texParameterOffset = lengthNextP1NextP2 / size.lx * 0.5; // fix value for s tex.first.x = 0.5 - texParameterOffset; diff --git a/toonz/sources/toonzlib/rasterbrush.cpp b/toonz/sources/toonzlib/rasterbrush.cpp index ce11213..f093ed9 100644 --- a/toonz/sources/toonzlib/rasterbrush.cpp +++ b/toonz/sources/toonzlib/rasterbrush.cpp @@ -107,7 +107,7 @@ class Disk { } } - // Illumina otto pixel simmetrici per ottenere la circonferenza del disco. + // Illumina otto pixel symmetrici per ottenere la circonferenza del disco. // Per ogni pixel illumina anche i vicini per gestire l'antialias. void makeAntiAliasedDiskBorder(const TRasterCM32P &ras, const TPoint ¢re, const TPoint &point, diff --git a/toonz/sources/toonzlib/tbinarizer.cpp b/toonz/sources/toonzlib/tbinarizer.cpp index a819bcc..49ee49f 100644 --- a/toonz/sources/toonzlib/tbinarizer.cpp +++ b/toonz/sources/toonzlib/tbinarizer.cpp @@ -161,7 +161,7 @@ void TBinarizer::process(const TRaster32P &ras) { // cerco il massimo while (i > 0 && histo[i - 1] > histo[i]) i--; int i1 = i; - // presuppongo che il picco del BG sia simmetrico: i0-i1 == i1-i2 + // presuppongo che il picco del BG sia symmetrico: i0-i1 == i1-i2 int i2 = 2 * i1 - i0; bgThreshold = i2 - 1; } diff --git a/toonz/sources/toonzqt/paletteviewergui.cpp b/toonz/sources/toonzqt/paletteviewergui.cpp index fcd489b..b22622c 100644 --- a/toonz/sources/toonzqt/paletteviewergui.cpp +++ b/toonz/sources/toonzqt/paletteviewergui.cpp @@ -487,8 +487,8 @@ void PageViewer::drawColorName(QPainter &p, QRect &nameRect, TColorStyle *style, QFont font = p.font(); int fontSize = font.pointSize(); if (fontSize == -1) fontSize = font.pixelSize(); - int lenght = index.length() * fontSize; - int w = (lenght > 11) ? (lenght) : 11; + int length = index.length() * fontSize; + int w = (length > 11) ? (length) : 11; int h = 11; int x0 = nameRect.right() - w + 1; int y0 = nameRect.top() - h - 1; diff --git a/toonz/sources/translations/chinese/toonzlib.ts b/toonz/sources/translations/chinese/toonzlib.ts index 3e939d0..078f26e 100644 --- a/toonz/sources/translations/chinese/toonzlib.ts +++ b/toonz/sources/translations/chinese/toonzlib.ts @@ -19,7 +19,7 @@ 视频宽度必须是 %1 的倍数 - video lenght must be a multiple of %1 + video length must be a multiple of %1 视频长度必须是 %1 的倍数 diff --git a/toonz/sources/translations/french/toonzlib.ts b/toonz/sources/translations/french/toonzlib.ts index 672348d..7b4b9b5 100644 --- a/toonz/sources/translations/french/toonzlib.ts +++ b/toonz/sources/translations/french/toonzlib.ts @@ -189,7 +189,7 @@ la largeur de la vidéo doit être un multiple de 1% - video lenght must be a multiple of %1 + video length must be a multiple of %1 la hauteur de la vidéo doit être un multiple de 1% diff --git a/toonz/sources/translations/german/toonzlib.ts b/toonz/sources/translations/german/toonzlib.ts index 93affba..3ec083e 100644 --- a/toonz/sources/translations/german/toonzlib.ts +++ b/toonz/sources/translations/german/toonzlib.ts @@ -19,7 +19,7 @@ Video-Breite muss ein mehrfaches von %1 sein - video lenght must be a multiple of %1 + video length must be a multiple of %1 Video-Länge muss ein mehrfaches von %1 sein diff --git a/toonz/sources/translations/italian/toonzlib.ts b/toonz/sources/translations/italian/toonzlib.ts index 27b86aa..ff71b87 100644 --- a/toonz/sources/translations/italian/toonzlib.ts +++ b/toonz/sources/translations/italian/toonzlib.ts @@ -189,7 +189,7 @@ la larghezza del video deve essere un multiplo di %1 - video lenght must be a multiple of %1 + video length must be a multiple of %1 l'altezza del video deve essere un multiplo di %1 diff --git a/toonz/sources/translations/japanese/toonzlib.ts b/toonz/sources/translations/japanese/toonzlib.ts index b052d9c..3df9326 100644 --- a/toonz/sources/translations/japanese/toonzlib.ts +++ b/toonz/sources/translations/japanese/toonzlib.ts @@ -19,7 +19,7 @@ ビデオ幅は %1 の倍数でなければなりません - video lenght must be a multiple of %1 + video length must be a multiple of %1 ビデオの長さは %1 の倍数でなければなりません diff --git a/toonz/sources/translations/spanish/toonzlib.ts b/toonz/sources/translations/spanish/toonzlib.ts index 5cc12ba..b6e89a7 100644 --- a/toonz/sources/translations/spanish/toonzlib.ts +++ b/toonz/sources/translations/spanish/toonzlib.ts @@ -189,7 +189,7 @@ el ancho del video debe ser múltiplo de %1 - video lenght must be a multiple of %1 + video length must be a multiple of %1 la altura del video debe ser múltiplo de %1