diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index fc87a77d1..1c52f2ca1 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -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); diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index 2d026f07e..68313b5f9 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -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(); } diff --git a/src/test/ValentinaTest/tst_vellipticalarc.cpp b/src/test/ValentinaTest/tst_vellipticalarc.cpp index a30a2ae01..1169ec52a 100644 --- a/src/test/ValentinaTest/tst_vellipticalarc.cpp +++ b/src/test/ValentinaTest/tst_vellipticalarc.cpp @@ -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; } //---------------------------------------------------------------------------------------------------------------------