New function IsLineSegmentOnLineSegment().
Helps to find if two segments are on same line have real intersection. --HG-- branch : develop
This commit is contained in:
parent
5aadcd067b
commit
a667fdce1c
|
@ -472,6 +472,24 @@ bool VGObject::IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const Q
|
|||
return IsPointOnLineviaPDP(t, p1, p2, accuracy);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VGObject::IsLineSegmentOnLineSegment(const QLineF &seg1, const QLineF &seg2, qreal accuracy)
|
||||
{
|
||||
const bool onLine = IsPointOnLineviaPDP(seg1.p1(), seg2.p1(), seg2.p2(), accuracy) &&
|
||||
IsPointOnLineviaPDP(seg1.p2(), seg2.p1(), seg2.p2(), accuracy);
|
||||
if (onLine)
|
||||
{
|
||||
return IsPointOnLineSegment(seg1.p1(), seg2.p1(), seg2.p2(), accuracy) ||
|
||||
IsPointOnLineSegment(seg1.p2(), seg2.p1(), seg2.p2(), accuracy) ||
|
||||
IsPointOnLineSegment(seg2.p1(), seg1.p1(), seg1.p2(), accuracy) ||
|
||||
IsPointOnLineSegment(seg2.p2(), seg1.p1(), seg1.p2(), accuracy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return onLine;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VGObject::CorrectDistortion(const QPointF &t, const QPointF &p1, const QPointF &p2)
|
||||
{
|
||||
|
|
|
@ -98,6 +98,8 @@ public:
|
|||
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
|
||||
static bool IsPointOnLineSegment (const QPointF &t, const QPointF &p1, const QPointF &p2,
|
||||
qreal accuracy = accuracyPointOnLine);
|
||||
static bool IsLineSegmentOnLineSegment (const QLineF &seg1, const QLineF &seg2,
|
||||
qreal accuracy = accuracyPointOnLine);
|
||||
static QPointF CorrectDistortion(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||
static bool IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2,
|
||||
qreal accuracy = accuracyPointOnLine);
|
||||
|
|
Loading…
Reference in New Issue
Block a user