Fixed issue #963. Bug in tool Point intersect curve and axis.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2019-04-12 18:04:07 +03:00
parent 81061ea987
commit d1c5d699fa
4 changed files with 230 additions and 4 deletions

View File

@ -19,6 +19,7 @@
- [#956] Setting pattern unit doesn't change combobox value in Tape app. - [#956] Setting pattern unit doesn't change combobox value in Tape app.
- [#957] Unable to cut an arc with negative length. - [#957] Unable to cut an arc with negative length.
- [#962] Failed to load LibEGL. - [#962] Failed to load LibEGL.
- [#963] Bug in tool Point intersect curve and axis.
# Version 0.6.1 October 23, 2018 # Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements. - [#885] Regression. Broken support for multi size measurements.

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<pattern>
<!--Pattern created with Valentina v0.6.2.0 (https://valentinaproject.bitbucket.io/).-->
<version>0.7.12</version>
<unit>inch</unit>
<description/>
<notes/>
<measurements></measurements>
<increments/>
<previewCalculations/>
<draw name="Armhole">
<calculation>
<point id="218" mx="0.0520833" my="0.104167" name="D" showLabel="true" type="single" x="37.0097" y="0.416667"/>
<elArc aScale="0.5" angle1="0" angle2="0" center="218" color="black" id="219" penStyle="hair" radius1="8" radius2="8" rotationAngle="360" type="simple"/>
<point angle="90" basePoint="218" curve="219" id="220" lineColor="black" mx="0.0520833" my="0.104167" name="D1" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="270" basePoint="218" curve="219" id="223" lineColor="black" mx="0.0520833" my="0.104167" name="D2" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="180" basePoint="218" curve="219" id="226" lineColor="black" mx="0.0520833" my="0.104167" name="D3" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="0" basePoint="218" curve="219" id="229" lineColor="black" mx="0.0520833" my="0.104167" name="D4" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="225" basePoint="218" curve="219" id="232" lineColor="black" mx="0.0520833" my="0.104167" name="D5" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="135" basePoint="218" curve="219" id="233" lineColor="black" mx="0.0520833" my="0.104167" name="D6" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="45" basePoint="218" curve="219" id="236" lineColor="black" mx="0.0520833" my="0.104167" name="D7" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
<point angle="315" basePoint="218" curve="219" id="237" lineColor="black" mx="0.0520833" my="0.104167" name="D8" showLabel="true" type="curveIntersectAxis" typeLine="hair"/>
</calculation>
<modeling/>
<details/>
<groups/>
</draw>
</pattern>

View File

@ -336,8 +336,12 @@ bool VAbstractCurve::CurveIntersectAxis(const QPointF &point, qreal angle, const
QRectF rec = QRectF(0, 0, INT_MAX, INT_MAX); QRectF rec = QRectF(0, 0, INT_MAX, INT_MAX);
rec.translate(-INT_MAX/2.0, -INT_MAX/2.0); rec.translate(-INT_MAX/2.0, -INT_MAX/2.0);
const QLineF axis = VGObject::BuildAxis(point, angle, rec); // Instead of using axis compare two rays. See issue #963.
const QVector<QPointF> points = VAbstractCurve::CurveIntersectLine(curvePoints, axis); QLineF axis = QLineF(point, VGObject::BuildRay(point, angle, rec));
QVector<QPointF> points = VAbstractCurve::CurveIntersectLine(curvePoints, axis);
axis = QLineF(point, VGObject::BuildRay(point, angle + 180, rec));
points += VAbstractCurve::CurveIntersectLine(curvePoints, axis);
if (points.size() > 0) if (points.size() > 0)
{ {
@ -352,7 +356,7 @@ bool VAbstractCurve::CurveIntersectAxis(const QPointF &point, qreal angle, const
for ( qint32 i = 0; i < points.size(); ++i ) for ( qint32 i = 0; i < points.size(); ++i )
{ {
if (points.at(i) == point) if (VFuzzyComparePoints(points.at(i), point))
{ // Always seek unique intersection { // Always seek unique intersection
continue; continue;
} }

View File

@ -537,8 +537,201 @@ void TST_FindPoint::TestCurveIntersectAxis_data()
QTest::newRow("Ignore base point") << QPointF(77.88857126235962, 238.94051381477158) QTest::newRow("Ignore base point") << QPointF(77.88857126235962, 238.94051381477158)
<< 25.625900000000001 << 25.625900000000001
<< curvePoints << curvePoints
<< QPointF(409.3673746585846, 79.93820315599442); << QPointF(409.3497137398903, 79.93480159739616);
curvePoints =
{
QPointF(4320.9312, 40.00003200000003),
QPointF(4320.680365481579, 20.177606660541247),
QPointF(4319.93188316558, 0.4788538670297253),
QPointF(4318.6917849109, -19.090194521637265),
QPointF(4316.966102576437, -38.52350664656246),
QPointF(4314.760868021088, -57.81505064884859),
QPointF(4312.082113103751, -76.95879466959839),
QPointF(4308.935869683322, -95.9487068499146),
QPointF(4305.3281696187, -114.77875533089994),
QPointF(4301.265044768779, -133.44290825365715),
QPointF(4296.752526992461, -151.935133759289),
QPointF(4291.796648148639, -170.24939998889818),
QPointF(4286.403440096212, -188.37967508358741),
QPointF(4274.329163801132, -224.06412443261712),
QPointF(4260.5779529783995, -258.9402269351999),
QPointF(4245.198062499192, -292.95972772015773),
QPointF(4228.237747234687, -326.0743719163124),
QPointF(4209.745262056063, -358.23590465248583),
QPointF(4189.7688618345, -389.3960710574999),
QPointF(4168.356801441173, -419.5066162601765),
QPointF(4145.557335747262, -448.5192853893374),
QPointF(4121.418719623945, -476.3858235738046),
QPointF(4095.9892079424, -503.05797594239993),
QPointF(4069.3170555738043, -528.4874876239452),
QPointF(4041.450517389337, -552.6261037472624),
QPointF(4012.4378482601765, -575.4255694411734),
QPointF(3982.3273030574996, -596.8376298344999),
QPointF(3951.1671366524856, -616.814030056064),
QPointF(3919.0056039163123, -635.3065152346874),
QPointF(3885.8909597201578, -652.2668304991922),
QPointF(3851.8714589352, -667.6467209784),
QPointF(3816.9953564326165, -681.3979318011327),
QPointF(3781.310907083587, -693.4722080962125),
QPointF(3763.1806319888983, -698.8654161486393),
QPointF(3744.866365759289, -703.821294992461),
QPointF(3726.374140253657, -708.3338127687805),
QPointF(3707.7099873309, -712.3969376187001),
QPointF(3688.879938849914, -716.0046376833229),
QPointF(3669.8900266695982, -719.1508811037517),
QPointF(3650.7462826488486, -721.8296360210888),
QPointF(3631.4547386465624, -724.0348705764375),
QPointF(3612.021426521637, -725.7605529109002),
QPointF(3592.45237813297, -727.0006511655797),
QPointF(3572.7536253394587, -727.7491334815787),
QPointF(3552.9312, -727.999968),
QPointF(3533.1087746605413, -727.7491334815787),
QPointF(3513.41002186703, -727.0006511655797),
QPointF(3493.840973478363, -725.7605529109002),
QPointF(3474.4076613534376, -724.0348705764375),
QPointF(3455.1161173511514, -721.8296360210888),
QPointF(3435.9723733304018, -719.1508811037517),
QPointF(3416.982461150086, -716.0046376833229),
QPointF(3398.1524126691, -712.3969376187001),
QPointF(3379.488259746343, -708.3338127687805),
QPointF(3360.996034240711, -703.821294992461),
QPointF(3342.6817680111017, -698.8654161486393),
QPointF(3324.551492916413, -693.4722080962125),
QPointF(3288.8670435673835, -681.3979318011327),
QPointF(3253.9909410648, -667.6467209784),
QPointF(3219.971440279842, -652.2668304991922),
QPointF(3186.8567960836876, -635.3065152346874),
QPointF(3154.6952633475144, -616.814030056064),
QPointF(3123.5350969425003, -596.8376298344999),
QPointF(3093.4245517398235, -575.4255694411734),
QPointF(3064.411882610663, -552.6261037472624),
QPointF(3036.5453444261957, -528.4874876239452),
QPointF(3009.8731920576, -503.05797594239993),
QPointF(2984.443680376055, -476.3858235738046),
QPointF(2960.305064252738, -448.5192853893374),
QPointF(2937.505598558827, -419.5066162601765),
QPointF(2916.0935381655004, -389.3960710574999),
QPointF(2896.1171379439365, -358.23590465248583),
QPointF(2877.624652765313, -326.0743719163124),
QPointF(2860.664337500808, -292.95972772015773),
QPointF(2845.2844470216, -258.9402269351999),
QPointF(2831.5332361988667, -224.06412443261712),
QPointF(2819.458959903787, -188.37967508358741),
QPointF(2814.0657518513603, -170.24939998889818),
QPointF(2809.109873007539, -151.935133759289),
QPointF(2804.59735523122, -133.44290825365715),
QPointF(2800.5342303813, -114.77875533089994),
QPointF(2796.9265303166767, -95.9487068499146),
QPointF(2793.780286896248, -76.95879466959839),
QPointF(2791.101531978911, -57.81505064884859),
QPointF(2788.8962974235624, -38.52350664656246),
QPointF(2787.1706150890996, -19.090194521637265),
QPointF(2785.93051683442, 0.4788538670297253),
QPointF(2785.1820345184215, 20.177606660541247),
QPointF(2784.9312, 40.00003200000003),
QPointF(2785.1820345184215, 59.82245733945882),
QPointF(2785.93051683442, 79.52121013297034),
QPointF(2787.1706150890996, 99.09025852163734),
QPointF(2788.8962974235624, 118.52357064656252),
QPointF(2791.101531978911, 137.81511464884863),
QPointF(2793.780286896248, 156.95885866959844),
QPointF(2796.9265303166767, 175.9487708499147),
QPointF(2800.5342303813, 194.77881933090003),
QPointF(2804.59735523122, 213.44297225365725),
QPointF(2809.109873007539, 231.93519775928905),
QPointF(2814.0657518513603, 250.24946398889824),
QPointF(2819.458959903787, 268.3797390835875),
QPointF(2831.5332361988667, 304.06418843261713),
QPointF(2845.2844470216, 338.9402909352),
QPointF(2860.664337500808, 372.9597917201578),
QPointF(2877.624652765313, 406.07443591631244),
QPointF(2896.1171379439365, 438.2359686524859),
QPointF(2916.0935381655004, 469.3961350575),
QPointF(2937.505598558827, 499.50668026017655),
QPointF(2960.305064252738, 528.5193493893374),
QPointF(2984.443680376055, 556.3858875738047),
QPointF(3009.8731920576, 583.0580399424),
QPointF(3036.5453444261957, 608.4875516239453),
QPointF(3064.411882610663, 632.6261677472625),
QPointF(3093.4245517398235, 655.4256334411734),
QPointF(3123.5350969425003, 676.8376938345),
QPointF(3154.6952633475144, 696.814094056064),
QPointF(3186.8567960836876, 715.3065792346874),
QPointF(3219.971440279842, 732.2668944991923),
QPointF(3253.9909410648, 747.6467849784001),
QPointF(3288.8670435673835, 761.3979958011328),
QPointF(3324.551492916413, 773.4722720962126),
QPointF(3342.6817680111017, 778.8654801486393),
QPointF(3360.996034240711, 783.8213589924611),
QPointF(3379.488259746343, 788.3338767687806),
QPointF(3398.1524126691, 792.3970016187002),
QPointF(3416.982461150086, 796.004701683323),
QPointF(3435.9723733304018, 799.1509451037517),
QPointF(3455.1161173511514, 801.8297000210889),
QPointF(3474.4076613534376, 804.0349345764375),
QPointF(3493.840973478363, 805.7606169109002),
QPointF(3513.41002186703, 807.0007151655798),
QPointF(3533.1087746605413, 807.7491974815788),
QPointF(3552.9312, 808.000032),
QPointF(3572.7536253394587, 807.7491974815788),
QPointF(3592.45237813297, 807.0007151655798),
QPointF(3612.021426521637, 805.7606169109002),
QPointF(3631.4547386465624, 804.0349345764375),
QPointF(3650.7462826488486, 801.8297000210889),
QPointF(3669.8900266695982, 799.1509451037517),
QPointF(3688.879938849914, 796.004701683323),
QPointF(3707.7099873309, 792.3970016187002),
QPointF(3726.374140253657, 788.3338767687806),
QPointF(3744.866365759289, 783.8213589924611),
QPointF(3763.1806319888983, 778.8654801486393),
QPointF(3781.310907083587, 773.4722720962126),
QPointF(3816.9953564326165, 761.3979958011328),
QPointF(3851.8714589352, 747.6467849784001),
QPointF(3885.8909597201578, 732.2668944991923),
QPointF(3919.0056039163123, 715.3065792346874),
QPointF(3951.1671366524856, 696.814094056064),
QPointF(3982.3273030574996, 676.8376938345),
QPointF(4012.4378482601765, 655.4256334411734),
QPointF(4041.450517389337, 632.6261677472625),
QPointF(4069.3170555738043, 608.4875516239453),
QPointF(4095.9892079424, 583.0580399424),
QPointF(4121.418719623945, 556.3858875738047),
QPointF(4145.557335747262, 528.5193493893374),
QPointF(4168.356801441173, 499.50668026017655),
QPointF(4189.7688618345, 469.3961350575),
QPointF(4209.745262056063, 438.2359686524859),
QPointF(4228.237747234687, 406.07443591631244),
QPointF(4245.198062499192, 372.9597917201578),
QPointF(4260.5779529783995, 338.9402909352),
QPointF(4274.329163801132, 304.06418843261713),
QPointF(4286.403440096212, 268.3797390835875),
QPointF(4291.796648148639, 250.24946398889824),
QPointF(4296.752526992461, 231.93519775928905),
QPointF(4301.265044768779, 213.44297225365725),
QPointF(4305.3281696187, 194.77881933090003),
QPointF(4308.935869683322, 175.9487708499147),
QPointF(4312.082113103751, 156.95885866959844),
QPointF(4314.760868021088, 137.81511464884863),
QPointF(4316.966102576437, 118.52357064656252),
QPointF(4318.6917849109, 99.09025852163734),
QPointF(4319.93188316558, 79.52121013297034),
QPointF(4320.680365481579, 59.82245733945882),
QPointF(4320.9312, 40.00003200000003)
};
basePoint = QPointF(3552.9312, 40.000032000000004);
// See file <root>/src/app/share/collection/bugs/Issue_#963.val
QTest::newRow("Angle 135") << basePoint
<< 135.0
<< curvePoints
<< QPointF(3009.8731920575547, -503.0579759423524);
QTest::newRow("Angle 315") << basePoint
<< 315.0
<< curvePoints
<< QPointF(4095.9892079424453, 583.0580399423525);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------