Fixed wrong calulation tool True darts.
--HG-- branch : develop
This commit is contained in:
parent
db36e6abab
commit
7d991584fb
|
@ -10,6 +10,7 @@
|
||||||
- [#385] Add 'Open Recent' option in Tape.exe, 'File' dropdown menu.
|
- [#385] Add 'Open Recent' option in Tape.exe, 'File' dropdown menu.
|
||||||
|
|
||||||
# Version 0.4.3
|
# Version 0.4.3
|
||||||
|
- Fixed wrong calculation tool True darts.
|
||||||
- [#405] Fixed crash after deleting first pattern piece in the list.
|
- [#405] Fixed crash after deleting first pattern piece in the list.
|
||||||
|
|
||||||
# Version 0.4.2 February 17, 2016
|
# Version 0.4.2 February 17, 2016
|
||||||
|
|
|
@ -66,14 +66,9 @@ void VToolTrueDarts::FindPoint(const QPointF &baseLineP1, const QPointF &baseLin
|
||||||
const qreal degrees = d2d3.angleTo(d2d1);
|
const qreal degrees = d2d3.angleTo(d2d1);
|
||||||
|
|
||||||
QLineF d2blP2(dartP2, baseLineP2);
|
QLineF d2blP2(dartP2, baseLineP2);
|
||||||
d2blP2.setAngle(d2d3.angle()+degrees);
|
d2blP2.setAngle(d2blP2.angle()+degrees);
|
||||||
const QPointF bP2Temp = d2blP2.p2();
|
|
||||||
|
|
||||||
const QLineF bP1bP2Temp(baseLineP1, bP2Temp);
|
if (QLineF(baseLineP1, d2blP2.p2()).intersect(d2d1, &p1) == QLineF::NoIntersection)
|
||||||
|
|
||||||
const QLineF::IntersectType res = bP1bP2Temp.intersect(d2d1, &p1);
|
|
||||||
|
|
||||||
if (res == QLineF::NoIntersection)
|
|
||||||
{
|
{
|
||||||
p1 = QPointF(0, 0);
|
p1 = QPointF(0, 0);
|
||||||
p2 = QPointF(0, 0);
|
p2 = QPointF(0, 0);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "tst_findpoint.h"
|
#include "tst_findpoint.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
|
@ -165,3 +166,45 @@ void TST_FindPoint::TestPointOfIntersectionCurves()
|
||||||
static_cast<HCrossCurvesPoint>(hCross));
|
static_cast<HCrossCurvesPoint>(hCross));
|
||||||
QCOMPARE(result.toPoint(), expect.toPoint());
|
QCOMPARE(result.toPoint(), expect.toPoint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_FindPoint::TestTrueDarts_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QPointF>("baseLineP1");
|
||||||
|
QTest::addColumn<QPointF>("baseLineP2");
|
||||||
|
QTest::addColumn<QPointF>("dartP1");
|
||||||
|
QTest::addColumn<QPointF>("dartP2");
|
||||||
|
QTest::addColumn<QPointF>("dartP3");
|
||||||
|
QTest::addColumn<QPointF>("expectP1");
|
||||||
|
QTest::addColumn<QPointF>("expectP2");
|
||||||
|
|
||||||
|
const QPointF baseLineP1(30.0, 3094.31433071);
|
||||||
|
const QPointF baseLineP2(621.006962676, 3222.38611313);
|
||||||
|
const QPointF dartP1(196.220708253, 3130.33451951);
|
||||||
|
const QPointF dartP2(196.220708253, 3470.49199983);
|
||||||
|
const QPointF dartP3(270.096578587, 3146.34349232);
|
||||||
|
const QPointF p1(196.220708253, 3106.93562497);
|
||||||
|
const QPointF p2(277.006407384, 3116.02492305);
|
||||||
|
|
||||||
|
QTest::newRow("Real case") << baseLineP1 << baseLineP2 << dartP1 << dartP2 << dartP3 << p1 << p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_FindPoint::TestTrueDarts()
|
||||||
|
{
|
||||||
|
QFETCH(QPointF, baseLineP1);
|
||||||
|
QFETCH(QPointF, baseLineP2);
|
||||||
|
QFETCH(QPointF, dartP1);
|
||||||
|
QFETCH(QPointF, dartP2);
|
||||||
|
QFETCH(QPointF, dartP3);
|
||||||
|
QFETCH(QPointF, expectP1);
|
||||||
|
QFETCH(QPointF, expectP2);
|
||||||
|
|
||||||
|
QPointF p1;
|
||||||
|
QPointF p2;
|
||||||
|
|
||||||
|
VToolTrueDarts::FindPoint(baseLineP1, baseLineP2, dartP1, dartP2, dartP3, p1, p2);
|
||||||
|
|
||||||
|
QCOMPARE(p1.toPoint(), expectP1.toPoint());
|
||||||
|
QCOMPARE(p2.toPoint(), expectP2.toPoint());
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,9 @@ private slots:
|
||||||
void TestPointOfIntersectionCurves_data();
|
void TestPointOfIntersectionCurves_data();
|
||||||
void TestPointOfIntersectionCurves();
|
void TestPointOfIntersectionCurves();
|
||||||
|
|
||||||
|
void TestTrueDarts_data();
|
||||||
|
void TestTrueDarts();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TST_FINDPOINT_H
|
#endif // TST_FINDPOINT_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user