Skip to content

Commit 978d927

Browse files
committed
better argument names for QgsGeometryUtils::lineIntersection
1 parent 9f99453 commit 978d927

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

python/core/geometry/qgsgeometryutils.sip

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ Returns the squared distance between a point and a line.
9999
:rtype: float
100100
%End
101101

102-
static bool lineIntersection( const QgsPoint &p1, QgsVector v, const QgsPoint &q1, QgsVector w, QgsPoint &inter /Out/ );
102+
static bool lineIntersection( const QgsPoint &p1, QgsVector v1, const QgsPoint &p2, QgsVector v2, QgsPoint &intersection /Out/ );
103103
%Docstring
104104
Compute the intersection between two lines
105105
:param p1: Point on the first line
106-
:param v: Direction vector of the first line
107-
:param q1: Point on the second line
108-
:param w: Direction vector of the second line
109-
:param inter: Output parameter, the intersection point
106+
:param v1: Direction vector of the first line
107+
:param p2: Point on the second line
108+
:param v2: Direction vector of the second line
109+
:param intersection: Output parameter, the intersection point
110110

111111
:return: Whether the lines intersect
112112
:rtype: bool

src/core/geometry/qgsgeometryutils.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,18 @@ double QgsGeometryUtils::sqrDistToLine( double ptX, double ptY, double x1, doubl
235235
return dist;
236236
}
237237

238-
bool QgsGeometryUtils::lineIntersection( const QgsPoint &p1, QgsVector v, const QgsPoint &q1, QgsVector w, QgsPoint &inter )
238+
bool QgsGeometryUtils::lineIntersection( const QgsPoint &p1, QgsVector v1, const QgsPoint &p2, QgsVector v2, QgsPoint &intersection )
239239
{
240-
double d = v.y() * w.x() - v.x() * w.y();
240+
double d = v1.y() * v2.x() - v1.x() * v2.y();
241241

242242
if ( qgsDoubleNear( d, 0 ) )
243243
return false;
244244

245-
double dx = q1.x() - p1.x();
246-
double dy = q1.y() - p1.y();
247-
double k = ( dy * w.x() - dx * w.y() ) / d;
245+
double dx = p2.x() - p1.x();
246+
double dy = p2.y() - p1.y();
247+
double k = ( dy * v2.x() - dx * v2.y() ) / d;
248248

249-
inter = QgsPoint( p1.x() + v.x() * k, p1.y() + v.y() * k );
249+
intersection = QgsPoint( p1.x() + v1.x() * k, p1.y() + v1.y() * k );
250250

251251
return true;
252252
}

src/core/geometry/qgsgeometryutils.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ class CORE_EXPORT QgsGeometryUtils
9292
/**
9393
* \brief Compute the intersection between two lines
9494
* \param p1 Point on the first line
95-
* \param v Direction vector of the first line
96-
* \param q1 Point on the second line
97-
* \param w Direction vector of the second line
98-
* \param inter Output parameter, the intersection point
95+
* \param v1 Direction vector of the first line
96+
* \param p2 Point on the second line
97+
* \param v2 Direction vector of the second line
98+
* \param intersection Output parameter, the intersection point
9999
* \returns Whether the lines intersect
100100
*/
101-
static bool lineIntersection( const QgsPoint &p1, QgsVector v, const QgsPoint &q1, QgsVector w, QgsPoint &inter SIP_OUT );
101+
static bool lineIntersection( const QgsPoint &p1, QgsVector v1, const QgsPoint &p2, QgsVector v2, QgsPoint &intersection SIP_OUT );
102102

103103
/**
104104
* \brief Compute the intersection between two segments

0 commit comments

Comments
 (0)