Refactoring. Use more safe function VFuzzyComparePossibleNulls.
--HG-- branch : develop
This commit is contained in:
parent
38dac0ada5
commit
be7277eeba
|
@ -42,4 +42,20 @@ inline QString NameRegExp()
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
|
||||||
|
{
|
||||||
|
if(qFuzzyIsNull(p1))
|
||||||
|
{
|
||||||
|
return qFuzzyIsNull(p2);
|
||||||
|
}
|
||||||
|
else if(qFuzzyIsNull(p2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return qFuzzyCompare(p1, p2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // QMUDEF_H
|
#endif // QMUDEF_H
|
||||||
|
|
|
@ -389,9 +389,9 @@ qreal QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const
|
||||||
|
|
||||||
// Backwards compatible calculation of epsilon inc case the user doesnt provide
|
// Backwards compatible calculation of epsilon inc case the user doesnt provide
|
||||||
// his own epsilon
|
// his own epsilon
|
||||||
if (qFuzzyCompare(fEpsilon + 1, 1 + 0))
|
if (qFuzzyIsNull(fEpsilon))
|
||||||
{
|
{
|
||||||
fEpsilon = (qFuzzyCompare(a_fPos + 1, 1 + 0)) ? static_cast<qreal>(1e-10) : static_cast<qreal>(1e-7) * a_fPos;
|
fEpsilon = qFuzzyIsNull(a_fPos) ? static_cast<qreal>(1e-10) : static_cast<qreal>(1e-7) * a_fPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
*a_Var = a_fPos+2 * fEpsilon; f[0] = Eval();
|
*a_Var = a_fPos+2 * fEpsilon; f[0] = Eval();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
******************************************************************************************************/
|
******************************************************************************************************/
|
||||||
|
|
||||||
#include "qmuparserbase.h"
|
#include "qmuparserbase.h"
|
||||||
|
#include "qmudef.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#ifdef QMUP_USE_OPENMP
|
#ifdef QMUP_USE_OPENMP
|
||||||
|
@ -854,7 +855,7 @@ void QmuParserBase::ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type>
|
||||||
token_type vVal1 = a_stVal.pop();
|
token_type vVal1 = a_stVal.pop();
|
||||||
token_type vExpr = a_stVal.pop();
|
token_type vExpr = a_stVal.pop();
|
||||||
|
|
||||||
a_stVal.push( (qFuzzyCompare(vExpr.GetVal()+1, 1+0)==false) ? vVal1 : vVal2);
|
a_stVal.push( not qFuzzyIsNull(vExpr.GetVal()) ? vVal1 : vVal2);
|
||||||
|
|
||||||
token_type opIf = a_stOpt.pop();
|
token_type opIf = a_stOpt.pop();
|
||||||
Q_ASSERT(opElse.GetCode()==cmELSE);
|
Q_ASSERT(opElse.GetCode()==cmELSE);
|
||||||
|
@ -983,11 +984,11 @@ qreal QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
|
||||||
continue;
|
continue;
|
||||||
case cmNEQ:
|
case cmNEQ:
|
||||||
--sidx;
|
--sidx;
|
||||||
Stack[sidx] = (qFuzzyCompare(Stack[sidx], Stack[sidx+1])==false);
|
Stack[sidx] = not QmuFuzzyComparePossibleNulls(Stack[sidx], Stack[sidx+1]);
|
||||||
continue;
|
continue;
|
||||||
case cmEQ:
|
case cmEQ:
|
||||||
--sidx;
|
--sidx;
|
||||||
Stack[sidx] = qFuzzyCompare(Stack[sidx], Stack[sidx+1]);
|
Stack[sidx] = QmuFuzzyComparePossibleNulls(Stack[sidx], Stack[sidx+1]);
|
||||||
continue;
|
continue;
|
||||||
case cmLT:
|
case cmLT:
|
||||||
--sidx;
|
--sidx;
|
||||||
|
@ -1059,7 +1060,7 @@ qreal QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
|
||||||
//Stack[sidx] = *pTok->Oprt.ptr = Stack[sidx+1];
|
//Stack[sidx] = *pTok->Oprt.ptr = Stack[sidx+1];
|
||||||
//continue;
|
//continue;
|
||||||
case cmIF:
|
case cmIF:
|
||||||
if (qFuzzyCompare(Stack[sidx--]+1, 1+0))
|
if (qFuzzyIsNull(Stack[sidx--]))
|
||||||
{
|
{
|
||||||
pTok += pTok->Oprt.offset;
|
pTok += pTok->Oprt.offset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
******************************************************************************************************/
|
******************************************************************************************************/
|
||||||
|
|
||||||
#include "qmuparserbytecode.h"
|
#include "qmuparserbytecode.h"
|
||||||
|
#include "qmuparsertoken.h"
|
||||||
|
#include "qmudef.h"
|
||||||
|
|
||||||
#include <QStack>
|
#include <QStack>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "qmuparsertoken.h"
|
|
||||||
#include <QtCore/qmath.h>
|
#include <QtCore/qmath.h>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
@ -165,11 +166,11 @@ void QmuParserByteCode::ConstantFolding(ECmdCode a_Oprt)
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
break;
|
break;
|
||||||
case cmNEQ:
|
case cmNEQ:
|
||||||
x = (qFuzzyCompare(x, y) == false);
|
x = not QmuFuzzyComparePossibleNulls(x, y);
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
break;
|
break;
|
||||||
case cmEQ:
|
case cmEQ:
|
||||||
x = qFuzzyCompare(x, y);
|
x = QmuFuzzyComparePossibleNulls(x, y);
|
||||||
m_vRPN.pop_back();
|
m_vRPN.pop_back();
|
||||||
break;
|
break;
|
||||||
case cmADD:
|
case cmADD:
|
||||||
|
@ -342,7 +343,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
|
||||||
break;
|
break;
|
||||||
case cmDIV:
|
case cmDIV:
|
||||||
if (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
|
if (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
|
||||||
(qFuzzyCompare(m_vRPN.at(sz-1).Val.data2+1, 1+0)==false))
|
not qFuzzyIsNull(m_vRPN.at(sz-1).Val.data2))
|
||||||
{
|
{
|
||||||
// Optimization: 4*a/2 -> 2*a
|
// Optimization: 4*a/2 -> 2*a
|
||||||
m_vRPN[sz-2].Val.data /= m_vRPN.at(sz-1).Val.data2;
|
m_vRPN[sz-2].Val.data /= m_vRPN.at(sz-1).Val.data2;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
******************************************************************************************************/
|
******************************************************************************************************/
|
||||||
|
|
||||||
#include "qmuparsertest.h"
|
#include "qmuparsertest.h"
|
||||||
|
#include "qmudef.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -1345,7 +1346,7 @@ int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass
|
||||||
// String parsing and bytecode parsing must yield the same result
|
// String parsing and bytecode parsing must yield the same result
|
||||||
fVal[0] = p1->Eval(); // result from stringparsing
|
fVal[0] = p1->Eval(); // result from stringparsing
|
||||||
fVal[1] = p1->Eval(); // result from bytecode
|
fVal[1] = p1->Eval(); // result from bytecode
|
||||||
if ( qFuzzyCompare( fVal[0], fVal[1] ) == false )
|
if ( not QmuFuzzyComparePossibleNulls( fVal[0], fVal[1] ) )
|
||||||
{
|
{
|
||||||
throw QmuParserError ( "Bytecode / string parsing mismatch." );
|
throw QmuParserError ( "Bytecode / string parsing mismatch." );
|
||||||
}
|
}
|
||||||
|
@ -1400,7 +1401,8 @@ int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
bCloseEnough &= (qFuzzyCompare( fabs ( fVal[i] ), std::numeric_limits<qreal>::infinity())==false );
|
bCloseEnough &= (not QmuFuzzyComparePossibleNulls( fabs ( fVal[i] ),
|
||||||
|
std::numeric_limits<qreal>::infinity()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,8 +1424,9 @@ int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass
|
||||||
{
|
{
|
||||||
if ( a_fPass )
|
if ( a_fPass )
|
||||||
{
|
{
|
||||||
if ( (qFuzzyCompare(fVal[0], fVal[2])==false) && (qFuzzyCompare(fVal[0], -999)==false) &&
|
if ( not QmuFuzzyComparePossibleNulls(fVal[0], fVal[2]) &&
|
||||||
(qFuzzyCompare(fVal[1], -998 )==false))
|
not QmuFuzzyComparePossibleNulls(fVal[0], -999) &&
|
||||||
|
not QmuFuzzyComparePossibleNulls(fVal[1], -998 ))
|
||||||
{
|
{
|
||||||
qWarning() << "\n fail: " << a_str << " (copy construction)";
|
qWarning() << "\n fail: " << a_str << " (copy construction)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,8 @@ QPointF VArc::GetP2 () const
|
||||||
*/
|
*/
|
||||||
qreal VArc::AngleArc() const
|
qreal VArc::AngleArc() const
|
||||||
{
|
{
|
||||||
if ((qFuzzyCompare(d->f1+1, 0+1) && qFuzzyCompare(d->f2, 360)) ||
|
if ((qFuzzyIsNull(d->f1) && qFuzzyCompare(d->f2, 360)) ||
|
||||||
(qFuzzyCompare(d->f1, 360) && qFuzzyCompare(d->f2+1, 0+1)))
|
(qFuzzyCompare(d->f1, 360) && qFuzzyIsNull(d->f2)))
|
||||||
{
|
{
|
||||||
return 360;
|
return 360;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,12 +198,12 @@ QPointF VEllipticalArc::GetPoint (qreal angle) const
|
||||||
{
|
{
|
||||||
y = -y;
|
y = -y;
|
||||||
}
|
}
|
||||||
else if (qFuzzyCompare(angle, 90))
|
else if (VFuzzyComparePossibleNulls(angle, 90))
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
y = d->radius2;
|
y = d->radius2;
|
||||||
}
|
}
|
||||||
else if (qFuzzyCompare(angle, 270))
|
else if (VFuzzyComparePossibleNulls(angle, 270))
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
y = -d->radius2;
|
y = -d->radius2;
|
||||||
|
|
|
@ -304,7 +304,8 @@ QPointF VGObject::LineIntersectRect(const QRectF &rec, const QLineF &line)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VGObject::IntersectionCircles(const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1, QPointF &p2)
|
int VGObject::IntersectionCircles(const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1, QPointF &p2)
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(c1.x(), c2.x()) && qFuzzyCompare(c1.y(), c2.y()) && qFuzzyCompare(r1, r2))
|
if (VFuzzyComparePossibleNulls(c1.x(), c2.x()) && VFuzzyComparePossibleNulls(c1.y(), c2.y())
|
||||||
|
&& VFuzzyComparePossibleNulls(r1, r2))
|
||||||
{
|
{
|
||||||
return 3;// Circles are equal
|
return 3;// Circles are equal
|
||||||
}
|
}
|
||||||
|
@ -319,7 +320,7 @@ int VGObject::IntersectionCircles(const QPointF &c1, double r1, const QPointF &c
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (qFuzzyCompare(c*c, r1*r1*(a*a+b*b)))
|
else if (VFuzzyComparePossibleNulls(c*c, r1*r1*(a*a+b*b)))
|
||||||
{
|
{
|
||||||
p1 = QPointF(x0 + c1.x(), y0 + c1.y());
|
p1 = QPointF(x0 + c1.x(), y0 + c1.y());
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -360,7 +361,7 @@ qint32 VGObject::LineIntersectCircle(const QPointF ¢er, qreal radius, const
|
||||||
// how many solutions?
|
// how many solutions?
|
||||||
qint32 flag = 0;
|
qint32 flag = 0;
|
||||||
const qreal d = QLineF (center, p).length();
|
const qreal d = QLineF (center, p).length();
|
||||||
if (qFuzzyCompare(d, radius))
|
if (VFuzzyComparePossibleNulls(d, radius))
|
||||||
{
|
{
|
||||||
flag = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +508,7 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
|
||||||
int VGObject::PointInCircle(const QPointF &p, const QPointF ¢er, qreal radius)
|
int VGObject::PointInCircle(const QPointF &p, const QPointF ¢er, qreal radius)
|
||||||
{
|
{
|
||||||
const double d = QLineF (p, center).length();
|
const double d = QLineF (p, center).length();
|
||||||
if (qFuzzyCompare(radius, d))
|
if (VFuzzyComparePossibleNulls(radius, d))
|
||||||
{
|
{
|
||||||
return 1; // on circle
|
return 1; // on circle
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,7 @@ qint32 VSpline::Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c)
|
||||||
x.insert(0, aa+bb-a/3.); // Real root
|
x.insert(0, aa+bb-a/3.); // Real root
|
||||||
x.insert(1, (-0.5)*(aa+bb)-a/3.); //Complex root
|
x.insert(1, (-0.5)*(aa+bb)-a/3.); //Complex root
|
||||||
x.insert(2, (sqrt(3.)*0.5)*fabs(aa-bb)); // Complex root
|
x.insert(2, (sqrt(3.)*0.5)*fabs(aa-bb)); // Complex root
|
||||||
if (qFuzzyCompare(x.at(2) + 1, 0. + 1))
|
if (qFuzzyIsNull(x.at(2)))
|
||||||
{
|
{
|
||||||
return(2);
|
return(2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,11 @@
|
||||||
#define VSPLINEPOINT_P_H
|
#define VSPLINEPOINT_P_H
|
||||||
|
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
#include "vpointf.h"
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "vpointf.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
#ifdef Q_CC_GNU
|
#ifdef Q_CC_GNU
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Weffc++"
|
#pragma GCC diagnostic ignored "-Weffc++"
|
||||||
|
@ -57,9 +59,9 @@ public:
|
||||||
kAsm1(kAsm1),
|
kAsm1(kAsm1),
|
||||||
kAsm2(kAsm2)
|
kAsm2(kAsm2)
|
||||||
{
|
{
|
||||||
if (not qFuzzyCompare(qAbs(angle1-angle2), 180) || qFuzzyIsNull(qAbs(angle1-angle2)))
|
if (VFuzzyComparePossibleNulls(angle1, angle2) || not qFuzzyCompare(qAbs(angle1-angle2), 180) )
|
||||||
{
|
{
|
||||||
qDebug()<<"angle1 and angle2 are not equal.";
|
qDebug()<<"Make angle1 and angle2 correct.";
|
||||||
this->angle1 = angle1;
|
this->angle1 = angle1;
|
||||||
this->angle2 = angle1 + 180;
|
this->angle2 = angle1 + 180;
|
||||||
}
|
}
|
||||||
|
@ -127,9 +129,9 @@ public:
|
||||||
length2(length2),
|
length2(length2),
|
||||||
length2F(length2F)
|
length2F(length2F)
|
||||||
{
|
{
|
||||||
if (not qFuzzyCompare(qAbs(angle1-angle2), 180) || qFuzzyIsNull(qAbs(angle1-angle2)))
|
if (VFuzzyComparePossibleNulls(angle1, angle2) || not qFuzzyCompare(qAbs(angle1-angle2), 180))
|
||||||
{
|
{
|
||||||
qDebug()<<"angle1 and angle2 are not equal.";
|
qDebug()<<"Make angle1 and angle2 correct.";
|
||||||
this->angle2 = angle1 + 180;
|
this->angle2 = angle1 + 180;
|
||||||
this->angle2F = QString().number(angle2);
|
this->angle2F = QString().number(angle2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -501,7 +501,7 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
|
||||||
const qreal xj = gContour.at(j).x(); //-V807
|
const qreal xj = gContour.at(j).x(); //-V807
|
||||||
const qreal yi = gContour.at(i).y();
|
const qreal yi = gContour.at(i).y();
|
||||||
const qreal yj = gContour.at(j).y();
|
const qreal yj = gContour.at(j).y();
|
||||||
if (qFuzzyCompare(yj, yi))
|
if (VFuzzyComparePossibleNulls(yj, yi))
|
||||||
{
|
{
|
||||||
constant.insert(i, xi);
|
constant.insert(i, xi);
|
||||||
multiple.insert(i, 0);
|
multiple.insert(i, 0);
|
||||||
|
@ -586,7 +586,7 @@ void VPosition::CombineEdges(VLayoutDetail &detail, const QLineF &globalEdge, co
|
||||||
|
|
||||||
// Now we move detail to position near to global contour edge.
|
// Now we move detail to position near to global contour edge.
|
||||||
detail.Translate(dx, dy);
|
detail.Translate(dx, dy);
|
||||||
if (not qFuzzyCompare(angle_between+360, 0+360))
|
if (not qFuzzyIsNull(angle_between) || not qFuzzyCompare(angle_between, 360))
|
||||||
{
|
{
|
||||||
detail.Rotate(detailEdge.p2(), -angle_between);
|
detail.Rotate(detailEdge.p2(), -angle_between);
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,7 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, quint32 shift)
|
||||||
void VPosition::Rotate(int increase)
|
void VPosition::Rotate(int increase)
|
||||||
{
|
{
|
||||||
int startAngle = 0;
|
int startAngle = 0;
|
||||||
if (qFuzzyCompare(angle_between+360, 0+360))
|
if (VFuzzyComparePossibleNulls(angle_between, 360))
|
||||||
{
|
{
|
||||||
startAngle = increase;
|
startAngle = increase;
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,4 +606,20 @@ QSharedPointer<QPrinter> DefaultPrinter();
|
||||||
|
|
||||||
QPixmap darkenPixmap(const QPixmap &pixmap);
|
QPixmap darkenPixmap(const QPixmap &pixmap);
|
||||||
|
|
||||||
|
static inline bool VFuzzyComparePossibleNulls(double p1, double p2)
|
||||||
|
{
|
||||||
|
if(qFuzzyIsNull(p1))
|
||||||
|
{
|
||||||
|
return qFuzzyIsNull(p2);
|
||||||
|
}
|
||||||
|
else if(qFuzzyIsNull(p2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return qFuzzyCompare(p1, p2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // DEF_H
|
#endif // DEF_H
|
||||||
|
|
|
@ -94,7 +94,7 @@ void VVariable::SetValue(const qreal &size, const qreal &height, Unit patternUni
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VVariable::IsNotUsed() const
|
bool VVariable::IsNotUsed() const
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(d->base+1, 0+1) && qFuzzyCompare(d->ksize+1, 0+1) && qFuzzyCompare(d->kheight+1, 0+1))
|
if (qFuzzyIsNull(d->base) && qFuzzyIsNull(d->ksize) && qFuzzyIsNull(d->kheight))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ bool VFormula::operator==(const VFormula &formula) const
|
||||||
if (this->formula == formula.GetFormula() && this->value == formula.getStringValue() &&
|
if (this->formula == formula.GetFormula() && this->value == formula.getStringValue() &&
|
||||||
this->checkZero == formula.getCheckZero() && this->data == formula.getData() &&
|
this->checkZero == formula.getCheckZero() && this->data == formula.getData() &&
|
||||||
this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() &&
|
this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() &&
|
||||||
this->_error == formula.error() && qFuzzyCompare(this->dValue, formula.getDoubleValue()))
|
this->_error == formula.error() && VFuzzyComparePossibleNulls(this->dValue, formula.getDoubleValue()))
|
||||||
{
|
{
|
||||||
isEqual = true;
|
isEqual = true;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ void VFormula::Eval()
|
||||||
delete cal;
|
delete cal;
|
||||||
|
|
||||||
//if result equal 0
|
//if result equal 0
|
||||||
if (checkZero && qFuzzyCompare(1 + result, 1 + 0))
|
if (checkZero && qFuzzyIsNull(result))
|
||||||
{
|
{
|
||||||
value = QString("0");
|
value = QString("0");
|
||||||
_error = true;
|
_error = true;
|
||||||
|
|
|
@ -396,7 +396,7 @@ void DialogArc::CheckAngles()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qFuzzyCompare(angleF1 + 1, angleF2 + 1))
|
if (VFuzzyComparePossibleNulls(angleF1, angleF2))
|
||||||
{
|
{
|
||||||
flagF1 = false;
|
flagF1 = false;
|
||||||
ChangeColor(ui->labelEditF1, Qt::red);
|
ChangeColor(ui->labelEditF1, Qt::red);
|
||||||
|
|
|
@ -368,7 +368,7 @@ void DialogArcWithLength::Length()
|
||||||
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
|
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
|
||||||
const qreal length = Eval(ui->plainTextEditLength->toPlainText(), flagLength, ui->labelResultLength, postfix);
|
const qreal length = Eval(ui->plainTextEditLength->toPlainText(), flagLength, ui->labelResultLength, postfix);
|
||||||
|
|
||||||
if (qFuzzyCompare(length+1, 0+1))
|
if (qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
flagLength = false;
|
flagLength = false;
|
||||||
ChangeColor(labelEditFormula, Qt::red);
|
ChangeColor(labelEditFormula, Qt::red);
|
||||||
|
|
|
@ -480,7 +480,7 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
|
||||||
delete cal;
|
delete cal;
|
||||||
|
|
||||||
//if result equal 0
|
//if result equal 0
|
||||||
if (checkZero && qFuzzyCompare(1 + result, 1 + 0))
|
if (checkZero && qFuzzyIsNull(result))
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
ChangeColor(labelEditFormula, Qt::red);
|
ChangeColor(labelEditFormula, Qt::red);
|
||||||
|
|
|
@ -244,7 +244,7 @@ void VToolArc::SetFormulaF1(const VFormula &value)
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
||||||
|
|
||||||
if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetEndAngle() + 1)==false)// Angles can't be equal
|
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetEndAngle()))// Angles can't be equal
|
||||||
{
|
{
|
||||||
arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
|
arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
|
@ -272,7 +272,7 @@ void VToolArc::SetFormulaF2(const VFormula &value)
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
||||||
if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetStartAngle() + 1)==false)// Angles can't be equal
|
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetStartAngle()))// Angles can't be equal
|
||||||
{
|
{
|
||||||
arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
|
arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
|
|
|
@ -213,7 +213,7 @@ void VToolArcWithLength::SetFormulaF1(const VFormula &value)
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
||||||
|
|
||||||
if (qFuzzyCompare(value.getDoubleValue() + 1, arc->GetEndAngle() + 1)==false)// Angles can't be equal
|
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetEndAngle()))// Angles can't be equal
|
||||||
{
|
{
|
||||||
arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
|
arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
|
|
|
@ -100,7 +100,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
|
||||||
qDebug()<<"Correction of length in shoulder point tool. Parameter length too small.";
|
qDebug()<<"Correction of length in shoulder point tool. Parameter length too small.";
|
||||||
toolLength = dist;
|
toolLength = dist;
|
||||||
}
|
}
|
||||||
if (qFuzzyCompare(dist, toolLength))
|
if (VFuzzyComparePossibleNulls(dist, toolLength))
|
||||||
{
|
{
|
||||||
return line.p2();
|
return line.p2();
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
if ( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0))
|
if ( qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && (pRotate == 0))
|
||||||
{
|
{
|
||||||
id = det.at(i).getId();
|
id = det.at(i).getId();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
|
if (qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && pRotate == 0)
|
||||||
{
|
{
|
||||||
id = det.at(i).getId();
|
id = det.at(i).getId();
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
|
if (qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && pRotate == 0)
|
||||||
{
|
{
|
||||||
id = det.at(i).getId();
|
id = det.at(i).getId();
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
|
if (qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && pRotate == 0)
|
||||||
{
|
{
|
||||||
id = det.at(i).getId();
|
id = det.at(i).getId();
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
||||||
point->setMode(Draw::Modeling);
|
point->setMode(Draw::Modeling);
|
||||||
|
@ -308,7 +308,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
||||||
{
|
{
|
||||||
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
const QPointF p = data->GeometricObject<VPointF>(pRotate)->toQPointF();
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
||||||
|
@ -334,7 +334,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
|
|
|
@ -79,7 +79,7 @@ void VisToolAlongLine::RefreshGeometry()
|
||||||
|
|
||||||
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
if (not qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
QLineF mainLine = VGObject::BuildLine(first->toQPointF(), length, line->line().angle());
|
QLineF mainLine = VGObject::BuildLine(first->toQPointF(), length, line->line().angle());
|
||||||
DrawLine(this, mainLine, mainColor, lineStyle);
|
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||||
|
|
|
@ -50,7 +50,7 @@ void VisToolArc::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||||
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && f2 >= 0 && qFuzzyCompare(1 + f1, 1 + f2) == false)
|
if (not qFuzzyIsNull(radius) && f1 >= 0 && f2 >= 0 && not VFuzzyComparePossibleNulls(f1, f2))
|
||||||
{
|
{
|
||||||
VArc arc = VArc (*first, radius, f1, f2);
|
VArc arc = VArc (*first, radius, f1, f2);
|
||||||
DrawPath(this, arc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, arc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
|
@ -50,7 +50,7 @@ void VisToolArcWithLength::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||||
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && qFuzzyCompare(1 + length, 1 + 0) == false)
|
if (not qFuzzyIsNull(radius) && f1 >= 0 && not qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
VArc arc = VArc (length, *first, radius, f1);
|
VArc arc = VArc (length, *first, radius, f1);
|
||||||
DrawPath(this, arc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, arc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
|
@ -98,7 +98,7 @@ void VisToolBisector::RefreshGeometry()
|
||||||
|
|
||||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
if (not qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
qreal angle = VToolBisector::BisectorAngle(first->toQPointF(), second->toQPointF(),
|
qreal angle = VToolBisector::BisectorAngle(first->toQPointF(), second->toQPointF(),
|
||||||
third->toQPointF());
|
third->toQPointF());
|
||||||
|
|
|
@ -61,7 +61,7 @@ void VisToolCurveIntersectAxis::RefreshGeometry()
|
||||||
{
|
{
|
||||||
QLineF axis;
|
QLineF axis;
|
||||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(axisPointId);
|
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(axisPointId);
|
||||||
if (qFuzzyCompare(angle, -1))
|
if (VFuzzyComparePossibleNulls(angle, -1))
|
||||||
{
|
{
|
||||||
axis = Axis(first->toQPointF(), Visualization::scenePos);
|
axis = Axis(first->toQPointF(), Visualization::scenePos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ void VisToolCutArc::RefreshGeometry()
|
||||||
const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(object1Id);
|
const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(object1Id);
|
||||||
DrawPath(this, arc->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, arc->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
if (not qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
VArc ar1;
|
VArc ar1;
|
||||||
VArc ar2;
|
VArc ar2;
|
||||||
|
|
|
@ -56,7 +56,7 @@ void VisToolCutSpline::RefreshGeometry()
|
||||||
const auto spl = Visualization::data->GeometricObject<VAbstractCubicBezier>(object1Id);
|
const auto spl = Visualization::data->GeometricObject<VAbstractCubicBezier>(object1Id);
|
||||||
DrawPath(this, spl->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, spl->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
if (not qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
QPointF spl1p2;
|
QPointF spl1p2;
|
||||||
QPointF spl1p3;
|
QPointF spl1p3;
|
||||||
|
|
|
@ -75,7 +75,7 @@ void VisToolLineIntersectAxis::RefreshGeometry()
|
||||||
{
|
{
|
||||||
QLineF axis;
|
QLineF axis;
|
||||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(axisPointId);
|
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(axisPointId);
|
||||||
if (qFuzzyCompare(angle, -1))
|
if (VFuzzyComparePossibleNulls(angle, -1))
|
||||||
{
|
{
|
||||||
axis = Axis(third->toQPointF(), Visualization::scenePos);
|
axis = Axis(third->toQPointF(), Visualization::scenePos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ void VisToolNormal::RefreshGeometry()
|
||||||
QLineF line_mouse(first->toQPointF(), second->toQPointF());
|
QLineF line_mouse(first->toQPointF(), second->toQPointF());
|
||||||
DrawLine(line, line_mouse, supportColor);
|
DrawLine(line, line_mouse, supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + length, 1 + 0))
|
if (qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
QLineF normal = line_mouse.normalVector();
|
QLineF normal = line_mouse.normalVector();
|
||||||
QPointF endRay = Ray(normal.p1(), normal.angle());
|
QPointF endRay = Ray(normal.p1(), normal.angle());
|
||||||
|
|
|
@ -74,7 +74,7 @@ void VisToolPointOfContact::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId);
|
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId);
|
||||||
DrawPoint(arc_point, third->toQPointF(), supportColor);
|
DrawPoint(arc_point, third->toQPointF(), supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false)
|
if (not qFuzzyIsNull(radius))
|
||||||
{
|
{
|
||||||
QPointF fPoint = VToolPointOfContact::FindPoint(radius, third->toQPointF(), first->toQPointF(),
|
QPointF fPoint = VToolPointOfContact::FindPoint(radius, third->toQPointF(), first->toQPointF(),
|
||||||
second->toQPointF());
|
second->toQPointF());
|
||||||
|
|
|
@ -80,7 +80,7 @@ void VisToolShoulderPoint::RefreshGeometry()
|
||||||
|
|
||||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||||
|
|
||||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
if (not qFuzzyIsNull(length))
|
||||||
{
|
{
|
||||||
QPointF fPoint = VToolShoulderPoint::FindPoint(second->toQPointF(), third->toQPointF(),
|
QPointF fPoint = VToolShoulderPoint::FindPoint(second->toQPointF(), third->toQPointF(),
|
||||||
first->toQPointF(), length);
|
first->toQPointF(), length);
|
||||||
|
|
|
@ -141,7 +141,7 @@ void VisToolSpline::RefreshGeometry()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qFuzzyCompare(angle1, EMPTY_ANGLE) || qFuzzyCompare(angle2, EMPTY_ANGLE))
|
if (VFuzzyComparePossibleNulls(angle1, EMPTY_ANGLE) || VFuzzyComparePossibleNulls(angle2, EMPTY_ANGLE))
|
||||||
{
|
{
|
||||||
VSpline spline(*first, p2, p3, *second);
|
VSpline spline(*first, p2, p3, *second);
|
||||||
DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, spline.GetPath(PathDirection::Hide), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
|
@ -192,7 +192,7 @@ void TST_VArc::TestGetPoints()
|
||||||
{
|
{
|
||||||
qreal gSquere = 0.0;// geometry square
|
qreal gSquere = 0.0;// geometry square
|
||||||
|
|
||||||
if (qFuzzyCompare(arc.AngleArc(), 360.0))
|
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
||||||
{// circle square
|
{// circle square
|
||||||
gSquere = M_PI * radius * radius;
|
gSquere = M_PI * radius * radius;
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ void TST_VEllipticalArc::TestGetPoints3()
|
||||||
VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle);
|
VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle);
|
||||||
QVector<QPointF> points = arc.GetPoints();
|
QVector<QPointF> points = arc.GetPoints();
|
||||||
|
|
||||||
if (qFuzzyCompare(arc.AngleArc(), 360.0))
|
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
||||||
{// calculated full ellipse square
|
{// calculated full ellipse square
|
||||||
const qreal ellipseSquare = M_PI * radius1 * radius2;
|
const qreal ellipseSquare = M_PI * radius1 * radius2;
|
||||||
const qreal epsSquare = ellipseSquare * 0.5 / 100; // computing error 0.5 % from origin squere
|
const qreal epsSquare = ellipseSquare * 0.5 / 100; // computing error 0.5 % from origin squere
|
||||||
|
@ -361,7 +361,7 @@ void TST_VEllipticalArc::TestGetPoints4()
|
||||||
const VPointF center;
|
const VPointF center;
|
||||||
VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle);
|
VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle);
|
||||||
|
|
||||||
if (qFuzzyCompare(arc.AngleArc(), 360.0))
|
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
||||||
{// calculated full ellipse length
|
{// calculated full ellipse length
|
||||||
const qreal h = ((radius1-radius2)*(radius1-radius2))/((radius1+radius2)*(radius1+radius2));
|
const qreal h = ((radius1-radius2)*(radius1-radius2))/((radius1+radius2)*(radius1+radius2));
|
||||||
const qreal ellipseLength = M_PI*(radius1+radius2)*(1+3*h/(10+qSqrt(4-3*h)));
|
const qreal ellipseLength = M_PI*(radius1+radius2)*(1+3*h/(10+qSqrt(4-3*h)));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user