🐛 Fix spelling mistakes
This commit is contained in:
parent
e7667a0e6d
commit
a0ce326e1b
51 changed files with 288 additions and 288 deletions
|
@ -183,7 +183,7 @@ void chooseLeafToClusterize(ClusterContainer::iterator &itRet,
|
||||||
assert(!ISNAN(clusterCovariance[0]));
|
assert(!ISNAN(clusterCovariance[0]));
|
||||||
|
|
||||||
// calcola gli autovalori della matrice di covarianza della statistica
|
// 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)
|
// sono tutti reali)
|
||||||
KEYER_FLOAT eigenValues[3];
|
KEYER_FLOAT eigenValues[3];
|
||||||
tmpMulteplicity = calcCovarianceEigenValues(clusterCovariance, eigenValues);
|
tmpMulteplicity = calcCovarianceEigenValues(clusterCovariance, eigenValues);
|
||||||
|
|
|
@ -439,8 +439,8 @@ bool isCloseToSegment(const TPointD &point, const TSegment &segment,
|
||||||
double distance) {
|
double distance) {
|
||||||
TPointD a = segment.getP0();
|
TPointD a = segment.getP0();
|
||||||
TPointD b = segment.getP1();
|
TPointD b = segment.getP1();
|
||||||
double lenght2 = tdistance2(a, b);
|
double length2 = tdistance2(a, b);
|
||||||
if (lenght2 < tdistance2(a, point) || lenght2 < tdistance2(point, b))
|
if (length2 < tdistance2(a, point) || length2 < tdistance2(point, b))
|
||||||
return false;
|
return false;
|
||||||
if (a.x == b.x) return fabs(point.x - a.x) <= distance;
|
if (a.x == b.x) return fabs(point.x - a.x) <= distance;
|
||||||
if (a.y == b.y) return fabs(point.y - a.y) <= distance;
|
if (a.y == b.y) return fabs(point.y - a.y) <= distance;
|
||||||
|
|
|
@ -556,7 +556,7 @@ struct TStroke::Imp {
|
||||||
BYTE m_flag;
|
BYTE m_flag;
|
||||||
|
|
||||||
//! This flag checks if changes occurs and if it is neccessary to update
|
//! This flag checks if changes occurs and if it is neccessary to update
|
||||||
//! lenght.
|
//! length.
|
||||||
bool m_isValidLength;
|
bool m_isValidLength;
|
||||||
|
|
||||||
//! This flag checks if changes occurs and if it is neccessary to update
|
//! This flag checks if changes occurs and if it is neccessary to update
|
||||||
|
@ -570,7 +570,7 @@ struct TStroke::Imp {
|
||||||
TRectD m_bBox;
|
TRectD m_bBox;
|
||||||
|
|
||||||
//! This vector contains length computed for each control point of stroke.
|
//! 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.
|
//! This vector contains parameter computed for each control point of stroke.
|
||||||
DoubleArray m_parameterValueAtControlPoint;
|
DoubleArray m_parameterValueAtControlPoint;
|
||||||
|
@ -659,7 +659,7 @@ false -> ok
|
||||||
bool retrieveChunkAndItsParamameter(double w, int &chunk, double &t);
|
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
|
Return
|
||||||
true -> error (parameter w out of range, etc)
|
true -> error (parameter w out of range, etc)
|
||||||
false -> ok
|
false -> ok
|
||||||
|
@ -793,7 +793,7 @@ void TStroke::Imp::swapGeometry(Imp &other) throw() {
|
||||||
std::swap(m_isOutlineValid, other.m_isOutlineValid);
|
std::swap(m_isOutlineValid, other.m_isOutlineValid);
|
||||||
std::swap(m_areDisabledComputeOfCaches, other.m_areDisabledComputeOfCaches);
|
std::swap(m_areDisabledComputeOfCaches, other.m_areDisabledComputeOfCaches);
|
||||||
std::swap(m_bBox, other.m_bBox);
|
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,
|
std::swap(m_parameterValueAtControlPoint,
|
||||||
other.m_parameterValueAtControlPoint);
|
other.m_parameterValueAtControlPoint);
|
||||||
std::swap(m_centerLineArray, other.m_centerLineArray);
|
std::swap(m_centerLineArray, other.m_centerLineArray);
|
||||||
|
@ -820,10 +820,10 @@ void TStroke::Imp::computeCacheVector() {
|
||||||
if (getChunkCount() > 0) // se ci sono cionchi
|
if (getChunkCount() > 0) // se ci sono cionchi
|
||||||
{
|
{
|
||||||
// (re)inizializzo un vettore
|
// (re)inizializzo un vettore
|
||||||
m_partialLenghtArray.resize(getControlPointCount(),
|
m_partialLengthArray.resize(getControlPointCount(),
|
||||||
(std::numeric_limits<double>::max)());
|
(std::numeric_limits<double>::max)());
|
||||||
|
|
||||||
m_partialLenghtArray[0] = 0.0;
|
m_partialLengthArray[0] = 0.0;
|
||||||
|
|
||||||
double length = 0.0;
|
double length = 0.0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -835,15 +835,15 @@ void TStroke::Imp::computeCacheVector() {
|
||||||
assert(j <= getControlPointCount());
|
assert(j <= getControlPointCount());
|
||||||
tq = getChunk(i);
|
tq = getChunk(i);
|
||||||
lengthEvaluator.setQuad(*tq);
|
lengthEvaluator.setQuad(*tq);
|
||||||
m_partialLenghtArray[j++] = length;
|
m_partialLengthArray[j++] = length;
|
||||||
m_partialLenghtArray[j++] = length + lengthEvaluator.getLengthAt(0.5);
|
m_partialLengthArray[j++] = length + lengthEvaluator.getLengthAt(0.5);
|
||||||
length += lengthEvaluator.getLengthAt(1.0);
|
length += lengthEvaluator.getLengthAt(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_partialLenghtArray[j++] = length;
|
m_partialLengthArray[j++] = length;
|
||||||
assert(j == getControlPointCount());
|
assert(j == getControlPointCount());
|
||||||
// assert( m_parameterValueAtControlPoint.size() ==
|
// assert( m_parameterValueAtControlPoint.size() ==
|
||||||
// m_partialLenghtArray.size() );
|
// m_partialLengthArray.size() );
|
||||||
}
|
}
|
||||||
m_isValidLength = true;
|
m_isValidLength = true;
|
||||||
}
|
}
|
||||||
|
@ -932,18 +932,18 @@ bool TStroke::Imp::retrieveChunkAndItsParamameterAtLength(double s, int &chunk,
|
||||||
vector<double>::iterator first;
|
vector<double>::iterator first;
|
||||||
|
|
||||||
// cerco nella cache la posizione che compete alla lunghezza s
|
// cerco nella cache la posizione che compete alla lunghezza s
|
||||||
first = std::upper_bound(m_partialLenghtArray.begin(),
|
first = std::upper_bound(m_partialLengthArray.begin(),
|
||||||
m_partialLenghtArray.end(), s);
|
m_partialLengthArray.end(), s);
|
||||||
|
|
||||||
// se s e' interna al vettore di cache
|
// 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...
|
// 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.
|
// ...e da questo il cionco relativo.
|
||||||
chunk = retrieveChunkFromControlPointIndex(controlPointOffset);
|
chunk = retrieveChunkFromControlPointIndex(controlPointOffset);
|
||||||
|
|
||||||
if (first != m_partialLenghtArray.begin() && s == *(first - 1)) {
|
if (first != m_partialLengthArray.begin() && s == *(first - 1)) {
|
||||||
controlPointOffset--;
|
controlPointOffset--;
|
||||||
if (controlPointOffset & 1) {
|
if (controlPointOffset & 1) {
|
||||||
const DoublePair &p = retrieveParametersFromChunk(chunk);
|
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
|
// fisso un offset per l'algoritmo di bisezione
|
||||||
double offset = (first == m_partialLenghtArray.begin())
|
double offset = (first == m_partialLengthArray.begin())
|
||||||
? s
|
? s
|
||||||
: s - m_partialLenghtArray[chunk * 2];
|
: s - m_partialLengthArray[chunk * 2];
|
||||||
|
|
||||||
// cerco il parametro minimo a meno di una tolleranza epsilon
|
// 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
|
// se l'algoritmo di ricerca ha fallito fissa il valore ad uno dei due
|
||||||
// estremi
|
// estremi
|
||||||
if (t == -1) {
|
if (t == -1) {
|
||||||
if (s <= m_partialLenghtArray[controlPointOffset]) t = 0.0;
|
if (s <= m_partialLengthArray[controlPointOffset]) t = 0.0;
|
||||||
t = 1.0;
|
t = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,7 +984,7 @@ bool TStroke::Imp::retrieveChunkAndItsParamameterAtLength(double s, int &chunk,
|
||||||
if (s <= 0.0) {
|
if (s <= 0.0) {
|
||||||
chunk = 0;
|
chunk = 0;
|
||||||
t = 0.0;
|
t = 0.0;
|
||||||
} else if (s >= m_partialLenghtArray.back()) {
|
} else if (s >= m_partialLengthArray.back()) {
|
||||||
chunk = getChunkCount() - 1;
|
chunk = getChunkCount() - 1;
|
||||||
t = 1.0;
|
t = 1.0;
|
||||||
}
|
}
|
||||||
|
@ -1156,8 +1156,8 @@ void TStroke::Imp::print(ostream &os) {
|
||||||
|
|
||||||
os << "m_bBox:" << m_bBox << endl;
|
os << "m_bBox:" << m_bBox << endl;
|
||||||
|
|
||||||
os << "m_partialLenghtArray";
|
os << "m_partialLengthArray";
|
||||||
printContainer(os, m_partialLenghtArray);
|
printContainer(os, m_partialLengthArray);
|
||||||
os << endl;
|
os << endl;
|
||||||
|
|
||||||
os << "m_parameterValueAtControlPoint";
|
os << "m_parameterValueAtControlPoint";
|
||||||
|
@ -1242,9 +1242,9 @@ TStroke::TStroke(const TStroke &other)
|
||||||
// other.m_imp->m_centerLineArray.end(),
|
// other.m_imp->m_centerLineArray.end(),
|
||||||
// TThickQuadraticArrayInsertIterator(m_imp->m_centerLineArray));
|
// TThickQuadraticArrayInsertIterator(m_imp->m_centerLineArray));
|
||||||
|
|
||||||
copy(other.m_imp->m_partialLenghtArray.begin(),
|
copy(other.m_imp->m_partialLengthArray.begin(),
|
||||||
other.m_imp->m_partialLenghtArray.end(),
|
other.m_imp->m_partialLengthArray.end(),
|
||||||
back_inserter<DoubleArray>(m_imp->m_partialLenghtArray));
|
back_inserter<DoubleArray>(m_imp->m_partialLengthArray));
|
||||||
copy(other.m_imp->m_parameterValueAtControlPoint.begin(),
|
copy(other.m_imp->m_parameterValueAtControlPoint.begin(),
|
||||||
other.m_imp->m_parameterValueAtControlPoint.end(),
|
other.m_imp->m_parameterValueAtControlPoint.end(),
|
||||||
back_inserter<DoubleArray>(m_imp->m_parameterValueAtControlPoint));
|
back_inserter<DoubleArray>(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 {
|
double TStroke::getApproximateLength(double w0, double w1, double error) const {
|
||||||
m_imp->computeCacheVector();
|
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;
|
if (w0 == w1) return 0.0;
|
||||||
|
|
||||||
|
@ -1529,7 +1529,7 @@ double TStroke::getApproximateLength(double w0, double w1, double error) const {
|
||||||
*first < w1 + TConsts::epsilon) {
|
*first < w1 + TConsts::epsilon) {
|
||||||
int offset =
|
int offset =
|
||||||
distance(m_imp->m_parameterValueAtControlPoint.begin(), first);
|
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 {
|
double TStroke::getLength(int chunk, double t) const {
|
||||||
// Compute length caches
|
// Compute length caches
|
||||||
m_imp->computeCacheVector();
|
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;
|
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);
|
if (t > 0.0) s += getChunk(chunk)->getLength(t);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@ -2184,11 +2184,11 @@ TPointD TStroke::getSpeedAtLength(double s) const {
|
||||||
double TStroke::getLengthAtControlPoint(int n) const {
|
double TStroke::getLengthAtControlPoint(int n) const {
|
||||||
m_imp->computeCacheVector();
|
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -940,8 +940,8 @@ void transferColors(const std::list<TEdge *> &oldList,
|
||||||
#if 0
|
#if 0
|
||||||
list<TEdge*>::const_iterator it1;
|
list<TEdge*>::const_iterator it1;
|
||||||
#endif
|
#endif
|
||||||
double totLenght;
|
double totLength;
|
||||||
if (isStrokeChanged) totLenght = newList.front()->m_s->getLength();
|
if (isStrokeChanged) totLength = newList.front()->m_s->getLength();
|
||||||
for (it = newList.begin(); it != newList.end(); ++it) {
|
for (it = newList.begin(); it != newList.end(); ++it) {
|
||||||
int newStyle = -1; // ErrorStyle;
|
int newStyle = -1; // ErrorStyle;
|
||||||
// unused variable
|
// unused variable
|
||||||
|
@ -955,8 +955,8 @@ list<TEdge*>::const_iterator it1;
|
||||||
if ((*it)->m_w0 > (*it)->m_w1) {
|
if ((*it)->m_w0 > (*it)->m_w1) {
|
||||||
reversed = !isFlipped;
|
reversed = !isFlipped;
|
||||||
if (isStrokeChanged) {
|
if (isStrokeChanged) {
|
||||||
l0 = (*it)->m_s->getLength((*it)->m_w1) / totLenght;
|
l0 = (*it)->m_s->getLength((*it)->m_w1) / totLength;
|
||||||
l1 = (*it)->m_s->getLength((*it)->m_w0) / totLenght;
|
l1 = (*it)->m_s->getLength((*it)->m_w0) / totLength;
|
||||||
} else {
|
} else {
|
||||||
l0 = (*it)->m_w1;
|
l0 = (*it)->m_w1;
|
||||||
l1 = (*it)->m_w0;
|
l1 = (*it)->m_w0;
|
||||||
|
@ -964,8 +964,8 @@ list<TEdge*>::const_iterator it1;
|
||||||
} else {
|
} else {
|
||||||
reversed = isFlipped;
|
reversed = isFlipped;
|
||||||
if (isStrokeChanged) {
|
if (isStrokeChanged) {
|
||||||
l0 = (*it)->m_s->getLength((*it)->m_w0) / totLenght;
|
l0 = (*it)->m_s->getLength((*it)->m_w0) / totLength;
|
||||||
l1 = (*it)->m_s->getLength((*it)->m_w1) / totLenght;
|
l1 = (*it)->m_s->getLength((*it)->m_w1) / totLength;
|
||||||
} else {
|
} else {
|
||||||
l0 = (*it)->m_w0;
|
l0 = (*it)->m_w0;
|
||||||
l1 = (*it)->m_w1;
|
l1 = (*it)->m_w1;
|
||||||
|
@ -986,12 +986,12 @@ list<TEdge*>::const_iterator it1;
|
||||||
continue;
|
continue;
|
||||||
double _l0, _l1;
|
double _l0, _l1;
|
||||||
if (isStrokeChanged) {
|
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)) /
|
_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)) /
|
_l1 = (*it1)->m_s->getLength(std::max((*it1)->m_w0, (*it1)->m_w1)) /
|
||||||
totLenght1;
|
totLength1;
|
||||||
} else {
|
} else {
|
||||||
_l0 = std::min((*it1)->m_w0, (*it1)->m_w1);
|
_l0 = std::min((*it1)->m_w0, (*it1)->m_w1);
|
||||||
_l1 = std::max((*it1)->m_w0, (*it1)->m_w1);
|
_l1 = std::max((*it1)->m_w0, (*it1)->m_w1);
|
||||||
|
@ -1634,14 +1634,14 @@ void TVectorImage::getUsedStyles(std::set<int> &styles) const {
|
||||||
|
|
||||||
inline double recomputeW1(double oldW, const TStroke &oldStroke,
|
inline double recomputeW1(double oldW, const TStroke &oldStroke,
|
||||||
const TStroke &newStroke, double startW) {
|
const TStroke &newStroke, double startW) {
|
||||||
double oldLenght = oldStroke.getLength();
|
double oldLength = oldStroke.getLength();
|
||||||
double newLenght = newStroke.getLength();
|
double newLength = newStroke.getLength();
|
||||||
|
|
||||||
assert(startW <= oldW);
|
assert(startW <= oldW);
|
||||||
assert(newLenght < oldLenght);
|
assert(newLength < oldLength);
|
||||||
|
|
||||||
double s = oldStroke.getLength(startW, oldW);
|
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);
|
return newStroke.getParameterAtLength(s);
|
||||||
}
|
}
|
||||||
|
@ -1657,13 +1657,13 @@ inline double recomputeW2(double oldW, const TStroke &oldStroke,
|
||||||
|
|
||||||
inline double recomputeW(double oldW, const TStroke &oldStroke,
|
inline double recomputeW(double oldW, const TStroke &oldStroke,
|
||||||
const TStroke &newStroke, bool isAtBegin) {
|
const TStroke &newStroke, bool isAtBegin) {
|
||||||
double oldLenght = oldStroke.getLength();
|
double oldLength = oldStroke.getLength();
|
||||||
double newLenght = newStroke.getLength();
|
double newLength = newStroke.getLength();
|
||||||
|
|
||||||
assert(newLenght < oldLenght);
|
assert(newLength < oldLength);
|
||||||
double s =
|
double s =
|
||||||
oldStroke.getLength(oldW) - ((isAtBegin) ? 0 : oldLenght - newLenght);
|
oldStroke.getLength(oldW) - ((isAtBegin) ? 0 : oldLength - newLength);
|
||||||
assert(s <= newLenght || areAlmostEqual(s, newLenght, 1e-5));
|
assert(s <= newLength || areAlmostEqual(s, newLength, 1e-5));
|
||||||
|
|
||||||
return newStroke.getParameterAtLength(s);
|
return newStroke.getParameterAtLength(s);
|
||||||
}
|
}
|
||||||
|
@ -1946,12 +1946,12 @@ static void computeEdgeList(TStroke *newS, const std::list<TEdge *> &edgeList1,
|
||||||
|
|
||||||
if (!edgeList1.empty()) {
|
if (!edgeList1.empty()) {
|
||||||
TStroke *s1 = edgeList1.front()->m_s;
|
TStroke *s1 = edgeList1.front()->m_s;
|
||||||
double lenght1 = s1->getLength();
|
double length1 = s1->getLength();
|
||||||
;
|
;
|
||||||
|
|
||||||
for (it = edgeList1.begin(); it != edgeList1.end(); ++it) {
|
for (it = edgeList1.begin(); it != edgeList1.end(); ++it) {
|
||||||
double l0 = s1->getLength((*it)->m_w0), l1 = s1->getLength((*it)->m_w1);
|
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();
|
TEdge *e = new TEdge();
|
||||||
e->m_toBeDeleted = true;
|
e->m_toBeDeleted = true;
|
||||||
|
@ -1967,10 +1967,10 @@ static void computeEdgeList(TStroke *newS, const std::list<TEdge *> &edgeList1,
|
||||||
if (!edgeList2.empty()) {
|
if (!edgeList2.empty()) {
|
||||||
TStroke *s2 = edgeList2.front()->m_s;
|
TStroke *s2 = edgeList2.front()->m_s;
|
||||||
double offset = newS->getLength(newS->getW(s2->getPoint(0.0)));
|
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) {
|
for (it = edgeList2.begin(); it != edgeList2.end(); ++it) {
|
||||||
double l0 = s2->getLength((*it)->m_w0), l1 = s2->getLength((*it)->m_w1);
|
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();
|
TEdge *e = new TEdge();
|
||||||
e->m_toBeDeleted = true;
|
e->m_toBeDeleted = true;
|
||||||
|
|
|
@ -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));
|
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(
|
TThickPoint TStrokeParamDeformation::getDisplacementForControlPoint(
|
||||||
const TStroke &stroke, UINT n) const {
|
const TStroke &stroke, UINT n) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double diff = stroke.getLengthAtControlPoint(n);
|
double diff = stroke.getLengthAtControlPoint(n);
|
||||||
|
|
||||||
diff = diff - m_startParameter;
|
diff = diff - m_startParameter;
|
||||||
|
@ -283,7 +283,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPoint(
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// 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)
|
if (m_vect)
|
||||||
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
||||||
|
@ -299,7 +299,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPoint(
|
||||||
TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen(
|
TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen(
|
||||||
const TStroke &stroke, double cpLenDiff) const {
|
const TStroke &stroke, double cpLenDiff) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
// double diff = stroke.getLengthAtControlPoint(n);
|
// double diff = stroke.getLengthAtControlPoint(n);
|
||||||
// double diff = cpLen;
|
// double diff = cpLen;
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen(
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// 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)
|
if (m_vect)
|
||||||
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
||||||
|
@ -327,7 +327,7 @@ TThickPoint TStrokeParamDeformation::getDisplacementForControlPointLen(
|
||||||
TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke,
|
TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke,
|
||||||
double w) const {
|
double w) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double diff = stroke.getLength(w);
|
double diff = stroke.getLength(w);
|
||||||
|
|
||||||
diff = diff - m_startParameter;
|
diff = diff - m_startParameter;
|
||||||
|
@ -336,7 +336,7 @@ TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke,
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// 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)
|
if (m_vect)
|
||||||
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
||||||
|
@ -354,7 +354,7 @@ TThickPoint TStrokeParamDeformation::getDisplacement(const TStroke &stroke,
|
||||||
double TStrokeParamDeformation::getDelta(const TStroke &stroke,
|
double TStrokeParamDeformation::getDelta(const TStroke &stroke,
|
||||||
double w) const {
|
double w) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double diff = stroke.getLength(w);
|
double diff = stroke.getLength(w);
|
||||||
|
|
||||||
diff = diff - m_startParameter;
|
diff = diff - m_startParameter;
|
||||||
|
@ -363,7 +363,7 @@ double TStrokeParamDeformation::getDelta(const TStroke &stroke,
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// 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);
|
return derivateOfGaussianPotential(diff);
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ double TStrokeBenderDeformation::getMaxDiff() const {
|
||||||
TThickPoint TStrokeBenderDeformation::getDisplacementForControlPoint(
|
TThickPoint TStrokeBenderDeformation::getDisplacementForControlPoint(
|
||||||
const TStroke &s, UINT n) const {
|
const TStroke &s, UINT n) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double strokeLengthAtParameter = s.getLengthAtControlPoint(n);
|
double strokeLengthAtParameter = s.getLengthAtControlPoint(n);
|
||||||
double diff = strokeLengthAtParameter - m_startLength;
|
double diff = strokeLengthAtParameter - m_startLength;
|
||||||
|
|
||||||
|
@ -438,11 +438,11 @@ TThickPoint TStrokeBenderDeformation::getDisplacementForControlPoint(
|
||||||
double outVal = 0;
|
double outVal = 0;
|
||||||
|
|
||||||
if (fabs(diff) <= m_lengthOfDeformation && m_versus == INNER) {
|
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);
|
outVal = gaussianPotential(diff);
|
||||||
} else if (m_versus == OUTER) {
|
} else if (m_versus == OUTER) {
|
||||||
double valForGaussian = -c_maxLenghtOfGaussian +
|
double valForGaussian = -c_maxLengthOfGaussian +
|
||||||
2 * c_maxLenghtOfGaussian /
|
2 * c_maxLengthOfGaussian /
|
||||||
m_lengthOfDeformation *
|
m_lengthOfDeformation *
|
||||||
strokeLengthAtParameter;
|
strokeLengthAtParameter;
|
||||||
outVal = 1.0 - gaussianPotential(valForGaussian);
|
outVal = 1.0 - gaussianPotential(valForGaussian);
|
||||||
|
@ -472,7 +472,7 @@ TThickPoint TStrokeBenderDeformation::getDisplacementForControlPointLen(
|
||||||
TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s,
|
TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s,
|
||||||
double w) const {
|
double w) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double strokeLengthAtParameter = s.getLength(w);
|
double strokeLengthAtParameter = s.getLength(w);
|
||||||
double diff = strokeLengthAtParameter - m_startLength;
|
double diff = strokeLengthAtParameter - m_startLength;
|
||||||
|
|
||||||
|
@ -481,11 +481,11 @@ TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s,
|
||||||
|
|
||||||
if (fabs(diff) <= m_lengthOfDeformation)
|
if (fabs(diff) <= m_lengthOfDeformation)
|
||||||
if (m_versus == INNER) {
|
if (m_versus == INNER) {
|
||||||
diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian;
|
diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian;
|
||||||
outVal = gaussianPotential(diff);
|
outVal = gaussianPotential(diff);
|
||||||
} else if (m_versus == OUTER) {
|
} else if (m_versus == OUTER) {
|
||||||
double valForGaussian = -c_maxLenghtOfGaussian +
|
double valForGaussian = -c_maxLengthOfGaussian +
|
||||||
2 * c_maxLenghtOfGaussian /
|
2 * c_maxLengthOfGaussian /
|
||||||
m_lengthOfDeformation *
|
m_lengthOfDeformation *
|
||||||
strokeLengthAtParameter;
|
strokeLengthAtParameter;
|
||||||
outVal = 1.0 - gaussianPotential(valForGaussian);
|
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 TStrokeBenderDeformation::getDelta(const TStroke &s, double w) const {
|
||||||
double totalLenght = s.getLength();
|
double totalLength = s.getLength();
|
||||||
|
|
||||||
if (totalLenght != 0) {
|
if (totalLength != 0) {
|
||||||
double val = s.getLength(w) / totalLenght * (M_PI * 10.0);
|
double val = s.getLength(w) / totalLength * (M_PI * 10.0);
|
||||||
|
|
||||||
return sin(val);
|
return sin(val);
|
||||||
}
|
}
|
||||||
|
@ -564,11 +564,11 @@ vector<DoublePair> vres;
|
||||||
|
|
||||||
if(intersect( stroke, m_center, m_outerRadius, 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);
|
return sin(val);
|
||||||
}
|
}
|
||||||
|
@ -615,7 +615,7 @@ TStrokeThicknessDeformation::TStrokeThicknessDeformation(const TStroke *ref,
|
||||||
TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPoint(
|
TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPoint(
|
||||||
const TStroke &stroke, UINT n) const {
|
const TStroke &stroke, UINT n) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double diff = stroke.getLengthAtControlPoint(n);
|
double diff = stroke.getLengthAtControlPoint(n);
|
||||||
|
|
||||||
diff = diff - m_startParameter;
|
diff = diff - m_startParameter;
|
||||||
|
@ -625,7 +625,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPoint(
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// normalizzato, associato con la curva exp^(-x^2)
|
||||||
diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian;
|
diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian;
|
||||||
|
|
||||||
TThickPoint delta;
|
TThickPoint delta;
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPointLen(
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// normalizzato, associato con la curva exp^(-x^2)
|
||||||
diff *= (1.0 / m_lengthOfDeformation) * c_maxLenghtOfGaussian;
|
diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian;
|
||||||
|
|
||||||
TThickPoint delta;
|
TThickPoint delta;
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacementForControlPointLen(
|
||||||
TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke,
|
TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke,
|
||||||
double w) const {
|
double w) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double diff = stroke.getLength(w);
|
double diff = stroke.getLength(w);
|
||||||
|
|
||||||
diff = diff - m_startParameter;
|
diff = diff - m_startParameter;
|
||||||
|
@ -683,7 +683,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke,
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// 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)
|
if (m_vect)
|
||||||
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
return gaussianPotential(diff) * TThickPoint(*m_vect, 0);
|
||||||
|
@ -701,7 +701,7 @@ TThickPoint TStrokeThicknessDeformation::getDisplacement(const TStroke &stroke,
|
||||||
double TStrokeThicknessDeformation::getDelta(const TStroke &stroke,
|
double TStrokeThicknessDeformation::getDelta(const TStroke &stroke,
|
||||||
double w) const {
|
double w) const {
|
||||||
// potenziale exp^(-x^2) limitato tra
|
// potenziale exp^(-x^2) limitato tra
|
||||||
// [-c_maxLenghtOfGaussian,c_maxLenghtOfGaussian]
|
// [-c_maxLengthOfGaussian,c_maxLengthOfGaussian]
|
||||||
double diff = stroke.getLength(w);
|
double diff = stroke.getLength(w);
|
||||||
|
|
||||||
diff = diff - m_startParameter;
|
diff = diff - m_startParameter;
|
||||||
|
@ -711,7 +711,7 @@ double TStrokeThicknessDeformation::getDelta(const TStroke &stroke,
|
||||||
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
// il termine (1.0/m_lengthOfDeformation) * 3 scala
|
||||||
// il punto in diff su un sistema di coordinate
|
// il punto in diff su un sistema di coordinate
|
||||||
// normalizzato, associato con la curva exp^(-x^2)
|
// 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);
|
return derivateOfGaussianPotential(diff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,9 +244,9 @@ inline MyIfstream &MyIfstream::operator>>(TUINT32 &un) {
|
||||||
|
|
||||||
inline MyIfstream &MyIfstream::operator>>(string &un) {
|
inline MyIfstream &MyIfstream::operator>>(string &un) {
|
||||||
string s = "";
|
string s = "";
|
||||||
USHORT lenght;
|
USHORT length;
|
||||||
(*this) >> lenght;
|
(*this) >> length;
|
||||||
for (UINT i = 0; i < lenght; i++) {
|
for (UINT i = 0; i < length; i++) {
|
||||||
UCHAR ch;
|
UCHAR ch;
|
||||||
(*this) >> ch;
|
(*this) >> ch;
|
||||||
s.append(1, ch);
|
s.append(1, ch);
|
||||||
|
@ -530,7 +530,7 @@ ParsedPliImp::ParsedPliImp(const TFilePath &filename, bool readInfo)
|
||||||
, m_precisionScale(REGION_COMPUTING_PRECISION)
|
, m_precisionScale(REGION_COMPUTING_PRECISION)
|
||||||
, m_creator("") {
|
, m_creator("") {
|
||||||
TUINT32 magic;
|
TUINT32 magic;
|
||||||
// TUINT32 fileLenght;
|
// TUINT32 fileLength;
|
||||||
TagElem *tagElem;
|
TagElem *tagElem;
|
||||||
UCHAR maxThickness;
|
UCHAR maxThickness;
|
||||||
|
|
||||||
|
@ -583,9 +583,9 @@ ParsedPliImp::ParsedPliImp(const TFilePath &filename, bool readInfo)
|
||||||
m_iChan >> m_creator;
|
m_iChan >> m_creator;
|
||||||
|
|
||||||
if (m_majorVersionNumber < 5) {
|
if (m_majorVersionNumber < 5) {
|
||||||
TUINT32 fileLenght;
|
TUINT32 fileLength;
|
||||||
|
|
||||||
m_iChan >> fileLenght;
|
m_iChan >> fileLength;
|
||||||
m_iChan >> m_framesNumber;
|
m_iChan >> m_framesNumber;
|
||||||
m_iChan >> maxThickness;
|
m_iChan >> maxThickness;
|
||||||
m_thickRatio = maxThickness / 255.0;
|
m_thickRatio = maxThickness / 255.0;
|
||||||
|
@ -633,9 +633,9 @@ const TFrameId &ParsedPli::getFrameNumber(int index) {
|
||||||
|
|
||||||
void ParsedPliImp::loadInfo(bool readPlt, TPalette *&palette,
|
void ParsedPliImp::loadInfo(bool readPlt, TPalette *&palette,
|
||||||
TContentHistory *&history) {
|
TContentHistory *&history) {
|
||||||
TUINT32 fileLenght;
|
TUINT32 fileLength;
|
||||||
|
|
||||||
m_iChan >> fileLenght;
|
m_iChan >> fileLength;
|
||||||
m_iChan >> m_framesNumber;
|
m_iChan >> m_framesNumber;
|
||||||
if (!((m_majorVersionNumber == 5 && m_minorVersionNumber >= 7) ||
|
if (!((m_majorVersionNumber == 5 && m_minorVersionNumber >= 7) ||
|
||||||
(m_majorVersionNumber > 5))) {
|
(m_majorVersionNumber > 5))) {
|
||||||
|
@ -1306,7 +1306,7 @@ PliTag *ParsedPliImp::readColorTag() {
|
||||||
PliTag *ParsedPliImp::readStyleTag() {
|
PliTag *ParsedPliImp::readStyleTag() {
|
||||||
std::vector<TStyleParam> paramArray;
|
std::vector<TStyleParam> paramArray;
|
||||||
TUINT32 bufOffs = 0;
|
TUINT32 bufOffs = 0;
|
||||||
int lenght = m_tagLength;
|
int length = m_tagLength;
|
||||||
UINT i;
|
UINT i;
|
||||||
USHORT id = 0;
|
USHORT id = 0;
|
||||||
USHORT pageIndex = 0;
|
USHORT pageIndex = 0;
|
||||||
|
@ -1315,36 +1315,36 @@ PliTag *ParsedPliImp::readStyleTag() {
|
||||||
m_currDinamicTypeBytesNum = 2;
|
m_currDinamicTypeBytesNum = 2;
|
||||||
|
|
||||||
readUShortData(id, bufOffs);
|
readUShortData(id, bufOffs);
|
||||||
lenght -= 2;
|
length -= 2;
|
||||||
if (m_majorVersionNumber > 5 ||
|
if (m_majorVersionNumber > 5 ||
|
||||||
(m_majorVersionNumber == 5 && m_minorVersionNumber >= 6)) {
|
(m_majorVersionNumber == 5 && m_minorVersionNumber >= 6)) {
|
||||||
readUShortData(pageIndex, bufOffs);
|
readUShortData(pageIndex, bufOffs);
|
||||||
lenght -= 2;
|
length -= 2;
|
||||||
}
|
}
|
||||||
while (lenght > 0) {
|
while (length > 0) {
|
||||||
TStyleParam param;
|
TStyleParam param;
|
||||||
|
|
||||||
param.m_type = (enum TStyleParam::Type)m_buf[bufOffs++];
|
param.m_type = (enum TStyleParam::Type)m_buf[bufOffs++];
|
||||||
lenght--;
|
length--;
|
||||||
switch (param.m_type) {
|
switch (param.m_type) {
|
||||||
case TStyleParam::SP_BYTE:
|
case TStyleParam::SP_BYTE:
|
||||||
param.m_numericVal = m_buf[bufOffs++];
|
param.m_numericVal = m_buf[bufOffs++];
|
||||||
lenght--;
|
length--;
|
||||||
break;
|
break;
|
||||||
case TStyleParam::SP_USHORT: {
|
case TStyleParam::SP_USHORT: {
|
||||||
USHORT val;
|
USHORT val;
|
||||||
readUShortData(val, bufOffs);
|
readUShortData(val, bufOffs);
|
||||||
param.m_numericVal = val;
|
param.m_numericVal = val;
|
||||||
lenght -= 2;
|
length -= 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TStyleParam::SP_INT:
|
case TStyleParam::SP_INT:
|
||||||
case TStyleParam::SP_DOUBLE:
|
case TStyleParam::SP_DOUBLE:
|
||||||
readFloatData(param.m_numericVal, bufOffs);
|
readFloatData(param.m_numericVal, bufOffs);
|
||||||
lenght -= 4;
|
length -= 4;
|
||||||
break;
|
break;
|
||||||
case TStyleParam::SP_RASTER:
|
case TStyleParam::SP_RASTER:
|
||||||
lenght -= readRasterData(param.m_r, bufOffs);
|
length -= readRasterData(param.m_r, bufOffs);
|
||||||
break;
|
break;
|
||||||
case TStyleParam::SP_STRING: {
|
case TStyleParam::SP_STRING: {
|
||||||
USHORT strLen;
|
USHORT strLen;
|
||||||
|
@ -1354,7 +1354,7 @@ PliTag *ParsedPliImp::readStyleTag() {
|
||||||
for (i = 0; i < strLen; i++) {
|
for (i = 0; i < strLen; i++) {
|
||||||
param.m_string.append(1, m_buf[bufOffs++]);
|
param.m_string.append(1, m_buf[bufOffs++]);
|
||||||
}
|
}
|
||||||
lenght -= strLen + sizeof(USHORT);
|
length -= strLen + sizeof(USHORT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -2502,7 +2502,7 @@ bool ParsedPliImp::writePli(const TFilePath &filename) {
|
||||||
|
|
||||||
*m_oChan << m_creator;
|
*m_oChan << m_creator;
|
||||||
|
|
||||||
*m_oChan << (TUINT32)0; // fileLenght;
|
*m_oChan << (TUINT32)0; // fileLength;
|
||||||
*m_oChan << m_framesNumber;
|
*m_oChan << m_framesNumber;
|
||||||
|
|
||||||
UCHAR s, i, d;
|
UCHAR s, i, d;
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct NSVGimage {
|
||||||
|
|
||||||
#define NSVG_PI 3.14159265358979323846264338327f
|
#define NSVG_PI 3.14159265358979323846264338327f
|
||||||
#define NSVG_KAPPA90 \
|
#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.
|
// 90deg arcs.
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -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
|
* @brief Rotate the control point at even position [0,2,4,...] in a
|
||||||
* new position along the close path of a selfLoop stroke.
|
* 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.
|
* @return 0 if some problem occurs, else the new stroke.
|
||||||
* @todo Some refactoring required, code duplication.
|
* @todo Some refactoring required, code duplication.
|
||||||
*/
|
*/
|
||||||
DVAPI TStroke *rotateControlPoint(const TStroke *stroke,
|
DVAPI TStroke *rotateControlPoint(const TStroke *stroke,
|
||||||
const ToonzExt::EvenInt &even,
|
const ToonzExt::EvenInt &even,
|
||||||
double atLenght);
|
double atLength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve all parameters where stroke has a minimum.
|
* Retrieve all parameters where stroke has a minimum.
|
||||||
|
|
|
@ -54,7 +54,7 @@ private:
|
||||||
par_, //! Parameter of selection.
|
par_, //! Parameter of selection.
|
||||||
actionLength_, //! Action length, how many units to move.
|
actionLength_, //! Action length, how many units to move.
|
||||||
strokeLength_, //! Stroke Length.
|
strokeLength_, //! Stroke Length.
|
||||||
lenghtAtParam_, //! Length at <code>par_</code>
|
lengthAtParam_, //! Length at <code>par_</code>
|
||||||
leftFactor_, //! How many units to move on the left of curve.
|
leftFactor_, //! How many units to move on the left of curve.
|
||||||
rightFactor_; //! How many units to move on the right of curve.
|
rightFactor_; //! How many units to move on the right of curve.
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef NOT_SIMMETRIC_BEZIER_POTENTIAL_H
|
#ifndef NOT_Symmetric_BEZIER_POTENTIAL_H
|
||||||
#define NOT_SIMMETRIC_BEZIER_POTENTIAL_H
|
#define NOT_Symmetric_BEZIER_POTENTIAL_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
|
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
|
||||||
|
@ -23,9 +23,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace ToonzExt {
|
namespace ToonzExt {
|
||||||
class DVAPI NotSimmetricBezierPotential final : public Potential {
|
class DVAPI NotSymmetricBezierPotential final : public Potential {
|
||||||
public:
|
public:
|
||||||
virtual ~NotSimmetricBezierPotential();
|
virtual ~NotSymmetricBezierPotential();
|
||||||
|
|
||||||
// chiama compute_value ma effettua un controllo del parametro
|
// chiama compute_value ma effettua un controllo del parametro
|
||||||
double value_(double radiusToTest) const override;
|
double value_(double radiusToTest) const override;
|
||||||
|
@ -48,12 +48,12 @@ private:
|
||||||
double par_;
|
double par_;
|
||||||
double actionLength_; // lunghezza dell'azione
|
double actionLength_; // lunghezza dell'azione
|
||||||
double strokeLength_; // lunghezza stroke
|
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 leftFactor_; // fattore di shape x la curva a sinistra
|
||||||
double rightFactor_; // fattore di shape x la curva a dx
|
double rightFactor_; // fattore di shape x la curva a dx
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif /* NOT_SIMMETRIC_BEZIER_POTENTIAL_H */
|
#endif /* NOT_Symmetric_BEZIER_POTENTIAL_H */
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// End Of File
|
// End Of File
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef NOT_SIMMETRIC_EXP_POTENTIAL_H
|
#ifndef NOT_Symmetric_EXP_POTENTIAL_H
|
||||||
#define NOT_SIMMETRIC_EXP_POTENTIAL_H
|
#define NOT_Symmetric_EXP_POTENTIAL_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
|
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
* con d min( length_at_param, action_length *0.5)
|
* con d min( length_at_param, action_length *0.5)
|
||||||
* 1
|
* 1
|
||||||
* ed d min( curve_lenght - length_at_param, action_length *0.5)
|
* ed d min( curve_length - length_at_param, action_length *0.5)
|
||||||
* 2
|
* 2
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
|
@ -46,9 +46,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace ToonzExt {
|
namespace ToonzExt {
|
||||||
class DVAPI NotSimmetricExpPotential final : public Potential {
|
class DVAPI NotSymmetricExpPotential final : public Potential {
|
||||||
public:
|
public:
|
||||||
virtual ~NotSimmetricExpPotential();
|
virtual ~NotSymmetricExpPotential();
|
||||||
|
|
||||||
// chiama compute_value ma effettua un controllo del parametro
|
// chiama compute_value ma effettua un controllo del parametro
|
||||||
double value_(double radiusToTest) const override;
|
double value_(double radiusToTest) const override;
|
||||||
|
@ -69,12 +69,12 @@ private:
|
||||||
double par_;
|
double par_;
|
||||||
double actionLength_; // lunghezza dell'azione
|
double actionLength_; // lunghezza dell'azione
|
||||||
double strokeLength_; // lunghezza stroke
|
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 leftFactor_; // fattore di shape x la curva a sinistra
|
||||||
double rightFactor_; // fattore di shape x la curva a dx
|
double rightFactor_; // fattore di shape x la curva a dx
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif /* NOT_SIMMETRIC_EXP_POTENTIAL_H */
|
#endif /* NOT_Symmetric_EXP_POTENTIAL_H */
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// End Of File
|
// End Of File
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
|
@ -49,7 +49,7 @@ private:
|
||||||
double par_;
|
double par_;
|
||||||
double actionLength_; // lunghezza dell'azione
|
double actionLength_; // lunghezza dell'azione
|
||||||
double strokeLength_; // lunghezza stroke
|
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 leftFactor_; // fattore di shape x la curva a sinistra
|
||||||
double rightFactor_; // fattore di shape x la curva a dx
|
double rightFactor_; // fattore di shape x la curva a dx
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Potential;
|
||||||
*/
|
*/
|
||||||
class DVAPI StrokeParametricDeformer final : public TStrokeDeformation {
|
class DVAPI StrokeParametricDeformer final : public TStrokeDeformation {
|
||||||
public:
|
public:
|
||||||
StrokeParametricDeformer(double actionLenght, double startParameter,
|
StrokeParametricDeformer(double actionLength, double startParameter,
|
||||||
TStroke *s, Potential *);
|
TStroke *s, Potential *);
|
||||||
|
|
||||||
~StrokeParametricDeformer();
|
~StrokeParametricDeformer();
|
||||||
|
@ -112,11 +112,11 @@ private:
|
||||||
// parameter where is applicated action
|
// parameter where is applicated action
|
||||||
double startParameter_;
|
double startParameter_;
|
||||||
|
|
||||||
// like startParameter_ but recover lenght
|
// like startParameter_ but recover length
|
||||||
double startLenght_;
|
double startLength_;
|
||||||
|
|
||||||
// how many traits move
|
// how many traits move
|
||||||
double actionLenght_;
|
double actionLength_;
|
||||||
|
|
||||||
// deformation shape
|
// deformation shape
|
||||||
Potential *pot_;
|
Potential *pot_;
|
||||||
|
|
|
@ -33,7 +33,7 @@ class DVAPI StrokeStatus : public CompositeStatus {
|
||||||
// parameter of selected stroke
|
// parameter of selected stroke
|
||||||
double w_;
|
double w_;
|
||||||
|
|
||||||
// lenght of selected stroke
|
// length of selected stroke
|
||||||
double strokeLength_;
|
double strokeLength_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -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.
|
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
|
so any overflowing audio is truncated. For this reason, is adviced to add
|
||||||
the audio when the video part has been completely added.
|
the audio when the video part has been completely added.
|
||||||
The position can be a negative value too;
|
The position can be a negative value too;
|
||||||
|
|
|
@ -184,9 +184,9 @@ public:
|
||||||
validator minimum and maximum value. */
|
validator minimum and maximum value. */
|
||||||
void getRange(double &minValue, double &maxValue) override;
|
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);
|
void setDecimals(int decimals);
|
||||||
/*! Return lenght of field value decimal part. */
|
/*! Return length of field value decimal part. */
|
||||||
int getDecimals() override;
|
int getDecimals() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace DVGui {
|
||||||
the slider and the other pair [lebel,text field].
|
the slider and the other pair [lebel,text field].
|
||||||
Object size width is not fixed, while height is equal to
|
Object size width is not fixed, while height is equal to
|
||||||
DVGui::WidgetHeight, 20;
|
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
|
size, while
|
||||||
slider width change in according with widget size.
|
slider width change in according with widget size.
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace DVGui {
|
||||||
the slider and the other pair [lebel,text field].
|
the slider and the other pair [lebel,text field].
|
||||||
Object size width is not fixed, while height is equal to
|
Object size width is not fixed, while height is equal to
|
||||||
DVGui::WidgetHeight, 20;
|
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
|
size, while
|
||||||
slider width change in according with widget size.
|
slider width change in according with widget size.
|
||||||
|
|
||||||
|
|
|
@ -337,12 +337,12 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) {
|
||||||
if (sndtrack->getBitPerSample() == 8 && sndtrack->isSampleSigned())
|
if (sndtrack->getBitPerSample() == 8 && sndtrack->isSampleSigned())
|
||||||
throw TException("The format (8 bit signed) is incompatible with WAV file");
|
throw TException("The format (8 bit signed) is incompatible with WAV file");
|
||||||
|
|
||||||
TINT32 soundDataLenght =
|
TINT32 soundDataLength =
|
||||||
(TINT32)(sndtrack->getSampleCount() * (sndtrack->getBitPerSample() / 8) *
|
(TINT32)(sndtrack->getSampleCount() * (sndtrack->getBitPerSample() / 8) *
|
||||||
sndtrack->getChannelCount() /*sndtrack->getSampleSize()*/);
|
sndtrack->getChannelCount() /*sndtrack->getSampleSize()*/);
|
||||||
|
|
||||||
TINT32 RIFFChunkLength =
|
TINT32 RIFFChunkLength =
|
||||||
TFMTChunk::LENGTH + TWAVChunk::HDR_LENGTH + soundDataLenght;
|
TFMTChunk::LENGTH + TWAVChunk::HDR_LENGTH + soundDataLength;
|
||||||
|
|
||||||
TFileStatus fs(m_path);
|
TFileStatus fs(m_path);
|
||||||
if (fs.doesExist() && !fs.isWritable())
|
if (fs.doesExist() && !fs.isWritable())
|
||||||
|
@ -363,9 +363,9 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) {
|
||||||
fmtChunk.m_chans; // sndtrack->getSampleSize();
|
fmtChunk.m_chans; // sndtrack->getSampleSize();
|
||||||
fmtChunk.m_bitPerSample = sndtrack->getBitPerSample();
|
fmtChunk.m_bitPerSample = sndtrack->getBitPerSample();
|
||||||
|
|
||||||
TDATAChunk dataChunk(soundDataLenght);
|
TDATAChunk dataChunk(soundDataLength);
|
||||||
|
|
||||||
std::unique_ptr<UCHAR[]> waveData(new UCHAR[soundDataLenght]);
|
std::unique_ptr<UCHAR[]> waveData(new UCHAR[soundDataLength]);
|
||||||
|
|
||||||
if (!TNZ_LITTLE_ENDIAN) RIFFChunkLength = swapTINT32(RIFFChunkLength);
|
if (!TNZ_LITTLE_ENDIAN) RIFFChunkLength = swapTINT32(RIFFChunkLength);
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) {
|
||||||
#if (!TNZ_LITTLE_ENDIAN)
|
#if (!TNZ_LITTLE_ENDIAN)
|
||||||
{
|
{
|
||||||
if (fmtChunk.m_bitPerSample == 8)
|
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) {
|
else if (fmtChunk.m_bitPerSample == 16) {
|
||||||
swapAndCopySamples((short *)sndtrack->getRawData(), (short *)waveData,
|
swapAndCopySamples((short *)sndtrack->getRawData(), (short *)waveData,
|
||||||
sndtrack->getSampleCount() * fmtChunk.m_chans);
|
sndtrack->getSampleCount() * fmtChunk.m_chans);
|
||||||
|
@ -391,7 +391,7 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) {
|
||||||
{
|
{
|
||||||
if (fmtChunk.m_bitPerSample != 24)
|
if (fmtChunk.m_bitPerSample != 24)
|
||||||
memcpy((void *)waveData.get(), (void *)sndtrack->getRawData(),
|
memcpy((void *)waveData.get(), (void *)sndtrack->getRawData(),
|
||||||
soundDataLenght);
|
soundDataLength);
|
||||||
else { // togliere quarto byte
|
else { // togliere quarto byte
|
||||||
UCHAR *begin = (UCHAR *)sndtrack->getRawData();
|
UCHAR *begin = (UCHAR *)sndtrack->getRawData();
|
||||||
for (int i = 0; i < (int)sndtrack->getSampleCount() * fmtChunk.m_chans;
|
for (int i = 0; i < (int)sndtrack->getSampleCount() * fmtChunk.m_chans;
|
||||||
|
|
|
@ -12,8 +12,8 @@ set(HEADERS
|
||||||
../include/ext/StrokeDeformation.h
|
../include/ext/StrokeDeformation.h
|
||||||
../include/ext/StrokeDeformationImpl.h
|
../include/ext/StrokeDeformationImpl.h
|
||||||
../include/ext/LinearPotential.h
|
../include/ext/LinearPotential.h
|
||||||
../include/ext/NotSimmetricBezierPotential.h
|
../include/ext/NotSymmetricBezierPotential.h
|
||||||
../include/ext/NotSimmetricExpPotential.h
|
../include/ext/NotSymmetricExpPotential.h
|
||||||
../include/ext/Potential.h
|
../include/ext/Potential.h
|
||||||
../include/ext/SquarePotential.h
|
../include/ext/SquarePotential.h
|
||||||
DeformationSelector.h
|
DeformationSelector.h
|
||||||
|
@ -45,8 +45,8 @@ set(SOURCES
|
||||||
StrokeParametricDeformer.cpp
|
StrokeParametricDeformer.cpp
|
||||||
Types.cpp
|
Types.cpp
|
||||||
LinearPotential.cpp
|
LinearPotential.cpp
|
||||||
NotSimmetricBezierPotential.cpp
|
NotSymmetricBezierPotential.cpp
|
||||||
NotSimmetricExpPotential.cpp
|
NotSymmetricExpPotential.cpp
|
||||||
Potential.cpp
|
Potential.cpp
|
||||||
SquarePotential.cpp
|
SquarePotential.cpp
|
||||||
CornerDeformation.cpp
|
CornerDeformation.cpp
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "ext/StrokeDeformation.h"
|
#include "ext/StrokeDeformation.h"
|
||||||
#include "ext/SquarePotential.h"
|
#include "ext/SquarePotential.h"
|
||||||
//#include "ext/StrokeParametricDeformer.h"
|
//#include "ext/StrokeParametricDeformer.h"
|
||||||
//#include "ext/NotSimmetricBezierPotential.h"
|
//#include "ext/NotSymmetricBezierPotential.h"
|
||||||
#include "ext/ContextStatus.h"
|
#include "ext/ContextStatus.h"
|
||||||
#include "ext/Designer.h"
|
#include "ext/Designer.h"
|
||||||
//#include "ext/TriParam.h"
|
//#include "ext/TriParam.h"
|
||||||
|
|
|
@ -18,13 +18,13 @@ void ToonzExt::DraggerStatus::init() {
|
||||||
dist2_ = -1.0;
|
dist2_ = -1.0;
|
||||||
n_ = -1;
|
n_ = -1;
|
||||||
w_ = -1;
|
w_ = -1;
|
||||||
strokeLenght_ = -1;
|
strokeLength_ = -1;
|
||||||
deformerSensibility_ = -1;
|
deformerSensibility_ = -1;
|
||||||
stroke2change_ = 0;
|
stroke2change_ = 0;
|
||||||
lengthOfAction_ = 50;
|
lengthOfAction_ = 50;
|
||||||
deformer_ = 0;
|
deformer_ = 0;
|
||||||
leftActionLenght_ = -1;
|
leftActionLength_ = -1;
|
||||||
rightActionLenght_ = -1;
|
rightActionLength_ = -1;
|
||||||
pixelSize_ = 1.0;
|
pixelSize_ = 1.0;
|
||||||
cornerSize_ = 90;
|
cornerSize_ = 90;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1036,7 +1036,7 @@ DVAPI bool ToonzExt::cornersDetector(const TStroke *stroke, int minDegree,
|
||||||
|
|
||||||
assert(0.0 <= minSin && minSin <= 1.0);
|
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;
|
const TThickQuadratic *quad1 = 0, *quad2 = 0;
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@ void ToonzExt::LinearPotential::setParameters_(const TStroke *ref, double par,
|
||||||
actionLength_ = al;
|
actionLength_ = al;
|
||||||
|
|
||||||
strokeLength_ = ref->getLength();
|
strokeLength_ = ref->getLength();
|
||||||
lenghtAtParam_ = ref->getLength(par);
|
lengthAtParam_ = ref->getLength(par);
|
||||||
|
|
||||||
// lunghezza dal pto di click all'inizio della curva
|
// lunghezza dal pto di click all'inizio della curva
|
||||||
leftFactor_ = lenghtAtParam_;
|
leftFactor_ = lengthAtParam_;
|
||||||
|
|
||||||
// lunghezza dal pto di click alla fine
|
// lunghezza dal pto di click alla fine
|
||||||
rightFactor_ = strokeLength_ - lenghtAtParam_;
|
rightFactor_ = strokeLength_ - lengthAtParam_;
|
||||||
|
|
||||||
// considero come intervallo di mapping [-range,range].
|
// considero come intervallo di mapping [-range,range].
|
||||||
// 4 ha come valore c.a. 10exp-6
|
// 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 x = ref_->getLength(value2test);
|
||||||
double shape = this->actionLength_ * 0.5;
|
double shape = this->actionLength_ * 0.5;
|
||||||
if (isAlmostZero(shape)) shape = 1.0;
|
if (isAlmostZero(shape)) shape = 1.0;
|
||||||
x = ((x - lenghtAtParam_) * range_) / shape;
|
x = ((x - lengthAtParam_) * range_) / shape;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ double ToonzExt::LinearPotential::compute_value(double value2test) const {
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
double res = 0.0;
|
double res = 0.0;
|
||||||
|
|
||||||
// lenght at parameter
|
// length at parameter
|
||||||
x = ref_->getLength(value2test);
|
x = ref_->getLength(value2test);
|
||||||
|
|
||||||
double tmp_al = actionLength_ * 0.5;
|
double tmp_al = actionLength_ * 0.5;
|
||||||
|
@ -83,10 +83,10 @@ double ToonzExt::LinearPotential::compute_value(double value2test) const {
|
||||||
else if (rightFactor_ == 0.0)
|
else if (rightFactor_ == 0.0)
|
||||||
x = (x - (strokeLength_ - tmp_al)) / tmp_al;
|
x = (x - (strokeLength_ - tmp_al)) / tmp_al;
|
||||||
else {
|
else {
|
||||||
if (x <= lenghtAtParam_ && ((lenghtAtParam_ - x) <= leftFactor_))
|
if (x <= lengthAtParam_ && ((lengthAtParam_ - x) <= leftFactor_))
|
||||||
x = (x - (lenghtAtParam_ - leftFactor_)) / leftFactor_;
|
x = (x - (lengthAtParam_ - leftFactor_)) / leftFactor_;
|
||||||
else if (x > lenghtAtParam_ && ((x - lenghtAtParam_) < rightFactor_))
|
else if (x > lengthAtParam_ && ((x - lengthAtParam_) < rightFactor_))
|
||||||
x = (rightFactor_ - (x - lenghtAtParam_)) / rightFactor_;
|
x = (rightFactor_ - (x - lengthAtParam_)) / rightFactor_;
|
||||||
else
|
else
|
||||||
x = -1;
|
x = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "ext/NotSimmetricBezierPotential.h"
|
#include "ext/NotSymmetricBezierPotential.h"
|
||||||
#include "tstroke.h"
|
#include "tstroke.h"
|
||||||
|
|
||||||
#include <tmathutil.h>
|
#include <tmathutil.h>
|
||||||
|
@ -40,11 +40,11 @@ public:
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ToonzExt::NotSimmetricBezierPotential::~NotSimmetricBezierPotential() {}
|
ToonzExt::NotSymmetricBezierPotential::~NotSymmetricBezierPotential() {}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ToonzExt::NotSimmetricBezierPotential::setParameters_(const TStroke *ref,
|
void ToonzExt::NotSymmetricBezierPotential::setParameters_(const TStroke *ref,
|
||||||
double w,
|
double w,
|
||||||
double al) {
|
double al) {
|
||||||
assert(ref);
|
assert(ref);
|
||||||
|
@ -53,19 +53,19 @@ void ToonzExt::NotSimmetricBezierPotential::setParameters_(const TStroke *ref,
|
||||||
actionLength_ = al;
|
actionLength_ = al;
|
||||||
|
|
||||||
strokeLength_ = ref->getLength();
|
strokeLength_ = ref->getLength();
|
||||||
lenghtAtParam_ = ref->getLength(par_);
|
lengthAtParam_ = ref->getLength(par_);
|
||||||
|
|
||||||
// lunghezza dal pto di click all'inizio della curva
|
// lunghezza dal pto di click all'inizio della curva
|
||||||
leftFactor_ = min(lenghtAtParam_,
|
leftFactor_ = min(lengthAtParam_,
|
||||||
actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_;
|
actionLength_ * 0.5); // lengthAtParam_ / strokeLength_;
|
||||||
|
|
||||||
// lunghezza dal pto di click alla fine
|
// lunghezza dal pto di click alla fine
|
||||||
rightFactor_ = min(strokeLength_ - lenghtAtParam_, actionLength_ * 0.5);
|
rightFactor_ = min(strokeLength_ - lengthAtParam_, actionLength_ * 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
double ToonzExt::NotSimmetricBezierPotential::value_(double value2test) const {
|
double ToonzExt::NotSymmetricBezierPotential::value_(double value2test) const {
|
||||||
assert(0.0 <= value2test && value2test <= 1.0);
|
assert(0.0 <= value2test && value2test <= 1.0);
|
||||||
return this->compute_value(value2test);
|
return this->compute_value(value2test);
|
||||||
}
|
}
|
||||||
|
@ -73,18 +73,18 @@ double ToonzExt::NotSimmetricBezierPotential::value_(double value2test) const {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// normalization of parameter in range interval
|
// normalization of parameter in range interval
|
||||||
double ToonzExt::NotSimmetricBezierPotential::compute_shape(
|
double ToonzExt::NotSymmetricBezierPotential::compute_shape(
|
||||||
double value2test) const {
|
double value2test) const {
|
||||||
double x = ref_->getLength(value2test);
|
double x = ref_->getLength(value2test);
|
||||||
double shape = this->actionLength_ * 0.5;
|
double shape = this->actionLength_ * 0.5;
|
||||||
if (isAlmostZero(shape)) shape = 1.0;
|
if (isAlmostZero(shape)) shape = 1.0;
|
||||||
x = (x - lenghtAtParam_) / shape;
|
x = (x - lengthAtParam_) / shape;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
double ToonzExt::NotSimmetricBezierPotential::compute_value(
|
double ToonzExt::NotSymmetricBezierPotential::compute_value(
|
||||||
double value2test) const {
|
double value2test) const {
|
||||||
myBlendFunc me;
|
myBlendFunc me;
|
||||||
|
|
||||||
|
@ -97,14 +97,14 @@ double ToonzExt::NotSimmetricBezierPotential::compute_value(
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
double res = 0.0;
|
double res = 0.0;
|
||||||
|
|
||||||
// lenght at parameter
|
// length at parameter
|
||||||
x = ref_->getLength(value2test);
|
x = ref_->getLength(value2test);
|
||||||
|
|
||||||
const double tolerance = 0.0; // need to be pixel based
|
const double tolerance = 0.0; // need to be pixel based
|
||||||
|
|
||||||
// if is an extreme
|
// if is an extreme
|
||||||
if (max(lenghtAtParam_, 0.0) < tolerance ||
|
if (max(lengthAtParam_, 0.0) < tolerance ||
|
||||||
max(strokeLength_ - lenghtAtParam_, 0.0) < tolerance) {
|
max(strokeLength_ - lengthAtParam_, 0.0) < tolerance) {
|
||||||
double tmp_al = actionLength_ * 0.5;
|
double tmp_al = actionLength_ * 0.5;
|
||||||
|
|
||||||
// compute correct parameter considering offset
|
// compute correct parameter considering offset
|
||||||
|
@ -124,20 +124,20 @@ double ToonzExt::NotSimmetricBezierPotential::compute_value(
|
||||||
res = sq(x);
|
res = sq(x);
|
||||||
} else // when is not an extreme
|
} else // when is not an extreme
|
||||||
{
|
{
|
||||||
double lenght_at_value2test = ref_->getLength(value2test);
|
double length_at_value2test = ref_->getLength(value2test);
|
||||||
|
|
||||||
const double min_level = 0.01;
|
const double min_level = 0.01;
|
||||||
// if check a parameter over click point
|
// if check a parameter over click point
|
||||||
if (lenght_at_value2test >= lenghtAtParam_) {
|
if (length_at_value2test >= lengthAtParam_) {
|
||||||
// check if extreme can be moved from this parameter configuration
|
// check if extreme can be moved from this parameter configuration
|
||||||
double tmp_x = this->compute_shape(1.0);
|
double tmp_x = this->compute_shape(1.0);
|
||||||
double tmp_res = me(tmp_x);
|
double tmp_res = me(tmp_x);
|
||||||
if (tmp_res > min_level) {
|
if (tmp_res > min_level) {
|
||||||
// please note that in this case
|
// please note that in this case
|
||||||
// lenghtAtParam_ + rightFactor_ == strokeLength_
|
// lengthAtParam_ + rightFactor_ == strokeLength_
|
||||||
// (by ctor).
|
// (by ctor).
|
||||||
if (rightFactor_ != 0.0)
|
if (rightFactor_ != 0.0)
|
||||||
x = (lenght_at_value2test - lenghtAtParam_) / rightFactor_;
|
x = (length_at_value2test - lengthAtParam_) / rightFactor_;
|
||||||
else
|
else
|
||||||
x = 0.0;
|
x = 0.0;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ double ToonzExt::NotSimmetricBezierPotential::compute_value(
|
||||||
if (areAlmostEqual(x, 1.0)) x = 1.0;
|
if (areAlmostEqual(x, 1.0)) x = 1.0;
|
||||||
|
|
||||||
double how_many_of_shape =
|
double how_many_of_shape =
|
||||||
(strokeLength_ - lenghtAtParam_) / (actionLength_ * 0.5);
|
(strokeLength_ - lengthAtParam_) / (actionLength_ * 0.5);
|
||||||
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
||||||
|
|
||||||
myBlendFunc bf(how_many_of_shape);
|
myBlendFunc bf(how_many_of_shape);
|
||||||
|
@ -158,13 +158,13 @@ double ToonzExt::NotSimmetricBezierPotential::compute_value(
|
||||||
double tmp_x = this->compute_shape(0.0);
|
double tmp_x = this->compute_shape(0.0);
|
||||||
double tmp_res = me(tmp_x);
|
double tmp_res = me(tmp_x);
|
||||||
if (tmp_res > min_level) {
|
if (tmp_res > min_level) {
|
||||||
double x = lenght_at_value2test / leftFactor_;
|
double x = length_at_value2test / leftFactor_;
|
||||||
assert(0.0 <= x && x <= 1.0);
|
assert(0.0 <= x && x <= 1.0);
|
||||||
|
|
||||||
// then movement use another shape
|
// then movement use another shape
|
||||||
double diff = x - 1.0;
|
double diff = x - 1.0;
|
||||||
|
|
||||||
double how_many_of_shape = lenghtAtParam_ / (actionLength_ * 0.5);
|
double how_many_of_shape = lengthAtParam_ / (actionLength_ * 0.5);
|
||||||
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
||||||
|
|
||||||
myBlendFunc bf(how_many_of_shape);
|
myBlendFunc bf(how_many_of_shape);
|
||||||
|
@ -181,8 +181,8 @@ double ToonzExt::NotSimmetricBezierPotential::compute_value(
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ToonzExt::Potential *ToonzExt::NotSimmetricBezierPotential::clone() {
|
ToonzExt::Potential *ToonzExt::NotSymmetricBezierPotential::clone() {
|
||||||
return new NotSimmetricBezierPotential;
|
return new NotSymmetricBezierPotential;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ext/NotSimmetricExpPotential.h"
|
#include "ext/NotSymmetricExpPotential.h"
|
||||||
|
|
||||||
#include <tmathutil.h>
|
#include <tmathutil.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -57,7 +57,7 @@ struct blender_2 {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ToonzExt::NotSimmetricExpPotential::setParameters_(const TStroke *ref,
|
void ToonzExt::NotSymmetricExpPotential::setParameters_(const TStroke *ref,
|
||||||
double par, double al) {
|
double par, double al) {
|
||||||
ref_ = ref;
|
ref_ = ref;
|
||||||
par_ = par;
|
par_ = par;
|
||||||
|
@ -66,14 +66,14 @@ void ToonzExt::NotSimmetricExpPotential::setParameters_(const TStroke *ref,
|
||||||
assert(ref_);
|
assert(ref_);
|
||||||
|
|
||||||
strokeLength_ = ref->getLength();
|
strokeLength_ = ref->getLength();
|
||||||
lenghtAtParam_ = ref->getLength(par);
|
lengthAtParam_ = ref->getLength(par);
|
||||||
|
|
||||||
// lunghezza dal pto di click all'inizio della curva
|
// lunghezza dal pto di click all'inizio della curva
|
||||||
leftFactor_ = min(lenghtAtParam_,
|
leftFactor_ = min(lengthAtParam_,
|
||||||
actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_;
|
actionLength_ * 0.5); // lengthAtParam_ / strokeLength_;
|
||||||
|
|
||||||
// lunghezza dal pto di click alla fine
|
// 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].
|
// considero come intervallo di mapping [-range,range].
|
||||||
// 4 ha come valore c.a. 10exp-6
|
// 4 ha come valore c.a. 10exp-6
|
||||||
|
@ -83,11 +83,11 @@ void ToonzExt::NotSimmetricExpPotential::setParameters_(const TStroke *ref,
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ToonzExt::NotSimmetricExpPotential::~NotSimmetricExpPotential() {}
|
ToonzExt::NotSymmetricExpPotential::~NotSymmetricExpPotential() {}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
double ToonzExt::NotSimmetricExpPotential::value_(double value2test) const {
|
double ToonzExt::NotSymmetricExpPotential::value_(double value2test) const {
|
||||||
assert(0.0 <= value2test && value2test <= 1.0);
|
assert(0.0 <= value2test && value2test <= 1.0);
|
||||||
return this->compute_value(value2test);
|
return this->compute_value(value2test);
|
||||||
}
|
}
|
||||||
|
@ -95,18 +95,18 @@ double ToonzExt::NotSimmetricExpPotential::value_(double value2test) const {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// normalization of parameter in range interval
|
// normalization of parameter in range interval
|
||||||
double ToonzExt::NotSimmetricExpPotential::compute_shape(
|
double ToonzExt::NotSymmetricExpPotential::compute_shape(
|
||||||
double value2test) const {
|
double value2test) const {
|
||||||
double x = ref_->getLength(value2test);
|
double x = ref_->getLength(value2test);
|
||||||
double shape = this->actionLength_ * 0.5;
|
double shape = this->actionLength_ * 0.5;
|
||||||
if (isAlmostZero(shape)) shape = 1.0;
|
if (isAlmostZero(shape)) shape = 1.0;
|
||||||
x = ((x - lenghtAtParam_) * range_) / shape;
|
x = ((x - lengthAtParam_) * range_) / shape;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
double ToonzExt::NotSimmetricExpPotential::compute_value(
|
double ToonzExt::NotSymmetricExpPotential::compute_value(
|
||||||
double value2test) const {
|
double value2test) const {
|
||||||
myExp me;
|
myExp me;
|
||||||
mySqr ms;
|
mySqr ms;
|
||||||
|
@ -131,13 +131,13 @@ double ToonzExt::NotSimmetricExpPotential::compute_value(
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
double res = 0.0;
|
double res = 0.0;
|
||||||
|
|
||||||
// lenght at parameter
|
// length at parameter
|
||||||
x = ref_->getLength(value2test);
|
x = ref_->getLength(value2test);
|
||||||
|
|
||||||
const double tolerance = 2.0; // need to be pixel based
|
const double tolerance = 2.0; // need to be pixel based
|
||||||
// if is an extreme
|
// if is an extreme
|
||||||
if (max(lenghtAtParam_, 0.0) < tolerance ||
|
if (max(lengthAtParam_, 0.0) < tolerance ||
|
||||||
max(strokeLength_ - lenghtAtParam_, 0.0) < tolerance) {
|
max(strokeLength_ - lengthAtParam_, 0.0) < tolerance) {
|
||||||
double tmp_al = actionLength_ * 0.5;
|
double tmp_al = actionLength_ * 0.5;
|
||||||
|
|
||||||
// compute correct parameter considering offset
|
// compute correct parameter considering offset
|
||||||
|
@ -156,26 +156,26 @@ double ToonzExt::NotSimmetricExpPotential::compute_value(
|
||||||
res = sq(x);
|
res = sq(x);
|
||||||
} else // when is not an extreme
|
} else // when is not an extreme
|
||||||
{
|
{
|
||||||
double lenght_at_value2test = ref_->getLength(value2test);
|
double length_at_value2test = ref_->getLength(value2test);
|
||||||
|
|
||||||
const double min_level = 0.01;
|
const double min_level = 0.01;
|
||||||
// if check a parameter over click point
|
// if check a parameter over click point
|
||||||
if (lenght_at_value2test >= lenghtAtParam_) {
|
if (length_at_value2test >= lengthAtParam_) {
|
||||||
// check if extreme can be moved from this parameter configuration
|
// check if extreme can be moved from this parameter configuration
|
||||||
double tmp_x = this->compute_shape(1.0);
|
double tmp_x = this->compute_shape(1.0);
|
||||||
double tmp_res = me(tmp_x);
|
double tmp_res = me(tmp_x);
|
||||||
if (tmp_res > min_level) {
|
if (tmp_res > min_level) {
|
||||||
// please note that in this case
|
// please note that in this case
|
||||||
// lenghtAtParam_ + rightFactor_ == strokeLength_
|
// lengthAtParam_ + rightFactor_ == strokeLength_
|
||||||
// (by ctor).
|
// (by ctor).
|
||||||
x = (lenght_at_value2test - lenghtAtParam_) / rightFactor_;
|
x = (length_at_value2test - lengthAtParam_) / rightFactor_;
|
||||||
assert(0.0 <= x && x <= 1.0);
|
assert(0.0 <= x && x <= 1.0);
|
||||||
|
|
||||||
// then movement use another shape
|
// then movement use another shape
|
||||||
double exp_val = me(x * range_);
|
double exp_val = me(x * range_);
|
||||||
|
|
||||||
double how_many_of_shape =
|
double how_many_of_shape =
|
||||||
(strokeLength_ - lenghtAtParam_) / (actionLength_ * 0.5);
|
(strokeLength_ - lengthAtParam_) / (actionLength_ * 0.5);
|
||||||
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
||||||
|
|
||||||
// return ms(x);
|
// return ms(x);
|
||||||
|
@ -186,13 +186,13 @@ double ToonzExt::NotSimmetricExpPotential::compute_value(
|
||||||
double tmp_x = this->compute_shape(0.0);
|
double tmp_x = this->compute_shape(0.0);
|
||||||
double tmp_res = me(tmp_x);
|
double tmp_res = me(tmp_x);
|
||||||
if (tmp_res > min_level) {
|
if (tmp_res > min_level) {
|
||||||
double x = lenght_at_value2test / leftFactor_;
|
double x = length_at_value2test / leftFactor_;
|
||||||
assert(0.0 <= x && x <= 1.0);
|
assert(0.0 <= x && x <= 1.0);
|
||||||
|
|
||||||
// then movement use another shape
|
// then movement use another shape
|
||||||
double diff = x - 1.0;
|
double diff = x - 1.0;
|
||||||
double exp_val = me(diff * range_);
|
double exp_val = me(diff * range_);
|
||||||
double how_many_of_shape = lenghtAtParam_ / (actionLength_ * 0.5);
|
double how_many_of_shape = lengthAtParam_ / (actionLength_ * 0.5);
|
||||||
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
assert(0.0 <= how_many_of_shape && how_many_of_shape <= 1.0);
|
||||||
|
|
||||||
// return ms(diff);
|
// return ms(diff);
|
||||||
|
@ -209,11 +209,11 @@ double ToonzExt::NotSimmetricExpPotential::compute_value(
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ToonzExt::Potential *ToonzExt::NotSimmetricExpPotential::clone() {
|
ToonzExt::Potential *ToonzExt::NotSymmetricExpPotential::clone() {
|
||||||
return new NotSimmetricExpPotential;
|
return new NotSymmetricExpPotential;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEL double ToonzExt::NotSimmetricExpPotential::gradient(double value2test)
|
// DEL double ToonzExt::NotSymmetricExpPotential::gradient(double value2test)
|
||||||
// const
|
// const
|
||||||
// DEL {
|
// DEL {
|
||||||
// DEL assert(false);
|
// DEL assert(false);
|
|
@ -7,7 +7,7 @@
|
||||||
#include "ext/StrokeDeformation.h"
|
#include "ext/StrokeDeformation.h"
|
||||||
//#include "ext/SquarePotential.h"
|
//#include "ext/SquarePotential.h"
|
||||||
//#include "ext/StrokeParametricDeformer.h"
|
//#include "ext/StrokeParametricDeformer.h"
|
||||||
#include "ext/NotSimmetricBezierPotential.h"
|
#include "ext/NotSymmetricBezierPotential.h"
|
||||||
#include "ext/ContextStatus.h"
|
#include "ext/ContextStatus.h"
|
||||||
#include "ext/Designer.h"
|
#include "ext/Designer.h"
|
||||||
//#include "ext/TriParam.h"
|
//#include "ext/TriParam.h"
|
||||||
|
@ -31,7 +31,7 @@ REGISTER(SmoothDeformation, 1);
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
SmoothDeformation::SmoothDeformation() {
|
SmoothDeformation::SmoothDeformation() {
|
||||||
setPotential(new NotSimmetricBezierPotential);
|
setPotential(new NotSymmetricBezierPotential);
|
||||||
shortcutKey_ = ContextStatus::ALT;
|
shortcutKey_ = ContextStatus::ALT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@ void ToonzExt::SquarePotential::setParameters_(const TStroke *ref, double par,
|
||||||
assert(ref_);
|
assert(ref_);
|
||||||
|
|
||||||
strokeLength_ = ref->getLength();
|
strokeLength_ = ref->getLength();
|
||||||
lenghtAtParam_ = ref->getLength(par);
|
lengthAtParam_ = ref->getLength(par);
|
||||||
|
|
||||||
// lunghezza dal pto di click all'inizio della curva
|
// lunghezza dal pto di click all'inizio della curva
|
||||||
leftFactor_ = min(lenghtAtParam_,
|
leftFactor_ = min(lengthAtParam_,
|
||||||
actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_;
|
actionLength_ * 0.5); // lengthAtParam_ / strokeLength_;
|
||||||
|
|
||||||
// lunghezza dal pto di click alla fine
|
// 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].
|
// considero come intervallo di mapping [-range,range].
|
||||||
// 4 ha come valore c.a. 10exp-6
|
// 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 x = ref_->getLength(value2test);
|
||||||
double shape = this->actionLength_ * 0.5;
|
double shape = this->actionLength_ * 0.5;
|
||||||
if (isAlmostZero(shape)) shape = 1.0;
|
if (isAlmostZero(shape)) shape = 1.0;
|
||||||
x = ((x - lenghtAtParam_) * range_) / shape;
|
x = ((x - lengthAtParam_) * range_) / shape;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ double ToonzExt::SquarePotential::compute_value(double value2test) const {
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
double res = 0.0;
|
double res = 0.0;
|
||||||
|
|
||||||
// lenght at parameter
|
// length at parameter
|
||||||
x = ref_->getLength(value2test);
|
x = ref_->getLength(value2test);
|
||||||
|
|
||||||
double tmp_al = actionLength_ * 0.5;
|
double tmp_al = actionLength_ * 0.5;
|
||||||
|
@ -79,10 +79,10 @@ double ToonzExt::SquarePotential::compute_value(double value2test) const {
|
||||||
else if (rightFactor_ == 0.0)
|
else if (rightFactor_ == 0.0)
|
||||||
x = (x - (strokeLength_ - tmp_al)) / tmp_al;
|
x = (x - (strokeLength_ - tmp_al)) / tmp_al;
|
||||||
else {
|
else {
|
||||||
if (x <= lenghtAtParam_ && ((lenghtAtParam_ - x) <= leftFactor_))
|
if (x <= lengthAtParam_ && ((lengthAtParam_ - x) <= leftFactor_))
|
||||||
x = (x - (lenghtAtParam_ - leftFactor_)) / leftFactor_;
|
x = (x - (lengthAtParam_ - leftFactor_)) / leftFactor_;
|
||||||
else if (x > lenghtAtParam_ && ((x - lenghtAtParam_) < rightFactor_))
|
else if (x > lengthAtParam_ && ((x - lengthAtParam_) < rightFactor_))
|
||||||
x = (rightFactor_ - (x - lenghtAtParam_)) / rightFactor_;
|
x = (rightFactor_ - (x - lengthAtParam_)) / rightFactor_;
|
||||||
else
|
else
|
||||||
x = -1;
|
x = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "ext/StrokeDeformation.h"
|
#include "ext/StrokeDeformation.h"
|
||||||
#include "ext/LinearPotential.h"
|
#include "ext/LinearPotential.h"
|
||||||
//#include "ext/StrokeParametricDeformer.h"
|
//#include "ext/StrokeParametricDeformer.h"
|
||||||
//#include "ext/NotSimmetricBezierPotential.h"
|
//#include "ext/NotSymmetricBezierPotential.h"
|
||||||
#include "ext/ContextStatus.h"
|
#include "ext/ContextStatus.h"
|
||||||
#include "ext/Designer.h"
|
#include "ext/Designer.h"
|
||||||
//#include "ext/TriParam.h"
|
//#include "ext/TriParam.h"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "ext/StrokeDeformation.h"
|
#include "ext/StrokeDeformation.h"
|
||||||
#include "ext/SquarePotential.h"
|
#include "ext/SquarePotential.h"
|
||||||
#include "ext/StrokeParametricDeformer.h"
|
#include "ext/StrokeParametricDeformer.h"
|
||||||
#include "ext/NotSimmetricBezierPotential.h"
|
#include "ext/NotSymmetricBezierPotential.h"
|
||||||
#include "ext/SmoothDeformation.h"
|
#include "ext/SmoothDeformation.h"
|
||||||
#include "ext/ContextStatus.h"
|
#include "ext/ContextStatus.h"
|
||||||
#include "ext/Designer.h"
|
#include "ext/Designer.h"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "ext/StrokeDeformation.h"
|
#include "ext/StrokeDeformation.h"
|
||||||
#include "ext/SquarePotential.h"
|
#include "ext/SquarePotential.h"
|
||||||
#include "ext/StrokeParametricDeformer.h"
|
#include "ext/StrokeParametricDeformer.h"
|
||||||
//#include "ext/NotSimmetricBezierPotential.h"
|
//#include "ext/NotSymmetricBezierPotential.h"
|
||||||
#include "ext/ContextStatus.h"
|
#include "ext/ContextStatus.h"
|
||||||
#include "ext/Designer.h"
|
#include "ext/Designer.h"
|
||||||
//#include "ext/TriParam.h"
|
//#include "ext/TriParam.h"
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ext/StrokeParametricDeformer.h"
|
#include "ext/StrokeParametricDeformer.h"
|
||||||
#include "ext/NotSimmetricExpPotential.h"
|
#include "ext/NotSymmetricExpPotential.h"
|
||||||
//#include "ext/NotSimmetricBezierPotential.h"
|
//#include "ext/NotSymmetricBezierPotential.h"
|
||||||
//#include "ext/SquarePotential.h"
|
//#include "ext/SquarePotential.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -18,9 +18,9 @@ using namespace std;
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ToonzExt::StrokeParametricDeformer::StrokeParametricDeformer(
|
ToonzExt::StrokeParametricDeformer::StrokeParametricDeformer(
|
||||||
double actionLenght, double startParameter, TStroke *s, Potential *pot)
|
double actionLength, double startParameter, TStroke *s, Potential *pot)
|
||||||
: startParameter_(startParameter)
|
: startParameter_(startParameter)
|
||||||
, actionLenght_(actionLenght)
|
, actionLength_(actionLength)
|
||||||
, vx_(1.0)
|
, vx_(1.0)
|
||||||
, vy_(1.0)
|
, vy_(1.0)
|
||||||
, pot_(0) {
|
, pot_(0) {
|
||||||
|
@ -37,28 +37,28 @@ ToonzExt::StrokeParametricDeformer::StrokeParametricDeformer(
|
||||||
// double
|
// double
|
||||||
// max_length = s->getLength();
|
// max_length = s->getLength();
|
||||||
|
|
||||||
// if( actionLenght == -1 )
|
// if( actionLength == -1 )
|
||||||
// {
|
// {
|
||||||
// assert(false && "Rispristina la vecchia gestione");
|
// assert(false && "Rispristina la vecchia gestione");
|
||||||
// actionLenght_ = 2.0 * max_length;
|
// actionLength_ = 2.0 * max_length;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
assert(0.0 <= actionLenght_);
|
assert(0.0 <= actionLength_);
|
||||||
// && actionLenght_ <= max_length );
|
// && actionLength_ <= max_length );
|
||||||
|
|
||||||
if (0.0 > actionLenght_) actionLenght_ = 0.0;
|
if (0.0 > actionLength_) actionLength_ = 0.0;
|
||||||
// else if ( actionLenght_ > max_length )
|
// else if ( actionLength_ > max_length )
|
||||||
// actionLenght_ = max_length;
|
// actionLength_ = max_length;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pot_ = pot;
|
pot_ = pot;
|
||||||
if (!pot_)
|
if (!pot_)
|
||||||
throw std::invalid_argument("Not Possible to have a ref of Potential!!!");
|
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_);
|
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) {
|
void ToonzExt::StrokeParametricDeformer::getRange(double &from, double &to) {
|
||||||
double x = ref_copy_->getLength(startParameter_);
|
double x = ref_copy_->getLength(startParameter_);
|
||||||
double delta = x - actionLenght_ * 0.5;
|
double delta = x - actionLength_ * 0.5;
|
||||||
if (delta > 0)
|
if (delta > 0)
|
||||||
from = ref_copy_->getParameterAtLength(delta);
|
from = ref_copy_->getParameterAtLength(delta);
|
||||||
else
|
else
|
||||||
from = 0.0;
|
from = 0.0;
|
||||||
|
|
||||||
delta = x + actionLenght_ * 0.5;
|
delta = x + actionLength_ * 0.5;
|
||||||
if (delta < ref_copy_->getLength())
|
if (delta < ref_copy_->getLength())
|
||||||
to = ref_copy_->getParameterAtLength(delta);
|
to = ref_copy_->getParameterAtLength(delta);
|
||||||
else
|
else
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace {
|
||||||
const UINT MAX_SAMPLE = 2;
|
const UINT MAX_SAMPLE = 2;
|
||||||
const int MY_ERROR = -1;
|
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_BEGIN = 0;
|
||||||
const int IS_END = 1;
|
const int IS_END = 1;
|
||||||
|
|
|
@ -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;
|
if (index == 0 || index == 4 || index == 1 || index == 5) return index + 2;
|
||||||
return index - 2;
|
return index - 2;
|
||||||
}
|
}
|
||||||
|
@ -648,14 +648,14 @@ TPointD DragSelectionTool::Scale::computeScaleValue(int movedIndex,
|
||||||
else
|
else
|
||||||
return TPointD(scale2.x, scale1.y);
|
return TPointD(scale2.x, scale1.y);
|
||||||
}
|
}
|
||||||
int simmetricIndex = m_deformTool->getSimmetricPointIndex(movedIndex);
|
int symmetricIndex = m_deformTool->getSymmetricPointIndex(movedIndex);
|
||||||
TPointD s = m_startBboxs[0].getPoint(simmetricIndex);
|
TPointD s = m_startBboxs[0].getPoint(symmetricIndex);
|
||||||
TPointD center = m_scaleInCenter ? m_startCenter : s;
|
TPointD center = m_scaleInCenter ? m_startCenter : s;
|
||||||
TPointD nearP =
|
TPointD nearP =
|
||||||
m_startBboxs[0].getPoint(m_deformTool->getBeforePointIndex(movedIndex));
|
m_startBboxs[0].getPoint(m_deformTool->getBeforePointIndex(movedIndex));
|
||||||
TPointD pc = getIntersectionPoint(nearP, p, p, s, center);
|
TPointD pc = getIntersectionPoint(nearP, p, p, s, center);
|
||||||
TPointD newp = newBbox.getPoint(movedIndex);
|
TPointD newp = newBbox.getPoint(movedIndex);
|
||||||
TPointD news = newBbox.getPoint(simmetricIndex);
|
TPointD news = newBbox.getPoint(symmetricIndex);
|
||||||
TPointD newNearP =
|
TPointD newNearP =
|
||||||
newBbox.getPoint(m_deformTool->getBeforePointIndex(movedIndex));
|
newBbox.getPoint(m_deformTool->getBeforePointIndex(movedIndex));
|
||||||
TPointD newpc = getIntersectionPoint(newNearP, newp, newp, news, center);
|
TPointD newpc = getIntersectionPoint(newNearP, newp, newp, news, center);
|
||||||
|
@ -690,8 +690,8 @@ TPointD DragSelectionTool::Scale::getScaledPoint(int index,
|
||||||
const TPointD scaleValue,
|
const TPointD scaleValue,
|
||||||
const TPointD center) {
|
const TPointD center) {
|
||||||
TPointD p = oldBbox.getPoint(index);
|
TPointD p = oldBbox.getPoint(index);
|
||||||
int simmetricIndex = m_deformTool->getSimmetricPointIndex(index);
|
int symmetricIndex = m_deformTool->getSymmetricPointIndex(index);
|
||||||
TPointD s = oldBbox.getPoint(simmetricIndex);
|
TPointD s = oldBbox.getPoint(symmetricIndex);
|
||||||
if (index < 4) {
|
if (index < 4) {
|
||||||
int beforeIndex = m_deformTool->getBeforePointIndex(index);
|
int beforeIndex = m_deformTool->getBeforePointIndex(index);
|
||||||
int nextIndex = m_deformTool->getNextPointIndex(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 nearP = oldBbox.getPoint(m_deformTool->getBeforePointIndex(index));
|
||||||
TPointD nearS =
|
TPointD nearS =
|
||||||
oldBbox.getPoint(m_deformTool->getBeforePointIndex(simmetricIndex));
|
oldBbox.getPoint(m_deformTool->getBeforePointIndex(symmetricIndex));
|
||||||
TPointD pc = getIntersectionPoint(nearP, p, p, s, center);
|
TPointD pc = getIntersectionPoint(nearP, p, p, s, center);
|
||||||
TPointD sc = getIntersectionPoint(nearS, s, p, s, center);
|
TPointD sc = getIntersectionPoint(nearS, s, p, s, center);
|
||||||
if (center == pc) return pc;
|
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);
|
FourPoints xBbox = bboxScale(xIndex, bbox, m_startCenter);
|
||||||
TPointD xCenter = getScaledPoint(
|
TPointD xCenter = getScaledPoint(
|
||||||
xIndex, xBbox, scaleValue,
|
xIndex, xBbox, scaleValue,
|
||||||
xBbox.getPoint(m_deformTool->getSimmetricPointIndex(xIndex)));
|
xBbox.getPoint(m_deformTool->getSymmetricPointIndex(xIndex)));
|
||||||
FourPoints yBbox = bboxScale(yIndex, bbox, m_startCenter);
|
FourPoints yBbox = bboxScale(yIndex, bbox, m_startCenter);
|
||||||
TPointD yCenter = getScaledPoint(
|
TPointD yCenter = getScaledPoint(
|
||||||
yIndex, yBbox, scaleValue,
|
yIndex, yBbox, scaleValue,
|
||||||
yBbox.getPoint(m_deformTool->getSimmetricPointIndex(yIndex)));
|
yBbox.getPoint(m_deformTool->getSymmetricPointIndex(yIndex)));
|
||||||
TPointD in = getIntersectionPoint(bbox.getP00(), bbox.getP10(), bbox.getP10(),
|
TPointD in = getIntersectionPoint(bbox.getP00(), bbox.getP10(), bbox.getP10(),
|
||||||
bbox.getP11(), xCenter);
|
bbox.getP11(), xCenter);
|
||||||
return getIntersectionPoint(in, xCenter, bbox.getP00(), bbox.getP10(),
|
return getIntersectionPoint(in, xCenter, bbox.getP00(), bbox.getP10(),
|
||||||
|
@ -758,19 +758,19 @@ FourPoints DragSelectionTool::Scale::bboxScaleInCenter(
|
||||||
FourPoints bbox = bboxScale(index, oldBbox, newPos);
|
FourPoints bbox = bboxScale(index, oldBbox, newPos);
|
||||||
if (recomputeScaleValue) scaleValue = computeScaleValue(index, bbox);
|
if (recomputeScaleValue) scaleValue = computeScaleValue(index, bbox);
|
||||||
if (!m_scaleInCenter) return 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
|
// Gestisco il caso particolare in cui uno dei fattori di scalatura e' -100% e
|
||||||
// center e' al centro della bbox
|
// center e' al centro della bbox
|
||||||
if (bbox.getPoint(index) == oldBbox.getPoint(simmetricIndex)) {
|
if (bbox.getPoint(index) == oldBbox.getPoint(symmetricIndex)) {
|
||||||
bbox.setPoint(simmetricIndex, oldBbox.getPoint(index));
|
bbox.setPoint(symmetricIndex, oldBbox.getPoint(index));
|
||||||
bbox.setPoint(m_deformTool->getNextPointIndex(simmetricIndex),
|
bbox.setPoint(m_deformTool->getNextPointIndex(symmetricIndex),
|
||||||
oldBbox.getPoint(m_deformTool->getBeforePointIndex(index)));
|
oldBbox.getPoint(m_deformTool->getBeforePointIndex(index)));
|
||||||
bbox.setPoint(m_deformTool->getBeforePointIndex(simmetricIndex),
|
bbox.setPoint(m_deformTool->getBeforePointIndex(symmetricIndex),
|
||||||
oldBbox.getPoint(m_deformTool->getNextPointIndex(index)));
|
oldBbox.getPoint(m_deformTool->getNextPointIndex(index)));
|
||||||
} else
|
} else
|
||||||
bbox =
|
bbox =
|
||||||
bboxScale(simmetricIndex, bbox,
|
bboxScale(symmetricIndex, bbox,
|
||||||
getScaledPoint(simmetricIndex, oldBbox, scaleValue, center));
|
getScaledPoint(symmetricIndex, oldBbox, scaleValue, center));
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,9 +806,9 @@ void DragSelectionTool::Scale::leftButtonDrag(const TPointD &pos,
|
||||||
delta = pos - m_deformTool->getCurPos();
|
delta = pos - m_deformTool->getCurPos();
|
||||||
else
|
else
|
||||||
delta = pos - m_deformTool->getStartPos();
|
delta = pos - m_deformTool->getStartPos();
|
||||||
int simmetricIndex = m_deformTool->getSimmetricPointIndex(selectedIndex);
|
int symmetricIndex = m_deformTool->getSymmetricPointIndex(selectedIndex);
|
||||||
TPointD simmetricPoint = tool->getBBox().getPoint(simmetricIndex);
|
TPointD symmetricPoint = tool->getBBox().getPoint(symmetricIndex);
|
||||||
TPointD v = normalize(point - simmetricPoint);
|
TPointD v = normalize(point - symmetricPoint);
|
||||||
delta = v * (v * delta);
|
delta = v * (v * delta);
|
||||||
newPos = point + delta;
|
newPos = point + delta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ public:
|
||||||
|
|
||||||
void addTransformUndo() override = 0;
|
void addTransformUndo() override = 0;
|
||||||
|
|
||||||
int getSimmetricPointIndex(int index) const;
|
int getSymmetricPointIndex(int index) const;
|
||||||
/*! Return before point \b index between possible point index
|
/*! Return before point \b index between possible point index
|
||||||
* {0,4,1,5,2,6,3,7}, include middle point. */
|
* {0,4,1,5,2,6,3,7}, include middle point. */
|
||||||
int getBeforePointIndex(int index) const;
|
int getBeforePointIndex(int index) const;
|
||||||
|
@ -287,7 +287,7 @@ straight line for
|
||||||
TPointD getNewCenter(int index, const FourPoints bbox,
|
TPointD getNewCenter(int index, const FourPoints bbox,
|
||||||
const TPointD scaleValue);
|
const TPointD scaleValue);
|
||||||
/*! Scale \b bbox \b index point in pos and if \b m_scaleInCenter is true
|
/*! 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. */
|
compute scaleValue. */
|
||||||
FourPoints bboxScaleInCenter(int index, const FourPoints &oldBbox,
|
FourPoints bboxScaleInCenter(int index, const FourPoints &oldBbox,
|
||||||
const TPointD newPos, TPointD &scaleValue,
|
const TPointD newPos, TPointD &scaleValue,
|
||||||
|
|
|
@ -841,7 +841,7 @@ TPointD DragSelectionTool::VectorScaleTool::transform(int index,
|
||||||
FourPoints oldBbox = startBboxs[i];
|
FourPoints oldBbox = startBboxs[i];
|
||||||
TPointD frameCenter =
|
TPointD frameCenter =
|
||||||
scaleInCenter ? center
|
scaleInCenter ? center
|
||||||
: oldBbox.getPoint(getSimmetricPointIndex(index));
|
: oldBbox.getPoint(getSymmetricPointIndex(index));
|
||||||
TPointD newp =
|
TPointD newp =
|
||||||
m_scale->getScaledPoint(index, oldBbox, scaleValue, frameCenter);
|
m_scale->getScaledPoint(index, oldBbox, scaleValue, frameCenter);
|
||||||
FourPoints newBbox = m_scale->bboxScaleInCenter(
|
FourPoints newBbox = m_scale->bboxScaleInCenter(
|
||||||
|
|
|
@ -456,9 +456,9 @@ bool ItemViewPlayWidget::PlayManager::isFrameIndexInRange() {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool ItemViewPlayWidget::PlayManager::setCurrentFrameIndexFromXValue(
|
bool ItemViewPlayWidget::PlayManager::setCurrentFrameIndexFromXValue(
|
||||||
int xValue, int lenght) {
|
int xValue, int length) {
|
||||||
if (m_fids.size() == 0) return false;
|
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);
|
int newIndex = tround((double)xValue / d);
|
||||||
if (newIndex == m_currentFidIndex) return false;
|
if (newIndex == m_currentFidIndex) return false;
|
||||||
m_currentFidIndex = newIndex;
|
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;
|
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;
|
return d * m_currentFidIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,23 +536,23 @@ void ItemViewPlayWidget::setIsPlaying(DvItemListModel *model, int index) {
|
||||||
|
|
||||||
void ItemViewPlayWidget::setIsPlayingCurrentFrameIndex(DvItemListModel *model,
|
void ItemViewPlayWidget::setIsPlayingCurrentFrameIndex(DvItemListModel *model,
|
||||||
int index, int xValue,
|
int index, int xValue,
|
||||||
int lenght) {
|
int length) {
|
||||||
m_isSliderMode = true;
|
m_isSliderMode = true;
|
||||||
|
|
||||||
if (m_currentItemIndex == -1) {
|
if (m_currentItemIndex == -1) {
|
||||||
m_currentItemIndex = index;
|
m_currentItemIndex = index;
|
||||||
m_playManager->setInfo(model, 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
|
stop(); // Devo fare stop prima di cambiare il frame corrente
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int ItemViewPlayWidget::getCurrentFramePosition(int lenght) {
|
int ItemViewPlayWidget::getCurrentFramePosition(int length) {
|
||||||
if (m_playManager->isFrameIndexInRange())
|
if (m_playManager->isFrameIndexInRange())
|
||||||
return m_playManager->currentFrameIndexToXValue(lenght);
|
return m_playManager->currentFrameIndexToXValue(length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ class ItemViewPlayWidget final : public QWidget {
|
||||||
bool getCurrentFrame();
|
bool getCurrentFrame();
|
||||||
/*! Return true if current frame index is less than fids size. */
|
/*! Return true if current frame index is less than fids size. */
|
||||||
bool isFrameIndexInRange();
|
bool isFrameIndexInRange();
|
||||||
bool setCurrentFrameIndexFromXValue(int xValue, int lenght);
|
bool setCurrentFrameIndexFromXValue(int xValue, int length);
|
||||||
double currentFrameIndexToXValue(int lenght);
|
double currentFrameIndexToXValue(int length);
|
||||||
QPixmap getCurrentPixmap();
|
QPixmap getCurrentPixmap();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ public:
|
||||||
|
|
||||||
void setIsPlaying(DvItemListModel *model, int index);
|
void setIsPlaying(DvItemListModel *model, int index);
|
||||||
void setIsPlayingCurrentFrameIndex(DvItemListModel *model, int index,
|
void setIsPlayingCurrentFrameIndex(DvItemListModel *model, int index,
|
||||||
int xValue, int lenght);
|
int xValue, int length);
|
||||||
int getCurrentFramePosition(int lenght);
|
int getCurrentFramePosition(int length);
|
||||||
|
|
||||||
bool isIndexPlaying(int index) { return m_currentItemIndex == index; }
|
bool isIndexPlaying(int index) { return m_currentItemIndex == index; }
|
||||||
bool isPlaying() { return m_currentItemIndex != -1; }
|
bool isPlaying() { return m_currentItemIndex != -1; }
|
||||||
|
|
|
@ -158,7 +158,7 @@ int MetNum::Approx(int n, int m, double **x, double y[], double c[]) {
|
||||||
|
|
||||||
/* prepara la matrice dei coefficienti */
|
/* prepara la matrice dei coefficienti */
|
||||||
for (i = 0; i < m; i++)
|
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;
|
A[i][j] = 0;
|
||||||
for (k = 0; k < n; k++) A[i][j] += x[i][k] * x[j][k];
|
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 ---------------------------------*/
|
/*--------------------------- Cholesky ---------------------------------*/
|
||||||
/* SCOPO */
|
/* SCOPO */
|
||||||
/*Esegue la fattorizzazione di Cholesky ( A = L*t(L) ) di una matrice */
|
/*Esegue la fattorizzazione di Cholesky ( A = L*t(L) ) di una matrice */
|
||||||
/*simmetrica definita positiva. */
|
/*symmetrica definita positiva. */
|
||||||
/* */
|
/* */
|
||||||
/* SPECIFICHE */
|
/* SPECIFICHE */
|
||||||
/* int Cholesky(int n, double **A) */
|
/* 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: */
|
/* precisamente pu essere: */
|
||||||
/* 0 nessun errore */
|
/* 0 nessun errore */
|
||||||
/* -1 n<1 */
|
/* -1 n<1 */
|
||||||
/* k>0 la matrice non simmetrica def. positiva; */
|
/* k>0 la matrice non symmetrica def. positiva; */
|
||||||
/* la riga k non accettabile */
|
/* la riga k non accettabile */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
int MetNum::Cholesky(int n, double **A) {
|
int MetNum::Cholesky(int n, double **A) {
|
||||||
|
|
|
@ -112,7 +112,7 @@ void AviCodecRestrictions::getRestrictions(const std::wstring &codecName,
|
||||||
// Loop until we can find a width, height, and depth that works!
|
// Loop until we can find a width, height, and depth that works!
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// check the x lenght
|
// check the x length
|
||||||
bi.bmiHeader.biBitCount = bpp;
|
bi.bmiHeader.biBitCount = bpp;
|
||||||
for (i = 3; i >= 0; i--) {
|
for (i = 3; i >= 0; i--) {
|
||||||
bi.bmiHeader.biWidth = lx + (1 << 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")
|
restrictions = QObject::tr("video width must be a multiple of %1")
|
||||||
.arg(QString::number(1 << (i + 1)));
|
.arg(QString::number(1 << (i + 1)));
|
||||||
|
|
||||||
// check the y lenght
|
// check the y length
|
||||||
bi.bmiHeader.biWidth = 640;
|
bi.bmiHeader.biWidth = 640;
|
||||||
for (i = 3; i >= 0; i--) {
|
for (i = 3; i >= 0; i--) {
|
||||||
bi.bmiHeader.biHeight = ly + (1 << i);
|
bi.bmiHeader.biHeight = ly + (1 << i);
|
||||||
|
@ -136,7 +136,7 @@ void AviCodecRestrictions::getRestrictions(const std::wstring &codecName,
|
||||||
}
|
}
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
restrictions = restrictions + "\n" +
|
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)));
|
.arg(QString::number(1 << (i + 1)));
|
||||||
|
|
||||||
ICClose(hic);
|
ICClose(hic);
|
||||||
|
|
|
@ -367,7 +367,7 @@ void Painter::doFlushRasterImages(const TRasterP &rin, int bg,
|
||||||
|
|
||||||
// Following lines are used to solve a problem that occurs with some
|
// Following lines are used to solve a problem that occurs with some
|
||||||
// graphics cards!
|
// 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!
|
// isn't a multiple of 8!
|
||||||
TDimension backgroundDim(lx, ly);
|
TDimension backgroundDim(lx, ly);
|
||||||
backgroundDim.lx = (lx & 0x7) == 0 ? lx : lx + 8 - (lx & 0x7);
|
backgroundDim.lx = (lx & 0x7) == 0 ? lx : lx + 8 - (lx & 0x7);
|
||||||
|
|
|
@ -39,10 +39,10 @@ PointPair computeTexParameters(const TPointD &p1, const TPointD &p2,
|
||||||
TPointD v = (newP.first + newP.second) * 0.5 - (p2 + p1) * 0.5;
|
TPointD v = (newP.first + newP.second) * 0.5 - (p2 + p1) * 0.5;
|
||||||
|
|
||||||
// compute length of opposite segment
|
// 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
|
// 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
|
// fix value for s
|
||||||
tex.first.x = 0.5 - texParameterOffset;
|
tex.first.x = 0.5 - texParameterOffset;
|
||||||
|
|
|
@ -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.
|
// Per ogni pixel illumina anche i vicini per gestire l'antialias.
|
||||||
void makeAntiAliasedDiskBorder(const TRasterCM32P &ras, const TPoint ¢re,
|
void makeAntiAliasedDiskBorder(const TRasterCM32P &ras, const TPoint ¢re,
|
||||||
const TPoint &point,
|
const TPoint &point,
|
||||||
|
|
|
@ -161,7 +161,7 @@ void TBinarizer::process(const TRaster32P &ras) {
|
||||||
// cerco il massimo
|
// cerco il massimo
|
||||||
while (i > 0 && histo[i - 1] > histo[i]) i--;
|
while (i > 0 && histo[i - 1] > histo[i]) i--;
|
||||||
int i1 = 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;
|
int i2 = 2 * i1 - i0;
|
||||||
bgThreshold = i2 - 1;
|
bgThreshold = i2 - 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,8 +487,8 @@ void PageViewer::drawColorName(QPainter &p, QRect &nameRect, TColorStyle *style,
|
||||||
QFont font = p.font();
|
QFont font = p.font();
|
||||||
int fontSize = font.pointSize();
|
int fontSize = font.pointSize();
|
||||||
if (fontSize == -1) fontSize = font.pixelSize();
|
if (fontSize == -1) fontSize = font.pixelSize();
|
||||||
int lenght = index.length() * fontSize;
|
int length = index.length() * fontSize;
|
||||||
int w = (lenght > 11) ? (lenght) : 11;
|
int w = (length > 11) ? (length) : 11;
|
||||||
int h = 11;
|
int h = 11;
|
||||||
int x0 = nameRect.right() - w + 1;
|
int x0 = nameRect.right() - w + 1;
|
||||||
int y0 = nameRect.top() - h - 1;
|
int y0 = nameRect.top() - h - 1;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<translation>视频宽度必须是 %1 的倍数</translation>
|
<translation>视频宽度必须是 %1 的倍数</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>video lenght must be a multiple of %1</source>
|
<source>video length must be a multiple of %1</source>
|
||||||
<translation>视频长度必须是 %1 的倍数</translation>
|
<translation>视频长度必须是 %1 的倍数</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -189,7 +189,7 @@
|
||||||
<translation>la largeur de la vidéo doit être un multiple de 1%</translation>
|
<translation>la largeur de la vidéo doit être un multiple de 1%</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>video lenght must be a multiple of %1</source>
|
<source>video length must be a multiple of %1</source>
|
||||||
<translation>la hauteur de la vidéo doit être un multiple de 1%</translation>
|
<translation>la hauteur de la vidéo doit être un multiple de 1%</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<translation>Video-Breite muss ein mehrfaches von %1 sein</translation>
|
<translation>Video-Breite muss ein mehrfaches von %1 sein</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>video lenght must be a multiple of %1</source>
|
<source>video length must be a multiple of %1</source>
|
||||||
<translation>Video-Länge muss ein mehrfaches von %1 sein</translation>
|
<translation>Video-Länge muss ein mehrfaches von %1 sein</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -189,7 +189,7 @@
|
||||||
<translation>la larghezza del video deve essere un multiplo di %1</translation>
|
<translation>la larghezza del video deve essere un multiplo di %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>video lenght must be a multiple of %1</source>
|
<source>video length must be a multiple of %1</source>
|
||||||
<translation>l'altezza del video deve essere un multiplo di %1</translation>
|
<translation>l'altezza del video deve essere un multiplo di %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<translation>ビデオ幅は %1 の倍数でなければなりません</translation>
|
<translation>ビデオ幅は %1 の倍数でなければなりません</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>video lenght must be a multiple of %1</source>
|
<source>video length must be a multiple of %1</source>
|
||||||
<translation>ビデオの長さは %1 の倍数でなければなりません</translation>
|
<translation>ビデオの長さは %1 の倍数でなければなりません</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -189,7 +189,7 @@
|
||||||
<translation>el ancho del video debe ser múltiplo de %1</translation>
|
<translation>el ancho del video debe ser múltiplo de %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>video lenght must be a multiple of %1</source>
|
<source>video length must be a multiple of %1</source>
|
||||||
<translation>la altura del video debe ser múltiplo de %1</translation>
|
<translation>la altura del video debe ser múltiplo de %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
Loading…
Reference in a new issue