Little fixes in VEllipticalArc

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-02-26 21:27:55 +02:00
parent bea2a32e85
commit 22a3e9d1a0
3 changed files with 9 additions and 6 deletions

View File

@ -283,7 +283,7 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
len = length;
}
qreal n = (len*180)/(M_PI*d->radius);
qreal n = (len*180)/(M_PI*d->radius); // n - is angle in degrees
QLineF line(GetCenter().toQPointF(), GetP1());
line.setAngle(line.angle()+n);

View File

@ -356,13 +356,12 @@ void VEllipticalArc::FindF2(qreal length)
qreal gap = 180;
if (length < 0)
{
//length = qAbs(length);
d->isFlipped = true;
gap = -gap;
}
while (length > MaxLength())
{
//length = length - MaxLength();
length = length - MaxLength();
}
// We need to calculate the second angle
@ -386,6 +385,7 @@ void VEllipticalArc::FindF2(qreal length)
{ // we selected too little end angle
endAngle = endAngle + qAbs(gap);
}
// we need to set d->f2, because we use it when we calculate GetLength
d->f2 = endAngle;
lenBez = GetLength();
}

View File

@ -197,9 +197,12 @@ void TST_VEllipticalArc::TestData()
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 150, 400") << 150.0 << 400.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 1500, 800")
<< 1500.0 << 800.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 50000, 5000")
<< 50000.0 << 5000.0 << 90.0 << 135.0 << 0.0;
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 90000, 50000")
<< 90000.0 << 50000.0 << 90.0 << 135.0 << 0.0;
}
//---------------------------------------------------------------------------------------------------------------------