Little fixes

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-02-19 11:43:46 +02:00
parent 37eb0e9e21
commit 6fc86543ec
2 changed files with 9 additions and 7 deletions

View File

@ -125,13 +125,13 @@ VEllipticalArc::~VEllipticalArc()
*/
qreal VEllipticalArc::GetLength() const
{
qreal length;
qreal length = 0;
QPainterPath elArc;
QVector<QPointF> points = GetPoints();
elArc.moveTo(points.at(0));
for (qint32 i = 1; i < points.count(); ++i)
{
elArc.lineTo(points.at(i));
elArc.lineTo(points.at(i));
}
length = elArc.length();
@ -344,7 +344,9 @@ void VEllipticalArc::FindF2(qreal length)
//---------------------------------------------------------------------------------------------------------------------
qreal VEllipticalArc::MaxLength() const
{
return M_PI*(d->radius1+d->radius2);
const qreal h = ((d->radius1-d->radius2)*(d->radius1-d->radius2))/((d->radius1+d->radius2)*(d->radius1+d->radius2));
const qreal ellipseLength = M_PI*(d->radius1+d->radius2)*(1+3*h/(10+qSqrt(4-3*h)));
return ellipseLength;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -190,19 +190,19 @@ void TST_VArc::TestGetPoints()
}
{
qreal gSquere = 0.0;// geometry squere
qreal gSquere = 0.0;// geometry square
if (qFuzzyCompare(arc.AngleArc(), 360.0))
{// circle squere
{// circle square
gSquere = M_PI * radius * radius;
}
else
{// sector squere
{// sector square
gSquere = (M_PI * radius * radius) / 360.0 * arc.AngleArc();
points.append(center.toQPointF());
}
// calculated squere
// calculated square
const qreal cSquare = qAbs(VAbstractDetail::SumTrapezoids(points)/2.0);
const qreal value = qAbs(gSquere - cSquare);
const QString errorMsg =