Fixed issue with method IsPointOnLineSegment.
--HG-- branch : develop
This commit is contained in:
parent
eb15b5d736
commit
73ad3a8376
|
@ -0,0 +1,59 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<pattern>
|
||||
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
|
||||
<version>0.3.1</version>
|
||||
<unit>cm</unit>
|
||||
<author/>
|
||||
<description/>
|
||||
<notes/>
|
||||
<measurements/>
|
||||
<increments>
|
||||
<increment name="#Param1" description="" formula="0.2 "/>
|
||||
<increment name="#Param2" description="" formula="3"/>
|
||||
</increments>
|
||||
<draw name="Test1">
|
||||
<calculation>
|
||||
<point type="single" x="0.79375" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
|
||||
<point type="endLine" typeLine="hair" id="2" name="A1" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="0" length="10"/>
|
||||
<point type="normal" typeLine="hair" id="3" name="A2" firstPoint="2" secondPoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="0" length="10"/>
|
||||
<point type="alongLine" typeLine="none" id="4" name="A3" firstPoint="1" secondPoint="2" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
|
||||
<point type="normal" typeLine="none" id="5" name="A4" firstPoint="4" secondPoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="0" length="4"/>
|
||||
<spline type="simpleInteractive" point4="3" angle1="267.354" angle2="181.581" id="6" color="black" length1="5.48872" length2="8.92993" point1="1"/>
|
||||
<point type="cutSpline" id="7" name="A5" spline="6" mx="-1.44194" my="-1.42325" length="Spl_A_A2*#Param1"/>
|
||||
<point type="cutSpline" id="8" name="A6" spline="6" mx="-1.44193" my="-0.384582" length="Spl_A_A5+#Param2"/>
|
||||
<line typeLine="hair" id="9" firstPoint="5" secondPoint="7" lineColor="black"/>
|
||||
<line typeLine="hair" id="10" firstPoint="5" secondPoint="8" lineColor="black"/>
|
||||
<point type="alongLine" typeLine="none" id="11" name="A7" firstPoint="2" secondPoint="3" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
|
||||
<line typeLine="hair" id="12" firstPoint="5" secondPoint="11" lineColor="black"/>
|
||||
<operation type="rotation" suffix="a1" id="13" center="5" angle="323.758">
|
||||
<source>
|
||||
<item idObject="8"/>
|
||||
<item idObject="6"/>
|
||||
<item idObject="3"/>
|
||||
<item idObject="11"/>
|
||||
</source>
|
||||
<destination>
|
||||
<item idObject="14" mx="-2.75649" my="0.70277"/>
|
||||
<item idObject="15" mx="5.68188e+07" my="5.68188e+07"/>
|
||||
<item idObject="16" mx="0.132292" my="0.264583"/>
|
||||
<item idObject="17" mx="0.132292" my="0.264583"/>
|
||||
</destination>
|
||||
</operation>
|
||||
<line typeLine="hair" id="18" firstPoint="5" secondPoint="17" lineColor="black"/>
|
||||
<line typeLine="hair" id="19" firstPoint="17" secondPoint="16" lineColor="black"/>
|
||||
</calculation>
|
||||
<modeling>
|
||||
<point type="modeling" inUse="true" id="20" idObject="16" mx="0.132292" my="0.264583"/>
|
||||
<spline type="modelingSpline" inUse="true" id="21" idObject="15"/>
|
||||
<point type="modeling" inUse="true" id="22" idObject="14" mx="-2.75649" my="0.70277"/>
|
||||
</modeling>
|
||||
<details>
|
||||
<detail closed="1" id="23" name="Деталь" supplement="1" mx="0" width="1" my="0">
|
||||
<node type="NodePoint" nodeType="Contour" idObject="20" mx="0" my="0"/>
|
||||
<node type="NodeSpline" reverse="1" nodeType="Contour" idObject="21" mx="0" my="0"/>
|
||||
<node type="NodePoint" nodeType="Contour" idObject="22" mx="0" my="0"/>
|
||||
</detail>
|
||||
</details>
|
||||
<groups/>
|
||||
</draw>
|
||||
</pattern>
|
|
@ -506,7 +506,7 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
|
|||
{
|
||||
const double dx1 = p2.x() - p1.x();
|
||||
const double dy1 = p2.y() - p1.y();
|
||||
const double epsilon = 0.03 * (dx1 * dx1 + dy1 * dy1); //-V636
|
||||
const double epsilon = 0.06 * (dx1 * dx1 + dy1 * dy1); //-V636
|
||||
return epsilon;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,6 +270,52 @@ void TST_VSpline::GetSegmentPoints_NullSegment()
|
|||
Comparison(points, origPoints);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_VSpline::GetSegmentPoints_RotateTool()
|
||||
{
|
||||
// Input data taken from real case
|
||||
// See the file <root>/src/app/share/collection/bugs/IsPointOnLineSegment_RotateTool_issue.val
|
||||
// Test issue with method IsPointOnLineSegment.
|
||||
|
||||
const VPointF p1(155.93961723681397, -42.472964170961042, "A", 5.0000125984251973, 9.9999874015748045);
|
||||
const VPointF p4(237.32422843061005, 485.80074940371367, "A2", 5.0000125984251973, 9.9999874015748045);
|
||||
|
||||
VSpline spl(p1, p4, 231.11199999999994, "231.112", 145.33899999999997, "145.339", 207.44768503937021, "5.48872",
|
||||
337.50916535433066, "8.92993");
|
||||
|
||||
const QPointF begin(237.32422843061005, 485.80074940371367);
|
||||
const QPointF end (46.623829088412336, 167.78988631718659);
|
||||
|
||||
QVector<QPointF> points;
|
||||
points << spl.GetSegmentPoints(begin, end, true);
|
||||
|
||||
QVector<QPointF> origPoints;
|
||||
origPoints.append(QPointF(237.32422843061005, 485.80074940371367));
|
||||
origPoints.append(QPointF(224.47894722830574, 476.8115274500917));
|
||||
origPoints.append(QPointF(200.4405599713662, 458.9162132315404));
|
||||
origPoints.append(QPointF(178.3387458840754, 441.12004274890694));
|
||||
origPoints.append(QPointF(158.12235273581754, 423.422336123843));
|
||||
origPoints.append(QPointF(139.74022829597683, 405.8224134780004));
|
||||
origPoints.append(QPointF(123.1412203339375, 388.3195949330309));
|
||||
origPoints.append(QPointF(108.27417661908376, 370.91320061058616));
|
||||
origPoints.append(QPointF(95.08794492079983, 353.60255063231807));
|
||||
origPoints.append(QPointF(83.5313730084699, 336.38696511987837));
|
||||
origPoints.append(QPointF(73.55330865147822, 319.2657641949186));
|
||||
origPoints.append(QPointF(65.10259961920897, 302.2382679790908));
|
||||
origPoints.append(QPointF(58.12809368104641, 285.3037965940465));
|
||||
origPoints.append(QPointF(52.57863860637471, 268.4616701614375));
|
||||
origPoints.append(QPointF(48.40308216457812, 251.71120880291573));
|
||||
origPoints.append(QPointF(45.55027212504085, 235.05173264013274));
|
||||
origPoints.append(QPointF(43.9690562571471, 218.48256179474038));
|
||||
origPoints.append(QPointF(43.6082823302811, 202.00301638839034));
|
||||
origPoints.append(QPointF(44.416798113827056, 185.61241654273442));
|
||||
origPoints.append(QPointF(46.34345137716919, 169.31008237942433));
|
||||
origPoints.append(QPointF(46.623829088412336, 167.78988631718659));
|
||||
|
||||
// Begin comparison
|
||||
Comparison(points, origPoints);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_VSpline::CompareThreeWays()
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@ private slots:
|
|||
void GetSegmentPoints_issue412();
|
||||
void GetSegmentPoints_TestPuzzle();
|
||||
void GetSegmentPoints_NullSegment();
|
||||
void GetSegmentPoints_RotateTool();
|
||||
void CompareThreeWays();
|
||||
void TestParametrT();
|
||||
void TestLengthByPoint_data();
|
||||
|
|
Loading…
Reference in New Issue
Block a user