@@ -98,7 +98,7 @@ class QgsGeometryUtils
98
98
:rtype: bool
99
99
%End
100
100
101
- static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint /Out/, bool &isIntersection /Out/, double tolerance, bool acceptImproperIntersection = false );
101
+ static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint /Out/, bool &isIntersection /Out/, const double tolerance = 1e-8 , bool acceptImproperIntersection = false );
102
102
%Docstring
103
103
Compute the intersection between two segments
104
104
\param p1 First segment start point
@@ -112,24 +112,23 @@ class QgsGeometryUtils
112
112
:return: Whether the segments intersect
113
113
* Example:
114
114
\code{.py}
115
- epsilon = 1e-8
116
- ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 1 ), QgsPoint( 1, 1 ), QgsPoint( 1, 0 ), epsilon )
115
+ ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 1 ), QgsPoint( 1, 1 ), QgsPoint( 1, 0 ) )
117
116
ret[0], ret[1].asWkt(), ret[2]
118
117
# Whether the segments intersect, the intersection point, is intersect
119
118
# (False, 'Point (0 0)', False)
120
- ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ), epsilon )
119
+ ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ) )
121
120
ret[0], ret[1].asWkt(), ret[2]
122
121
# (False, 'Point (0 5)', True)
123
- ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ), epsilon, True )
122
+ ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ), acceptImproperIntersection= True )
124
123
ret[0], ret[1].asWkt(), ret[2]
125
124
# (True, 'Point (0 5)', True)
126
- ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ), epsilon )
125
+ ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ) )
127
126
ret[0], ret[1].asWkt(), ret[2]
128
127
# (False, 'Point (0 2)', True)
129
- ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ), epsilon, True )
128
+ ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ), acceptImproperIntersection= True )
130
129
ret[0], ret[1].asWkt(), ret[2]
131
130
# (True, 'Point (0 2)', True)
132
- ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, -5 ), QgsPoint( 0, 5 ), QgsPoint( 2, 0 ), QgsPoint( -1, 0 ), epsilon )
131
+ ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, -5 ), QgsPoint( 0, 5 ), QgsPoint( 2, 0 ), QgsPoint( -1, 0 ) )
133
132
ret[0], ret[1].asWkt(), ret[2]
134
133
# (True, 'Point (0 0)', True)
135
134
\endcode
0 commit comments