Fixed issue #515. Seam allowance wrong way.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-06-17 15:39:54 +03:00
parent 4bf082bbe5
commit 3c5d6aa500
4 changed files with 561 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<vit>
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
<version>0.3.3</version>
<read-only>false</read-only>
<notes/>
<unit>cm</unit>
<pm_system>998</pm_system>
<personal>
<family-name/>
<given-name/>
<birth-date>1800-01-01</birth-date>
<gender>unknown</gender>
<email/>
</personal>
<body-measurements>
<m name="height_waist_side" value="107"/>
<m name="height_knee" value="50"/>
<m name="waist_circ" value="84"/>
<m name="hip_circ" value="100"/>
<m name="leg_crotch_to_floor" value="83"/>
<m name="leg_knee_circ" value="50"/>
<m name="leg_ankle_high_circ" value="28"/>
<m name="leg_ankle_circ" value="28"/>
</body-measurements>
</vit>

View File

@ -310,12 +310,6 @@ QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
return points; return points;
} }
bool closed = false;
if (points.first() == points.last())
{
closed = true;
}
QVector<QPointF> ekvPoints; QVector<QPointF> ekvPoints;
qint32 i, j; qint32 i, j;
@ -323,7 +317,7 @@ QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
{ {
/*Last three points no need check.*/ /*Last three points no need check.*/
/*Triangle has not contain loops*/ /*Triangle has not contain loops*/
if (i >= count-3) if (i > count-3)
{ {
ekvPoints.append(points.at(i)); ekvPoints.append(points.at(i));
continue; continue;
@ -336,9 +330,11 @@ QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
const QLineF line1(points.at(i), points.at(i+1)); const QLineF line1(points.at(i), points.at(i+1));
// Because a path can contains several loops we will seek the last and only then remove the loop(s) // Because a path can contains several loops we will seek the last and only then remove the loop(s)
// That's why we parse from the end // That's why we parse from the end
for (j = count-2; j >= i+2; --j) for (j = count-1; j >= i+2; --j)
{ {
const QLineF line2(points.at(j), points.at(j+1)); QLineF line2;
j == count-1 ? line2 = QLineF(points.at(j), points.at(0)) : line2 = QLineF(points.at(j), points.at(j+1));
const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint); const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint);
if (intersect == QLineF::NoIntersection) if (intersect == QLineF::NoIntersection)
{ // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect; { // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect;
@ -372,7 +368,7 @@ QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
} }
} }
} }
else if (intersect == QLineF::BoundedIntersection && not (i == 0 && j+1 == count-1 && closed)) else if (intersect == QLineF::BoundedIntersection && not (i == 0 && j == count-1))
{ // Break, but not if intersects the first edge and the last edge in closed path { // Break, but not if intersects the first edge and the last edge in closed path
if (line1.p1() != crosPoint && line1.p2() != crosPoint && if (line1.p1() != crosPoint && line1.p2() != crosPoint &&
line2.p1() != crosPoint && line2.p2() != crosPoint) line2.p1() != crosPoint && line2.p2() != crosPoint)

View File

@ -237,6 +237,160 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const
// See the file "collection/bugs/Issue_#493.val" // See the file "collection/bugs/Issue_#493.val"
QTest::newRow("Test case issue #493") << path << res; QTest::newRow("Test case issue #493") << path << res;
path.clear();
path << QPointF(-656.9465284876832, -3606.6183279948636);
path << QPointF(-656.5996104603414, -3606.6000783462687);
path << QPointF(-655.7439133016985, -3607.1236310612317);
path << QPointF(-654.129780081666, -3609.0558393168476);
path << QPointF(-651.3154902471701, -3613.939306009108);
path << QPointF(-647.8207651830382, -3621.2084054506768);
path << QPointF(-641.4701586077349, -3636.0289997859454);
path << QPointF(-630.9244502073004, -3663.23035747934);
path << QPointF(-618.4465305467888, -3697.4982896415795);
path << QPointF(-604.3873016966293, -3737.732371148936);
path << QPointF(-581.1891087215608, -3806.460957656939);
path << QPointF(-547.7936207285052, -3909.520915257629);
path << QPointF(-514.3891332445846, -4016.6378180116963);
path << QPointF(-491.17181635142833, -4093.9874129706236);
path << QPointF(-477.094588519539, -4142.335384784734);
path << QPointF(-464.5941701318652, -4186.745679830414);
path << QPointF(-454.0214632588362, -4226.117872983938);
path << QPointF(-449.6699112298347, -4243.2921010175705);
path << QPointF(-576.966638263205, -3606.6183279948636);
res.clear();
res << QPointF(-656.9465284876832, -3606.6183279948636);
res << QPointF(-656.5996104603414, -3606.6000783462687);
res << QPointF(-656.5697831440032, -3606.6183279948636);
// See the file "collection/bugs/Issue_#515.val"
// Check a countur path.
// The curve that causes the issue is the first in the list.
QTest::newRow("Test case issue #515. Big loop in countur path.") << path << res;
path.clear();
path << QPointF(-449.6699112298347, -4243.2921010175705);
path << QPointF(-576.966638263205, -3606.6183279948636);
path << QPointF(-656.9465284876832, -3606.6183279948636);
path << QPointF(-656.5996104603414, -3606.6000783462687);
path << QPointF(-655.7439133016985, -3607.1236310612317);
path << QPointF(-654.129780081666, -3609.0558393168476);
path << QPointF(-651.3154902471701, -3613.939306009108);
path << QPointF(-647.8207651830382, -3621.2084054506768);
path << QPointF(-641.4701586077349, -3636.0289997859454);
path << QPointF(-630.9244502073004, -3663.23035747934);
path << QPointF(-618.4465305467888, -3697.4982896415795);
path << QPointF(-604.3873016966293, -3737.732371148936);
path << QPointF(-581.1891087215608, -3806.460957656939);
path << QPointF(-547.7936207285052, -3909.520915257629);
path << QPointF(-514.3891332445846, -4016.6378180116963);
path << QPointF(-491.17181635142833, -4093.9874129706236);
path << QPointF(-477.094588519539, -4142.335384784734);
path << QPointF(-464.5941701318652, -4186.745679830414);
path << QPointF(-454.0214632588362, -4226.117872983938);
res.clear();
res << QPointF(-449.6699112298347, -4243.2921010175705);
res << QPointF(-576.966638263205, -3606.6183279948636);
res << QPointF(-656.5697831440032, -3606.6183279948636);
res << QPointF(-655.7439133016985, -3607.1236310612317);
res << QPointF(-654.129780081666, -3609.0558393168476);
res << QPointF(-651.3154902471701, -3613.939306009108);
res << QPointF(-647.8207651830382, -3621.2084054506768);
res << QPointF(-641.4701586077349, -3636.0289997859454);
res << QPointF(-630.9244502073004, -3663.23035747934);
res << QPointF(-618.4465305467888, -3697.4982896415795);
res << QPointF(-604.3873016966293, -3737.732371148936);
res << QPointF(-581.1891087215608, -3806.460957656939);
res << QPointF(-547.7936207285052, -3909.520915257629);
res << QPointF(-514.3891332445846, -4016.6378180116963);
res << QPointF(-491.17181635142833, -4093.9874129706236);
res << QPointF(-477.094588519539, -4142.335384784734);
res << QPointF(-464.5941701318652, -4186.745679830414);
res << QPointF(-454.0214632588362, -4226.117872983938);
// See the file "collection/bugs/Issue_#515.val"
// Check a countur path.
// The curve that causes the issue is the last in the list.
QTest::newRow("Test case issue #515. Small loop in countur path.") << path << res;
path.clear();
path << QPointF(-656.9465284876832, -3606.6183279948636);
path << QPointF(-656.5996104603414, -3606.6000783462687);
path << QPointF(-655.7439133016985, -3607.1236310612317);
path << QPointF(-654.129780081666, -3609.0558393168476);
path << QPointF(-651.3154902471701, -3613.939306009108);
path << QPointF(-647.8207651830382, -3621.2084054506768);
path << QPointF(-641.4701586077349, -3636.0289997859454);
path << QPointF(-630.9244502073004, -3663.23035747934);
path << QPointF(-618.4465305467888, -3697.4982896415795);
path << QPointF(-604.3873016966293, -3737.732371148936);
path << QPointF(-581.1891087215608, -3806.460957656939);
path << QPointF(-547.7936207285052, -3909.520915257629);
path << QPointF(-514.3891332445846, -4016.6378180116963);
path << QPointF(-491.17181635142833, -4093.9874129706236);
path << QPointF(-477.094588519539, -4142.335384784734);
path << QPointF(-464.5941701318652, -4186.745679830414);
path << QPointF(-454.0214632588362, -4226.117872983938);
path << QPointF(-449.6699112298347, -4243.2921010175705);
path << QPointF(-576.966638263205, -3606.6183279948636);
res.clear();
res << QPointF(-656.9465284876832, -3606.6183279948636);
res << QPointF(-656.5996104603414, -3606.6000783462687);
res << QPointF(-656.5697831440032, -3606.6183279948636);
// See the file "collection/bugs/Issue_#515.val"
// Check a seam allowance path.
// The curve that causes the issue is the first in the list.
QTest::newRow("Test case issue #515. Big loop in seam allowance path.") << path << res;
path.clear();
path << QPointF(-449.6699112298347, -4243.2921010175705);
path << QPointF(-576.966638263205, -3606.6183279948636);
path << QPointF(-656.9465284876832, -3606.6183279948636);
path << QPointF(-656.5996104603414, -3606.6000783462687);
path << QPointF(-655.7439133016985, -3607.1236310612317);
path << QPointF(-654.129780081666, -3609.0558393168476);
path << QPointF(-651.3154902471701, -3613.939306009108);
path << QPointF(-647.8207651830382, -3621.2084054506768);
path << QPointF(-641.4701586077349, -3636.0289997859454);
path << QPointF(-630.9244502073004, -3663.23035747934);
path << QPointF(-618.4465305467888, -3697.4982896415795);
path << QPointF(-604.3873016966293, -3737.732371148936);
path << QPointF(-581.1891087215608, -3806.460957656939);
path << QPointF(-547.7936207285052, -3909.520915257629);
path << QPointF(-514.3891332445846, -4016.6378180116963);
path << QPointF(-491.17181635142833, -4093.9874129706236);
path << QPointF(-477.094588519539, -4142.335384784734);
path << QPointF(-464.5941701318652, -4186.745679830414);
path << QPointF(-454.0214632588362, -4226.117872983938);
res.clear();
res << QPointF(-449.6699112298347, -4243.2921010175705);
res << QPointF(-576.966638263205, -3606.6183279948636);
res << QPointF(-656.5697831440032, -3606.6183279948636);
res << QPointF(-655.7439133016985, -3607.1236310612317);
res << QPointF(-654.129780081666, -3609.0558393168476);
res << QPointF(-651.3154902471701, -3613.939306009108);
res << QPointF(-647.8207651830382, -3621.2084054506768);
res << QPointF(-641.4701586077349, -3636.0289997859454);
res << QPointF(-630.9244502073004, -3663.23035747934);
res << QPointF(-618.4465305467888, -3697.4982896415795);
res << QPointF(-604.3873016966293, -3737.732371148936);
res << QPointF(-581.1891087215608, -3806.460957656939);
res << QPointF(-547.7936207285052, -3909.520915257629);
res << QPointF(-514.3891332445846, -4016.6378180116963);
res << QPointF(-491.17181635142833, -4093.9874129706236);
res << QPointF(-477.094588519539, -4142.335384784734);
res << QPointF(-464.5941701318652, -4186.745679830414);
res << QPointF(-454.0214632588362, -4226.117872983938);
// See the file "collection/bugs/Issue_#515.val"
// Check a seam allowance path.
// The curve that causes the issue is the last in the list.
QTest::newRow("Test case issue #515. Small loop in seam allowance path.") << path << res;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------