Fixed issue #627. Seam allowance artifacts

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-02-12 17:29:54 +02:00
parent 16871a0466
commit 33cdac0db1
3 changed files with 248 additions and 3 deletions

View file

@ -0,0 +1,147 @@
<?xml version='1.0' encoding='UTF-8'?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.4.0</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<measurements/>
<increments/>
<draw name="Front">
<calculation>
<point type="single" x="0" y="0" id="1" name="A" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="none" id="2" name="Top_A" basePoint="1" mx="0.132292" lineColor="black" angle="90" my="0.264583" length="112"/>
<point type="endLine" typeLine="dotLine" id="3" name="A1" basePoint="1" mx="0.132292" lineColor="blue" angle="0" my="0.264583" length="155"/>
<line typeLine="dotLine" id="4" firstPoint="2" secondPoint="3" lineColor="blue"/>
<point type="alongLine" typeLine="none" id="31" name="A2" firstPoint="2" secondPoint="1" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="32" name="A3" firstPoint="2" secondPoint="3" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="33" name="A4" firstPoint="3" secondPoint="1" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="normal" typeLine="none" id="34" name="A5" firstPoint="33" secondPoint="3" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_A_A1/100*2"/>
<point type="normal" typeLine="none" id="35" name="A6" firstPoint="31" secondPoint="1" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_A_Top_A/100*2"/>
<point type="normal" typeLine="none" id="36" name="A7" firstPoint="32" secondPoint="2" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_Top_A_A1/100*2"/>
<spline point4="2" type="cubicBezier" id="37" color="black" point1="1" point2="35" point3="35"/>
<spline point4="3" type="cubicBezier" id="38" color="black" point1="2" point2="36" point3="36"/>
<spline point4="1" type="cubicBezier" id="39" color="black" point1="3" point2="34" point3="34"/>
<line typeLine="hair" id="47" firstPoint="2" secondPoint="1" lineColor="black"/>
<point type="cutSpline" id="67" name="A8" spline="38" mx="-3.36807" my="-0.191986" length="Spl_Top_A_A1/2"/>
<point type="cutSpline" id="81" name="A_plot_help_1" spline="39" mx="0.132292" my="0.264583" length=" 52"/>
<point type="cutSpline" id="82" name="A_plot_help_2" spline="39" mx="0.132292" my="0.264583" length="104"/>
<point type="cutSpline" id="85" name="A11" spline="38" mx="0.132292" my="0.264583" length="Spl_Top_A_A1/3"/>
<point type="cutSpline" id="86" name="A12" spline="38" mx="0.132292" my="0.264583" length="Spl_Top_A_A1/3*2"/>
<line typeLine="dotLine" id="87" firstPoint="85" secondPoint="82" lineColor="blue"/>
<line typeLine="dotLine" id="88" firstPoint="81" secondPoint="86" lineColor="blue"/>
</calculation>
<modeling>
<point type="modeling" inUse="false" id="89" idObject="1" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="90" idObject="2" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="91" idObject="38"/>
<point type="modeling" inUse="false" id="92" idObject="85" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="93" idObject="82" mx="-4.37354" my="1.52622"/>
<point type="modeling" inUse="false" id="95" idObject="82" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="96" idObject="85" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="97" idObject="38"/>
<point type="modeling" inUse="false" id="98" idObject="86" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="99" idObject="81" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="101" idObject="81" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="102" idObject="86" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="103" idObject="38"/>
<point type="modeling" inUse="false" id="104" idObject="3" mx="0.132292" my="0.264583"/>
</modeling>
<details/>
<groups/>
</draw>
<draw name="Side">
<calculation>
<point type="single" x="160" y="0" id="5" name="B" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="none" id="6" name="TOP_B" basePoint="5" mx="0.132292" lineColor="black" angle="90" my="0.264583" length="Line_Top_A_A1"/>
<point type="endLine" typeLine="dotLine" id="7" name="B2" basePoint="5" mx="0.132292" lineColor="blue" angle="0" my="0.264583" length="90"/>
<line typeLine="dotLine" id="8" firstPoint="7" secondPoint="6" lineColor="blue"/>
<point type="alongLine" typeLine="none" id="22" name="B1" firstPoint="5" secondPoint="6" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="23" name="B3" firstPoint="6" secondPoint="7" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="24" name="B4" firstPoint="5" secondPoint="7" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="normal" typeLine="none" id="25" name="B5" firstPoint="24" secondPoint="7" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_B_B2/100*2"/>
<point type="normal" typeLine="none" id="26" name="B6" firstPoint="22" secondPoint="5" mx="0.132292" lineColor="black" angle="0" my="0.36148" length="Line_A_Top_A/100*2"/>
<point type="normal" typeLine="none" id="27" name="B7" firstPoint="23" secondPoint="6" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_B2_TOP_B/100*2"/>
<spline point4="6" type="cubicBezier" id="28" color="black" point1="5" point2="26" point3="26"/>
<spline point4="7" type="cubicBezier" id="29" color="black" point1="6" point2="27" point3="27"/>
<spline point4="5" type="cubicBezier" id="30" color="black" point1="7" point2="25" point3="25"/>
<point type="cutSpline" id="106" name="B_plot_help_1" spline="30" mx="0.132292" my="0.264583" length="Spl_B2_B/2"/>
<point type="cutSpline" id="107" name="B_plot_help_2" spline="29" mx="0.132292" my="0.264583" length="Spl_TOP_B_B2/2"/>
<line typeLine="dotLine" id="108" firstPoint="106" secondPoint="107" lineColor="blue"/>
</calculation>
<modeling>
<point type="modeling" inUse="false" id="109" idObject="106" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="110" idObject="30"/>
<point type="modeling" inUse="false" id="111" idObject="5" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="112" idObject="28"/>
<point type="modeling" inUse="false" id="113" idObject="6" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="114" idObject="29"/>
<point type="modeling" inUse="false" id="115" idObject="107" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="117" idObject="106" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="118" idObject="107" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="119" idObject="29"/>
<point type="modeling" inUse="false" id="120" idObject="7" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="121" idObject="30"/>
</modeling>
<details/>
<groups/>
</draw>
<draw name="Bacl">
<calculation>
<point type="single" x="255" y="0" id="9" name="C" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="none" id="10" name="C1" basePoint="9" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="153"/>
<point type="endLine" typeLine="none" id="11" name="Top_C" basePoint="9" mx="0.132292" lineColor="black" angle="59.4" my="0.264583" length="Line_B2_TOP_B"/>
<line typeLine="dotLine" id="12" firstPoint="10" secondPoint="11" lineColor="blue"/>
<point type="alongLine" typeLine="none" id="13" name="C2" firstPoint="10" secondPoint="11" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="14" name="C3" firstPoint="11" secondPoint="9" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="15" name="C4" firstPoint="9" secondPoint="10" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="normal" typeLine="none" id="16" name="C5" firstPoint="15" secondPoint="10" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_C_C1/100*2"/>
<point type="normal" typeLine="none" id="17" name="C6" firstPoint="14" secondPoint="9" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_C_Top_C/100*2"/>
<point type="normal" typeLine="none" id="18" name="C7" firstPoint="13" secondPoint="11" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_C1_Top_C/100*2"/>
<spline point4="11" type="cubicBezier" id="19" color="black" point1="9" point2="17" point3="17"/>
<spline point4="10" type="cubicBezier" id="20" color="black" point1="11" point2="18" point3="18"/>
<spline point4="9" type="cubicBezier" id="21" color="black" point1="10" point2="16" point3="16"/>
<point type="cutSpline" id="123" name="C_plot_help_1" spline="21" mx="0.132292" my="0.264583" length="Spl_C1_C/3"/>
<point type="cutSpline" id="124" name="C_plot_help_2" spline="21" mx="0.132292" my="0.264583" length="Spl_C1_C/3*2"/>
<point type="cutSpline" id="125" name="C_plot_help_3" spline="19" mx="0.132292" my="0.264583" length="Spl_C_Top_C/2"/>
<line typeLine="dotLine" id="126" firstPoint="124" secondPoint="125" lineColor="blue"/>
<line typeLine="dotLine" id="127" firstPoint="123" secondPoint="11" lineColor="blue"/>
</calculation>
<modeling>
<point type="modeling" inUse="false" id="128" idObject="9" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="129" idObject="19"/>
<point type="modeling" inUse="false" id="130" idObject="125" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="131" idObject="124" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="133" idObject="124" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="134" idObject="125" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="true" id="135" idObject="19"/>
<point type="modeling" inUse="true" id="136" idObject="11" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="137" idObject="123" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="true" id="138" idObject="21"/>
<point type="modeling" inUse="false" id="140" idObject="123" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="false" id="141" idObject="11" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="142" idObject="20"/>
<point type="modeling" inUse="false" id="143" idObject="10" mx="0.132292" my="0.264583"/>
<spline type="modelingSpline" inUse="false" id="144" idObject="21"/>
</modeling>
<details>
<detail id="139" name="Back" forbidFlipping="false" united="false" seamAllowance="true" width="1.5" mx="-268.36" inLayout="true" my="3.38623" version="2">
<data rotation="-360.467" letter="B2" fontSize="60" visible="true" width="583.732" mx="12161.6" height="241.406" my="-901.47">
<mcp cutNumber="2" userDef="sil Poly" material="4" placement="0"/>
</data>
<patternInfo rotation="0" fontSize="0" visible="false" width="0" mx="0" height="0" my="0"/>
<grainline arrows="0" rotation="90" visible="false" mx="0" my="0" length="0"/>
<nodes>
<node type="NodePoint" after="0" idObject="133"/>
<node before="0" type="NodePoint" idObject="134"/>
<node type="NodeSpline" reverse="0" idObject="135"/>
<node type="NodePoint" after="0" idObject="136"/>
<node before="0" type="NodePoint" idObject="137"/>
<node type="NodeSpline" reverse="0" idObject="138"/>
</nodes>
</detail>
</details>
<groups/>
</draw>
</pattern>

View file

@ -395,7 +395,8 @@ QVector<QPointF> VAbstractPiece::EkvPoint(const VSAPoint &p1Line1, const VSAPoin
const qreal angle = AngleBetweenBisectors(b1, b2);
// Comparison bisector angles helps to find direction
if (angle <= 90)// Go in a same direction
if (angle < 90
|| VFuzzyComparePossibleNulls(angle, 90.0))// Go in a same direction
{//Regular equdistant case
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
@ -429,7 +430,7 @@ QT_WARNING_POP
const qreal result1 = PointPosition(bisector.p2(), QLineF(p1Line1, p2Line1));
const qreal result2 = PointPosition(bisector.p2(), QLineF(p2Line2, p1Line2));
if (result1 <=0 && result2 <= 0)
if ((result1 < 0 || qFuzzyIsNull(result1)) && (result2 < 0 || qFuzzyIsNull(result2)))
{// Dart case. A bisector watch outside. In some cases a point still valid, but ignore if going
// outside of an equdistant.
@ -450,7 +451,7 @@ QT_WARNING_POP
const qreal result1 = PointPosition(CrosPoint, QLineF(p1Line1, p2Line1));
const qreal result2 = PointPosition(CrosPoint, QLineF(p2Line2, p1Line2));
if (result1 <=0 && result2 <= 0)
if ((result1 < 0 || qFuzzyIsNull(result1)) && (result2 < 0 || qFuzzyIsNull(result2)))
{// The cross point is still outside of a piece
if (line.length() >= localWidth)
{

View file

@ -2509,6 +2509,103 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data() const
// See the file "collection/bugs/Issue_#604.val" (since 0.5.0)
QTest::newRow("Issue #604.") << points << width << ekvOrig;
width = 56.692913385826778;
points.clear();
point = VSAPoint(11565.008125001967, -71.44488549419934);
point.SetSAAfter(0);
points.append(point);
point = VSAPoint(11774.053467225081, -3376.8303371353477);
point.SetSABefore(0);
points.append(point);
point = VSAPoint(11774.053467225081, -3376.8303371353477);
point.SetSABefore(0);
points.append(point);
points.append(VSAPoint(11821.637653562488, -3457.444047544761));
points.append(VSAPoint(11916.506852253828, -3619.698047174161));
points.append(VSAPoint(12011.687139013728, -3784.3170132645946));
points.append(VSAPoint(12107.923065894336, -3952.559914581168));
points.append(VSAPoint(12205.959184947797, -4125.685719888987));
points.append(VSAPoint(12306.540048226263, -4304.953397953153));
points.append(VSAPoint(12410.410207781879, -4491.621917538776));
points.append(VSAPoint(12518.314215666796, -4686.950247410959));
points.append(VSAPoint(12630.996623933155, -4892.197356334806));
points.append(VSAPoint(12749.201984633113, -5108.622213075425));
points.append(VSAPoint(12937.571227539614, -5455.181123300274));
points.append(VSAPoint(13216.05428816687, -5970.204948863398));
points.append(VSAPoint(13530.031095467164, -6552.6012034655));
point = VSAPoint(13704.042216387523, -6875.648082494774);
point.SetSAAfter(0);
points.append(point);
point = VSAPoint(13704.042216387523, -6875.648082494774);
point.SetSAAfter(0);
points.append(point);
point = VSAPoint(13493.259591532773, -71.44488549420451);
point.SetSABefore(0);
points.append(point);
point = VSAPoint(13493.259591532773, -71.44488549420451);
point.SetSABefore(0);
points.append(point);
points.append(VSAPoint(13458.265794168308, -72.45287893700785));
points.append(VSAPoint(13303.675181471457, -76.51882381889763));
points.append(VSAPoint(13154.908187746063, -79.90711122047243));
points.append(VSAPoint(13010.905973179135, -82.6177411417323));
points.append(VSAPoint(12870.60969795768, -84.65071358267716));
points.append(VSAPoint(12732.9605222687, -86.0060285433071));
points.append(VSAPoint(12596.899606299212, -86.68368602362204));
points.append(VSAPoint(12461.36811023622, -86.68368602362204));
points.append(VSAPoint(12325.307194266732, -86.0060285433071));
points.append(VSAPoint(12187.658018577757, -84.65071358267716));
points.append(VSAPoint(12047.361743356301, -82.6177411417323));
points.append(VSAPoint(11903.35952878937, -79.90711122047243));
points.append(VSAPoint(11754.592535063975, -76.51882381889763));
points.append(VSAPoint(11600.001922367124, -72.45287893700785));
point = VSAPoint(11565.008125001967, -71.44488549419934);
point.SetSAAfter(0);
points.append(point);
ekvOrig.clear();
ekvOrig.append(QPointF(11561.415280975947, -14.63551463077929));
ekvOrig.append(QPointF(11781.95342513335, -3501.7429788659483));
ekvOrig.append(QPointF(11867.496139886347, -3648.194635075343));
ekvOrig.append(QPointF(11962.541506347354, -3812.5802499029824));
ekvOrig.append(QPointF(12058.651107851038, -3980.6023049242845));
ekvOrig.append(QPointF(12156.571541308, -4153.523816526403));
ekvOrig.append(QPointF(12257.048738448357, -4332.606727953389));
ekvOrig.append(QPointF(12360.827974888123, -4519.11184658243));
ekvOrig.append(QPointF(12468.653939048814, -4714.298901347144));
ekvOrig.append(QPointF(12581.270838581826, -4919.426688379175));
ekvOrig.append(QPointF(12699.418991549643, -5135.746802194771));
ekvOrig.append(QPointF(12887.73123714858, -5482.200849627318));
ekvOrig.append(QPointF(13166.166408012898, -5997.136108335216));
ekvOrig.append(QPointF(13707.969757502442, -7002.431719565925));
ekvOrig.append(QPointF(13491.504168170613, -14.778652871227324));
ekvOrig.append(QPointF(13302.271351803516, -19.843181325566178));
ekvOrig.append(QPointF(13153.729251428536, -23.226346601010544));
ekvOrig.append(QPointF(13009.961769808971, -25.932558019731804));
ekvOrig.append(QPointF(12869.919891108724, -27.961844111086332));
ekvOrig.append(QPointF(12732.540250691125, -29.3145051859673));
ekvOrig.append(QPointF(12596.758426378788, -29.990772637795267));
ekvOrig.append(QPointF(12461.509290156644, -29.990772637795267));
ekvOrig.append(QPointF(12325.727465844308, -29.3145051859673));
ekvOrig.append(QPointF(12188.347825426712, -27.961844111086332));
ekvOrig.append(QPointF(12048.305946726465, -25.9325580197318));
ekvOrig.append(QPointF(11904.538465106896, -23.226346601010544));
ekvOrig.append(QPointF(11755.996364731915, -19.843181325566132));
ekvOrig.append(QPointF(11561.415280975947, -14.63551463077929));
// See the file "collection/bugs/Issue_#627.val"
QTest::newRow("Issue #627.") << points << width << ekvOrig;
}
//---------------------------------------------------------------------------------------------------------------------