diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-03-03 12:14:43 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-04-25 17:58:40 +0000 |
commit | c530ca1c170798159c3d84029841a1224d1cdc65 (patch) | |
tree | 99636a80d404634838ea440d9c066dd614e21839 /src/corelib/tools/qline.cpp | |
parent | 220028d37c38835987b817193ecaf0e2a1ad066b (diff) |
QLineF: add intersects() as a replacement for intersect()
QLineF::intersect() does not follow the naming rules for functions.
Therefore add a replacement function intersects() instead and also
rename the return type from IntersectType to IntersectionType
[ChangeLog][QtCore][QLineF] added QLineF::intersects() as a replacement
for QLineF::intersect()
Change-Id: I744b960ea339cb817facb12f296f78cca3e7d938
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Diffstat (limited to 'src/corelib/tools/qline.cpp')
-rw-r--r-- | src/corelib/tools/qline.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 6f3c22a6ec..3afd23d76b 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -347,7 +347,7 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) function to determine whether the QLineF represents a valid line or a null line. - The intersect() function determines the IntersectType for this + The intersects() function determines the IntersectionType for this line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but @@ -370,6 +370,11 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) /*! \enum QLineF::IntersectType + \obsolete Use QLineF::IntersectionType instead +*/ + +/*! + \enum QLineF::IntersectionType Describes the intersection between two lines. @@ -657,8 +662,10 @@ QLineF QLineF::unitVector() const return f; } +#if QT_DEPRECATED_SINCE(5, 14) /*! \fn QLineF::IntersectType QLineF::intersect(const QLineF &line, QPointF *intersectionPoint) const + \obsolete Use intersects() instead Returns a value indicating whether or not \e this line intersects with the given \a line. @@ -670,6 +677,23 @@ QLineF QLineF::unitVector() const QLineF::IntersectType QLineF::intersect(const QLineF &l, QPointF *intersectionPoint) const { + return intersects(l, intersectionPoint); +} +#endif + +/*! + \fn QLineF::IntersectionType QLineF::intersects(const QLineF &line, QPointF *intersectionPoint) const + \since 5.14 + + Returns a value indicating whether or not \e this line intersects + with the given \a line. + + The actual intersection point is extracted to \a intersectionPoint + (if the pointer is valid). If the lines are parallel, the + intersection point is undefined. +*/ +QLineF::IntersectionType QLineF::intersects(const QLineF &l, QPointF *intersectionPoint) const +{ // ipmlementation is based on Graphics Gems III's "Faster Line Segment Intersection" const QPointF a = pt2 - pt1; const QPointF b = l.pt1 - l.pt2; |