Branch data Line data Source code
1 : : /***************************************************************************
2 : : qgsgeometryutils.h
3 : : -------------------------------------------------------------------
4 : : Date : 21 Nov 2014
5 : : Copyright : (C) 2014 by Marco Hugentobler
6 : : email : marco.hugentobler at sourcepole dot com
7 : : ***************************************************************************
8 : : * *
9 : : * This program is free software; you can redistribute it and/or modify *
10 : : * it under the terms of the GNU General Public License as published by *
11 : : * the Free Software Foundation; either version 2 of the License, or *
12 : : * (at your option) any later version. *
13 : : * *
14 : : ***************************************************************************/
15 : :
16 : : #ifndef QGSGEOMETRYUTILS_H
17 : : #define QGSGEOMETRYUTILS_H
18 : :
19 : : #include <limits>
20 : :
21 : : #include "qgis_core.h"
22 : : #include "qgis_sip.h"
23 : : #include "qgspoint.h"
24 : : #include "qgsabstractgeometry.h"
25 : : #include "qgsvector3d.h"
26 : :
27 : : #include <QJsonArray>
28 : :
29 : : class QgsLineString;
30 : :
31 : : /**
32 : : * \ingroup core
33 : : * \class QgsGeometryUtils
34 : : * \brief Contains various geometry utility functions.
35 : : * \since QGIS 2.10
36 : : */
37 : : class CORE_EXPORT QgsGeometryUtils
38 : : {
39 : : public:
40 : :
41 : : /**
42 : : * Returns list of linestrings extracted from the passed geometry. The returned objects
43 : : * have to be deleted by the caller.
44 : : */
45 : : static QVector<QgsLineString *> extractLineStrings( const QgsAbstractGeometry *geom ) SIP_FACTORY;
46 : :
47 : : /**
48 : : * Returns the closest vertex to a geometry for a specified point.
49 : : * On error null point will be returned and "id" argument will be invalid.
50 : : */
51 : : static QgsPoint closestVertex( const QgsAbstractGeometry &geom, const QgsPoint &pt, QgsVertexId &id SIP_OUT );
52 : :
53 : : /**
54 : : * Returns the nearest point on a segment of a \a geometry
55 : : * for the specified \a point. The z and m values will be linearly interpolated between
56 : : * the two neighbouring vertices.
57 : : */
58 : : static QgsPoint closestPoint( const QgsAbstractGeometry &geometry, const QgsPoint &point );
59 : :
60 : : /**
61 : : * Returns the distance along a geometry from its first vertex to the specified vertex.
62 : : * \param geom geometry
63 : : * \param id vertex id to find distance to
64 : : * \returns distance to vertex (following geometry)
65 : : * \since QGIS 2.16
66 : : */
67 : : static double distanceToVertex( const QgsAbstractGeometry &geom, QgsVertexId id );
68 : :
69 : : /**
70 : : * Retrieves the vertices which are before and after the interpolated point at a specified distance along a linestring
71 : : * (or polygon boundary).
72 : : * \param geometry line or polygon geometry
73 : : * \param distance distance to traverse along geometry
74 : : * \param previousVertex will be set to previous vertex ID
75 : : * \param nextVertex will be set to next vertex ID
76 : : * \returns TRUE if vertices were successfully retrieved
77 : : * \note if the distance coincides exactly with a vertex, then both previousVertex and nextVertex will be set to this vertex
78 : : * \since QGIS 3.0
79 : : */
80 : : static bool verticesAtDistance( const QgsAbstractGeometry &geometry,
81 : : double distance,
82 : : QgsVertexId &previousVertex SIP_OUT,
83 : : QgsVertexId &nextVertex SIP_OUT );
84 : :
85 : : /**
86 : : * Returns the squared 2D distance between two points.
87 : : */
88 : : static double sqrDistance2D( const QgsPoint &pt1, const QgsPoint &pt2 ) SIP_HOLDGIL;
89 : :
90 : : /**
91 : : * Returns the squared distance between a point and a line.
92 : : */
93 : : static double sqrDistToLine( double ptX, double ptY, double x1, double y1, double x2, double y2, double &minDistX SIP_OUT, double &minDistY SIP_OUT, double epsilon ) SIP_HOLDGIL;
94 : :
95 : : /**
96 : : * Computes the intersection between two lines. Z dimension is
97 : : * supported and is retrieved from the first 3D point amongst \a p1 and
98 : : * \a p2.
99 : : * \param p1 Point on the first line
100 : : * \param v1 Direction vector of the first line
101 : : * \param p2 Point on the second line
102 : : * \param v2 Direction vector of the second line
103 : : * \param intersection Output parameter, the intersection point
104 : : * \returns Whether the lines intersect
105 : : */
106 : : static bool lineIntersection( const QgsPoint &p1, QgsVector v1, const QgsPoint &p2, QgsVector v2, QgsPoint &intersection SIP_OUT ) SIP_HOLDGIL;
107 : :
108 : : /**
109 : : * \brief Compute the intersection between two segments
110 : : * \param p1 First segment start point
111 : : * \param p2 First segment end point
112 : : * \param q1 Second segment start point
113 : : * \param q2 Second segment end point
114 : : * \param intersectionPoint Output parameter, the intersection point
115 : : * \param isIntersection Output parameter, return TRUE if an intersection is found
116 : : * \param tolerance The tolerance to use
117 : : * \param acceptImproperIntersection By default, this method returns TRUE only if segments have proper intersection. If set true, returns also TRUE if segments have improper intersection (end of one segment on other segment ; continuous segments).
118 : : * \returns Whether the segments intersect
119 : : *
120 : : * ### Example
121 : : *
122 : : * \code{.py}
123 : : * ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 1 ), QgsPoint( 1, 1 ), QgsPoint( 1, 0 ) )
124 : : * ret[0], ret[1].asWkt(), ret[2]
125 : : * # Whether the segments intersect, the intersection point, is intersect
126 : : * # (False, 'Point (0 0)', False)
127 : : * ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ) )
128 : : * ret[0], ret[1].asWkt(), ret[2]
129 : : * # (False, 'Point (0 5)', True)
130 : : * ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 5 ), QgsPoint( 1, 5 ), acceptImproperIntersection=True )
131 : : * ret[0], ret[1].asWkt(), ret[2]
132 : : * # (True, 'Point (0 5)', True)
133 : : * ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ) )
134 : : * ret[0], ret[1].asWkt(), ret[2]
135 : : * # (False, 'Point (0 2)', True)
136 : : * ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 2 ), QgsPoint( 1, 5 ), acceptImproperIntersection=True )
137 : : * ret[0], ret[1].asWkt(), ret[2]
138 : : * # (True, 'Point (0 2)', True)
139 : : * ret = QgsGeometryUtils.segmentIntersection( QgsPoint( 0, -5 ), QgsPoint( 0, 5 ), QgsPoint( 2, 0 ), QgsPoint( -1, 0 ) )
140 : : * ret[0], ret[1].asWkt(), ret[2]
141 : : * # (True, 'Point (0 0)', True)
142 : : * \endcode
143 : : */
144 : : static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint SIP_OUT, bool &isIntersection SIP_OUT, double tolerance = 1e-8, bool acceptImproperIntersection = false ) SIP_HOLDGIL;
145 : :
146 : : /**
147 : : * \brief Compute the intersection of a line and a circle.
148 : : * If the intersection has two solutions (points),
149 : : * the closest point to the initial \a intersection point is returned.
150 : : * \param center the center of the circle
151 : : * \param radius the radius of the circle
152 : : * \param linePoint1 a first point on the line
153 : : * \param linePoint2 a second point on the line
154 : : * \param intersection the initial point and the returned intersection point
155 : : * \return TRUE if an intersection has been found
156 : : */
157 : : static bool lineCircleIntersection( const QgsPointXY ¢er, double radius,
158 : : const QgsPointXY &linePoint1, const QgsPointXY &linePoint2,
159 : : QgsPointXY &intersection SIP_INOUT ) SIP_HOLDGIL;
160 : :
161 : : /**
162 : : * Calculates the intersections points between the circle with center \a center1 and
163 : : * radius \a radius1 and the circle with center \a center2 and radius \a radius2.
164 : : *
165 : : * If found, the intersection points will be stored in \a intersection1 and \a intersection2.
166 : : *
167 : : * \returns number of intersection points found.
168 : : *
169 : : * \since QGIS 3.2
170 : : */
171 : : static int circleCircleIntersections( QgsPointXY center1, double radius1,
172 : : QgsPointXY center2, double radius2,
173 : : QgsPointXY &intersection1 SIP_OUT, QgsPointXY &intersection2 SIP_OUT ) SIP_HOLDGIL;
174 : :
175 : : /**
176 : : * Calculates the tangent points between the circle with the specified \a center and \a radius
177 : : * and the point \a p.
178 : : *
179 : : * If found, the tangent points will be stored in \a pt1 and \a pt2.
180 : : *
181 : : * \since QGIS 3.2
182 : : */
183 : : static bool tangentPointAndCircle( const QgsPointXY ¢er, double radius,
184 : : const QgsPointXY &p, QgsPointXY &pt1 SIP_OUT, QgsPointXY &pt2 SIP_OUT ) SIP_HOLDGIL;
185 : :
186 : : /**
187 : : * Calculates the outer tangent points for two circles, centered at \a center1 and
188 : : * \a center2 and with radii of \a radius1 and \a radius2 respectively.
189 : : *
190 : : * The outer tangent points correspond to the points at which the two lines
191 : : * which are drawn so that they are tangential to both circles touch
192 : : * the circles.
193 : : *
194 : : * The first tangent line is described by the points
195 : : * stored in \a line1P1 and \a line1P2,
196 : : * and the second line is described by the points stored in \a line2P1
197 : : * and \a line2P2.
198 : : *
199 : : * Returns the number of tangents (either 0 or 2).
200 : : *
201 : : * \since QGIS 3.2
202 : : */
203 : : static int circleCircleOuterTangents(
204 : : const QgsPointXY ¢er1, double radius1, const QgsPointXY ¢er2, double radius2,
205 : : QgsPointXY &line1P1 SIP_OUT, QgsPointXY &line1P2 SIP_OUT,
206 : : QgsPointXY &line2P1 SIP_OUT, QgsPointXY &line2P2 SIP_OUT ) SIP_HOLDGIL;
207 : :
208 : : /**
209 : : * Calculates the inner tangent points for two circles, centered at \a
210 : : * center1 and \a center2 and with radii of \a radius1 and \a radius2
211 : : * respectively.
212 : : *
213 : : * The inner tangent points correspond to the points at which the two lines
214 : : * which are drawn so that they are tangential to both circles and are
215 : : * crossing each other.
216 : : *
217 : : * The first tangent line is described by the points
218 : : * stored in \a line1P1 and \a line1P2,
219 : : * and the second line is described by the points stored in \a line2P1
220 : : * and \a line2P2.
221 : : *
222 : : * Returns the number of tangents (either 0 or 2).
223 : : *
224 : : * \since QGIS 3.6
225 : : */
226 : : static int circleCircleInnerTangents(
227 : : const QgsPointXY ¢er1, double radius1, const QgsPointXY ¢er2, double radius2,
228 : : QgsPointXY &line1P1 SIP_OUT, QgsPointXY &line1P2 SIP_OUT,
229 : : QgsPointXY &line2P1 SIP_OUT, QgsPointXY &line2P2 SIP_OUT ) SIP_HOLDGIL;
230 : :
231 : : /**
232 : : * \brief Project the point on a segment
233 : : * \param p The point
234 : : * \param s1 The segment start point
235 : : * \param s2 The segment end point
236 : : * \returns The projection of the point on the segment
237 : : */
238 : 699 : static QgsPoint projectPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ) SIP_HOLDGIL
239 : : {
240 : 699 : double nx = s2.y() - s1.y();
241 : 699 : double ny = -( s2.x() - s1.x() );
242 : 699 : double t = ( p.x() * ny - p.y() * nx - s1.x() * ny + s1.y() * nx ) / ( ( s2.x() - s1.x() ) * ny - ( s2.y() - s1.y() ) * nx );
243 : 699 : return t < 0. ? s1 : t > 1. ? s2 : QgsPoint( s1.x() + ( s2.x() - s1.x() ) * t, s1.y() + ( s2.y() - s1.y() ) * t );
244 : : }
245 : :
246 : : //! \note not available in Python bindings
247 : 42 : struct SelfIntersection SIP_SKIP
248 : : {
249 : : int segment1;
250 : : int segment2;
251 : : QgsPoint point;
252 : : };
253 : :
254 : : /**
255 : : * \brief Find self intersections in a polyline
256 : : * \param geom The geometry to check
257 : : * \param part The part of the geometry to check
258 : : * \param ring The ring of the geometry part to check
259 : : * \param tolerance The tolerance to use
260 : : * \returns The list of self intersections
261 : : * \note not available in Python bindings
262 : : * \since QGIS 2.12
263 : : */
264 : : static QVector<SelfIntersection> selfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) SIP_SKIP;
265 : :
266 : : /**
267 : : * Returns a value < 0 if the point (\a x, \a y) is left of the line from (\a x1, \a y1) -> (\a x2, \a y2).
268 : : * A positive return value indicates the point is to the right of the line.
269 : : *
270 : : * If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly
271 : : * on the line, or exactly in line with the segment) and the result is undefined.
272 : : */
273 : : static int leftOfLine( const double x, const double y, const double x1, const double y1, const double x2, const double y2 ) SIP_HOLDGIL;
274 : :
275 : : /**
276 : : * Returns a value < 0 if the point \a point is left of the line from \a p1 -> \a p2.
277 : : * A positive return value indicates the point is to the right of the line.
278 : : *
279 : : * If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly
280 : : * on the line, or exactly in line with the segment) and the result is undefined.
281 : : *
282 : : * \since QGIS 3.6
283 : : */
284 : : static int leftOfLine( const QgsPoint &point, const QgsPoint &p1, const QgsPoint &p2 ) SIP_HOLDGIL;
285 : :
286 : : /**
287 : : * Returns a point a specified \a distance toward a second point.
288 : : */
289 : : static QgsPoint pointOnLineWithDistance( const QgsPoint &startPoint, const QgsPoint &directionPoint, double distance ) SIP_HOLDGIL;
290 : :
291 : : /**
292 : : * Calculates the point a specified \a distance from (\a x1, \a y1) toward a second point (\a x2, \a y2).
293 : : *
294 : : * Optionally, interpolated z and m values can be obtained by specifying the \a z1, \a z2 and \a z arguments
295 : : * and/or the \a m1, \a m2, \a m arguments.
296 : : *
297 : : * \note Not available in Python bindings
298 : : * \since QGIS 3.4
299 : : */
300 : : static void pointOnLineWithDistance( double x1, double y1, double x2, double y2, double distance, double &x, double &y,
301 : : double *z1 = nullptr, double *z2 = nullptr, double *z = nullptr,
302 : : double *m1 = nullptr, double *m2 = nullptr, double *m = nullptr ) SIP_SKIP;
303 : :
304 : : /**
305 : : * Calculates a point a certain \a proportion of the way along the segment from (\a x1, \a y1) to (\a x2, \a y2),
306 : : * offset from the segment by the specified \a offset amount.
307 : : *
308 : : * \param x1 x-coordinate of start of segment
309 : : * \param y1 y-coordinate of start of segment
310 : : * \param x2 x-coordinate of end of segment
311 : : * \param y2 y-coordinate of end of segment
312 : : * \param proportion proportion of the segment's length at which to place the point (between 0.0 and 1.0)
313 : : * \param offset perpendicular offset from segment to apply to point. A negative \a offset shifts the point to the left of the segment, while a positive \a offset will shift it to the right of the segment.
314 : : * \param x calculated point x-coordinate
315 : : * \param y calculated point y-coordinate
316 : : *
317 : : * ### Example
318 : : *
319 : : * \code{.py}
320 : : * # Offset point at center of segment by 2 units to the right
321 : : * x, y = QgsGeometryUtils.perpendicularOffsetPointAlongSegment( 1, 5, 11, 5, 0.5, 2 )
322 : : * # (6.0, 3.0)
323 : : *
324 : : * # Offset point at center of segment by 2 units to the left
325 : : * x, y = QgsGeometryUtils.perpendicularOffsetPointAlongSegment( 1, 5, 11, 5, 0.5, -2 )
326 : : * # (6.0, 7.0)
327 : : * \endcode
328 : : *
329 : : * \since QGIS 3.20
330 : : */
331 : : static void perpendicularOffsetPointAlongSegment( double x1, double y1, double x2, double y2, double proportion, double offset, double *x SIP_OUT, double *y SIP_OUT );
332 : :
333 : : /**
334 : : * Interpolates a point on an arc defined by three points, \a pt1, \a pt2 and \a pt3. The arc will be
335 : : * interpolated by the specified \a distance from \a pt1.
336 : : *
337 : : * Any z or m values present in the points will also be linearly interpolated in the output.
338 : : *
339 : : * \since QGIS 3.4
340 : : */
341 : : static QgsPoint interpolatePointOnArc( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double distance ) SIP_HOLDGIL;
342 : :
343 : : //! Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0
344 : : static double ccwAngle( double dy, double dx ) SIP_HOLDGIL;
345 : :
346 : : //! Returns radius and center of the circle through pt1, pt2, pt3
347 : : static void circleCenterRadius( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double &radius SIP_OUT,
348 : : double ¢erX SIP_OUT, double ¢erY SIP_OUT ) SIP_HOLDGIL;
349 : :
350 : : /**
351 : : * Returns TRUE if the circle defined by three angles is ordered clockwise.
352 : : *
353 : : * The angles are defined counter-clockwise from the origin, i.e. using
354 : : * Euclidean angles as opposed to geographic "North up" angles.
355 : : */
356 : : static bool circleClockwise( double angle1, double angle2, double angle3 ) SIP_HOLDGIL;
357 : :
358 : : //! Returns TRUE if, in a circle, angle is between angle1 and angle2
359 : : static bool circleAngleBetween( double angle, double angle1, double angle2, bool clockwise ) SIP_HOLDGIL;
360 : :
361 : : /**
362 : : * Returns TRUE if an angle is between angle1 and angle3 on a circle described by
363 : : * angle1, angle2 and angle3.
364 : : */
365 : : static bool angleOnCircle( double angle, double angle1, double angle2, double angle3 ) SIP_HOLDGIL;
366 : :
367 : : //! Length of a circular string segment defined by pt1, pt2, pt3
368 : : static double circleLength( double x1, double y1, double x2, double y2, double x3, double y3 ) SIP_HOLDGIL;
369 : :
370 : : //! Calculates angle of a circular string part defined by pt1, pt2, pt3
371 : : static double sweepAngle( double centerX, double centerY, double x1, double y1, double x2, double y2, double x3, double y3 ) SIP_HOLDGIL;
372 : :
373 : : /**
374 : : * Calculates midpoint on circle passing through \a p1 and \a p2, closest to
375 : : * the given coordinate \a mousePos. Z dimension is supported and is retrieved from the
376 : : * first 3D point amongst \a p1 and \a p2.
377 : : * \see segmentMidPointFromCenter()
378 : : */
379 : : static bool segmentMidPoint( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &result SIP_OUT, double radius, const QgsPoint &mousePos ) SIP_HOLDGIL;
380 : :
381 : : /**
382 : : * Calculates the midpoint on the circle passing through \a p1 and \a p2,
383 : : * with the specified \a center coordinate.
384 : : *
385 : : * If \a useShortestArc is TRUE, then the midpoint returned will be that corresponding
386 : : * to the shorter arc from \a p1 to \a p2. If it is FALSE, the longer arc from \a p1
387 : : * to \a p2 will be used (i.e. winding the other way around the circle).
388 : : *
389 : : * \see segmentMidPoint()
390 : : * \since QGIS 3.2
391 : : */
392 : : static QgsPoint segmentMidPointFromCenter( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint ¢er, bool useShortestArc = true ) SIP_HOLDGIL;
393 : :
394 : : //! Calculates the direction angle of a circle tangent (clockwise from north in radians)
395 : : static double circleTangentDirection( const QgsPoint &tangentPoint, const QgsPoint &cp1, const QgsPoint &cp2, const QgsPoint &cp3 ) SIP_HOLDGIL;
396 : :
397 : : /**
398 : : * Convert circular arc defined by p1, p2, p3 (p1/p3 being start resp. end point, p2 lies on the arc) into a sequence of points.
399 : : * \since 3.0
400 : : */
401 : : static void segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3,
402 : : QgsPointSequence SIP_PYALTERNATIVETYPE( QVector<QgsPoint> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
403 : : QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle,
404 : : bool hasZ = false, bool hasM = false );
405 : :
406 : : /**
407 : : * Returns TRUE if point \a b is on the arc formed by points \a a1, \a a2, and \a a3, but not within
408 : : * that arc portion already described by \a a1, \a a2 and \a a3.
409 : : *
410 : : * The \a distanceTolerance specifies the maximum deviation allowed between the original location
411 : : * of point \b and where it would fall on the candidate arc.
412 : : *
413 : : * This method only consider a segments as continuing an arc if the points are all regularly spaced
414 : : * on the candidate arc. The \a pointSpacingAngleTolerance parameter specifies the maximum
415 : : * angular deviation (in radians) allowed when testing for regular point spacing.
416 : : *
417 : : * \note The API is considered EXPERIMENTAL and can be changed without a notice
418 : : *
419 : : * \since QGIS 3.14
420 : : */
421 : : static bool pointContinuesArc( const QgsPoint &a1, const QgsPoint &a2, const QgsPoint &a3, const QgsPoint &b, double distanceTolerance,
422 : : double pointSpacingAngleTolerance ) SIP_HOLDGIL;
423 : :
424 : : /**
425 : : * For line defined by points pt1 and pt3, find out on which side of the line is point pt3.
426 : : * Returns -1 if pt3 on the left side, 1 if pt3 is on the right side or 0 if pt3 lies on the line.
427 : : * \since 3.0
428 : : */
429 : : static int segmentSide( const QgsPoint &pt1, const QgsPoint &pt3, const QgsPoint &pt2 ) SIP_HOLDGIL;
430 : :
431 : : /**
432 : : * Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different angles (a1, a2, a3).
433 : : * \since 3.0
434 : : */
435 : : static double interpolateArcValue( double angle, double a1, double a2, double a3, double zm1, double zm2, double zm3 ) SIP_HOLDGIL;
436 : :
437 : : /**
438 : : * Returns a list of points contained in a WKT string.
439 : : * \note not available in Python bindings
440 : : */
441 : : static QgsPointSequence pointsFromWKT( const QString &wktCoordinateList, bool is3D, bool isMeasure ) SIP_SKIP;
442 : :
443 : : /**
444 : : * Returns a LinearRing { uint32 numPoints; Point points[numPoints]; }
445 : : * \note not available in Python bindings
446 : : */
447 : : static void pointsToWKB( QgsWkbPtr &wkb, const QgsPointSequence &points, bool is3D, bool isMeasure ) SIP_SKIP;
448 : :
449 : : /**
450 : : * Returns a WKT coordinate list
451 : : * \note not available in Python bindings
452 : : */
453 : : static QString pointsToWKT( const QgsPointSequence &points, int precision, bool is3D, bool isMeasure ) SIP_SKIP;
454 : :
455 : : /**
456 : : * Returns a gml::coordinates DOM element.
457 : : * \note not available in Python bindings
458 : : */
459 : : static QDomElement pointsToGML2( const QgsPointSequence &points, QDomDocument &doc, int precision, const QString &ns, QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) SIP_SKIP;
460 : :
461 : : /**
462 : : * Returns a gml::posList DOM element.
463 : : * \note not available in Python bindings
464 : : */
465 : : static QDomElement pointsToGML3( const QgsPointSequence &points, QDomDocument &doc, int precision, const QString &ns, bool is3D, QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) SIP_SKIP;
466 : :
467 : : /**
468 : : * Returns a geoJSON coordinates string.
469 : : * \note not available in Python bindings
470 : : */
471 : : static QString pointsToJSON( const QgsPointSequence &points, int precision ) SIP_SKIP;
472 : :
473 : : /**
474 : : * Returns coordinates as json object.
475 : : * \note not available in Python bindings
476 : : */
477 : : static json pointsToJson( const QgsPointSequence &points, int precision ) SIP_SKIP;
478 : :
479 : : /**
480 : : * Ensures that an angle is in the range 0 <= angle < 2 pi.
481 : : * \param angle angle in radians
482 : : * \returns equivalent angle within the range [0, 2 pi)
483 : : */
484 : : static double normalizedAngle( double angle ) SIP_HOLDGIL;
485 : :
486 : : /**
487 : : * Calculates the direction of line joining two points in radians, clockwise from the north direction.
488 : : * \param x1 x-coordinate of line start
489 : : * \param y1 y-coordinate of line start
490 : : * \param x2 x-coordinate of line end
491 : : * \param y2 y-coordinate of line end
492 : : * \returns angle in radians. Returned value is undefined if start and end point are the same.
493 : : */
494 : : static double lineAngle( double x1, double y1, double x2, double y2 ) SIP_HOLDGIL;
495 : :
496 : : /**
497 : : * Calculates the angle between the lines AB and BC, where AB and BC described
498 : : * by points a, b and b, c.
499 : : * \param x1 x-coordinate of point a
500 : : * \param y1 y-coordinate of point a
501 : : * \param x2 x-coordinate of point b
502 : : * \param y2 y-coordinate of point b
503 : : * \param x3 x-coordinate of point c
504 : : * \param y3 y-coordinate of point c
505 : : * \returns angle between lines in radians. Returned value is undefined if two or more points are equal.
506 : : */
507 : : static double angleBetweenThreePoints( double x1, double y1, double x2, double y2,
508 : : double x3, double y3 ) SIP_HOLDGIL;
509 : :
510 : : /**
511 : : * Calculates the perpendicular angle to a line joining two points. Returned angle is in radians,
512 : : * clockwise from the north direction.
513 : : * \param x1 x-coordinate of line start
514 : : * \param y1 y-coordinate of line start
515 : : * \param x2 x-coordinate of line end
516 : : * \param y2 y-coordinate of line end
517 : : * \returns angle in radians. Returned value is undefined if start and end point are the same.
518 : : */
519 : : static double linePerpendicularAngle( double x1, double y1, double x2, double y2 ) SIP_HOLDGIL;
520 : :
521 : : /**
522 : : * Calculates the average angle (in radians) between the two linear segments from
523 : : * (\a x1, \a y1) to (\a x2, \a y2) and (\a x2, \a y2) to (\a x3, \a y3).
524 : : */
525 : : static double averageAngle( double x1, double y1, double x2, double y2, double x3, double y3 ) SIP_HOLDGIL;
526 : :
527 : : /**
528 : : * Averages two angles, correctly handling negative angles and ensuring the result is between 0 and 2 pi.
529 : : * \param a1 first angle (in radians)
530 : : * \param a2 second angle (in radians)
531 : : * \returns average angle (in radians)
532 : : */
533 : : static double averageAngle( double a1, double a2 ) SIP_HOLDGIL;
534 : :
535 : : /**
536 : : * Parses a WKT block of the format "TYPE( contents )" and returns a pair of geometry type to contents ("Pair(wkbType, "contents")")
537 : : * \note not available in Python bindings
538 : : */
539 : : static QPair<QgsWkbTypes::Type, QString> wktReadBlock( const QString &wkt ) SIP_SKIP;
540 : :
541 : : /**
542 : : * Parses a WKT string and returns of list of blocks contained in the WKT.
543 : : * \param wkt WKT string in the format "TYPE1 (contents1), TYPE2 (TYPE3 (contents3), TYPE4 (contents4))"
544 : : * \param defaultType default geometry type for children
545 : : * \returns list of WKT child block strings, e.g., List("TYPE1 (contents1)", "TYPE2 (TYPE3 (contents3), TYPE4 (contents4))")
546 : : * \note not available in Python bindings
547 : : */
548 : : static QStringList wktGetChildBlocks( const QString &wkt, const QString &defaultType = QString() ) SIP_SKIP;
549 : :
550 : : /**
551 : : * Returns a number representing the closest side of a rectangle defined by /a right,
552 : : * \a bottom, \a left, \a top to the point at (\a x, \a y), where
553 : : * the point may be in the interior of the rectangle or outside it.
554 : : *
555 : : * The returned value may be:
556 : : *
557 : : * 1. Point is closest to top side of rectangle
558 : : * 2. Point is located on the top-right diagonal of rectangle, equally close to the top and right sides
559 : : * 3. Point is closest to right side of rectangle
560 : : * 4. Point is located on the bottom-right diagonal of rectangle, equally close to the bottom and right sides
561 : : * 5. Point is closest to bottom side of rectangle
562 : : * 6. Point is located on the bottom-left diagonal of rectangle, equally close to the bottom and left sides
563 : : * 7. Point is closest to left side of rectangle
564 : : * 8. Point is located on the top-left diagonal of rectangle, equally close to the top and left sides
565 : : *
566 : : * \note This method effectively partitions the space outside of the rectangle into Voronoi cells, so a point
567 : : * to the top left of the rectangle may be assigned to the left or top sides based on its position relative
568 : : * to the diagonal line extended from the rectangle's top-left corner.
569 : : *
570 : : * \since QGIS 3.20
571 : : */
572 : : static int closestSideOfRectangle( double right, double bottom, double left, double top, double x, double y );
573 : :
574 : : /**
575 : : * Returns a middle point between points pt1 and pt2.
576 : : * Z value is computed if one of this point have Z.
577 : : * M value is computed if one of this point have M.
578 : : * \param pt1 first point.
579 : : * \param pt2 second point.
580 : : * \returns New point at middle between points pt1 and pt2.
581 : : *
582 : : * ### Example
583 : : *
584 : : * \code{.py}
585 : : * p = QgsPoint( 4, 6 ) # 2D point
586 : : * pr = midpoint ( p, QgsPoint( 2, 2 ) )
587 : : * # pr is a 2D point: 'Point (3 4)'
588 : : * pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZ, 2, 2, 2 ) )
589 : : * # pr is a 3D point: 'PointZ (3 4 1)'
590 : : * pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointM, 2, 2, 0, 2 ) )
591 : : * # pr is a 3D point: 'PointM (3 4 1)'
592 : : * pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) )
593 : : * # pr is a 3D point: 'PointZM (3 4 1 1)'
594 : : * \endcode
595 : : * \since QGIS 3.0
596 : : */
597 : : static QgsPoint midpoint( const QgsPoint &pt1, const QgsPoint &pt2 ) SIP_HOLDGIL;
598 : :
599 : : /**
600 : : * Interpolates the position of a point a \a fraction of the way along
601 : : * the line from (\a x1, \a y1) to (\a x2, \a y2).
602 : : *
603 : : * Usually the \a fraction should be between 0 and 1, where 0 represents the
604 : : * point at the start of the line (\a x1, \a y1) and 1 represents
605 : : * the end of the line (\a x2, \a y2). However, it is possible to
606 : : * use a \a fraction < 0 or > 1, in which case the returned point
607 : : * is extrapolated from the supplied line.
608 : : *
609 : : * \see interpolatePointOnLineByValue()
610 : : * \since QGIS 3.0.2
611 : : */
612 : : static QgsPointXY interpolatePointOnLine( double x1, double y1, double x2, double y2, double fraction ) SIP_HOLDGIL;
613 : :
614 : : /**
615 : : * Interpolates the position of a point a \a fraction of the way along
616 : : * the line from \a p1 to \a p2.
617 : : *
618 : : * Usually the \a fraction should be between 0 and 1, where 0 represents the
619 : : * point at the start of the line (\a p1) and 1 represents
620 : : * the end of the line (\a p2). However, it is possible to
621 : : * use a \a fraction < 0 or > 1, in which case the returned point
622 : : * is extrapolated from the supplied line.
623 : : *
624 : : * Any Z or M values present in the input points will also be interpolated
625 : : * and present in the returned point.
626 : : *
627 : : * \see interpolatePointOnLineByValue()
628 : : * \since QGIS 3.0.2
629 : : */
630 : : static QgsPoint interpolatePointOnLine( const QgsPoint &p1, const QgsPoint &p2, double fraction ) SIP_HOLDGIL;
631 : :
632 : : /**
633 : : * Interpolates the position of a point along the line from (\a x1, \a y1)
634 : : * to (\a x2, \a y2).
635 : : *
636 : : * The position is interpolated using a supplied target \a value and the value
637 : : * at the start of the line (\a v1) and end of the line (\a v2). The returned
638 : : * point will be linearly interpolated to match position corresponding to
639 : : * the target \a value.
640 : : *
641 : : * \see interpolatePointOnLine()
642 : : * \since QGIS 3.0.2
643 : : */
644 : : static QgsPointXY interpolatePointOnLineByValue( double x1, double y1, double v1, double x2, double y2, double v2, double value ) SIP_HOLDGIL;
645 : :
646 : : /**
647 : : * Returns the gradient of a line defined by points \a pt1 and \a pt2.
648 : : * \param pt1 first point.
649 : : * \param pt2 second point.
650 : : * \returns The gradient of this linear entity, or infinity if vertical
651 : : * \since QGIS 3.0
652 : : */
653 : : static double gradient( const QgsPoint &pt1, const QgsPoint &pt2 ) SIP_HOLDGIL;
654 : :
655 : : /**
656 : : * Returns the coefficients (a, b, c for equation "ax + by + c = 0") of a line defined by points \a pt1 and \a pt2.
657 : : * \param pt1 first point.
658 : : * \param pt2 second point.
659 : : * \param a Output parameter, a coefficient of the equation.
660 : : * \param b Output parameter, b coefficient of the equation.
661 : : * \param c Output parameter, c coefficient of the equation.
662 : : * \since QGIS 3.0
663 : : */
664 : : static void coefficients( const QgsPoint &pt1, const QgsPoint &pt2,
665 : : double &a SIP_OUT, double &b SIP_OUT, double &c SIP_OUT ) SIP_HOLDGIL;
666 : :
667 : : /**
668 : : * \brief Create a perpendicular line segment from p to segment [s1, s2]
669 : : * \param p The point
670 : : * \param s1 The segment start point
671 : : * \param s2 The segment end point
672 : : * \returns A line (segment) from p to perpendicular point on segment [s1, s2]
673 : : */
674 : : static QgsLineString perpendicularSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ) SIP_HOLDGIL;
675 : :
676 : :
677 : : /**
678 : : * An algorithm to calculate the shortest distance between two skew lines.
679 : : * \param P1 is the first point of the first line,
680 : : * \param P12 is the second point on the first line,
681 : : * \param P2 is the first point on the second line,
682 : : * \param P22 is the second point on the second line.
683 : : * \return the shortest distance
684 : : */
685 : : static double skewLinesDistance( const QgsVector3D &P1, const QgsVector3D &P12,
686 : : const QgsVector3D &P2, const QgsVector3D &P22 ) SIP_HOLDGIL;
687 : :
688 : : /**
689 : : * A method to project one skew line onto another.
690 : : * \param P1 is a first point that belonds to first skew line,
691 : : * \param P12 is the second point that belongs to first skew line,
692 : : * \param P2 is the first point that belongs to second skew line,
693 : : * \param P22 is the second point that belongs to second skew line,
694 : : * \param X1 is the result projection point of line P2P22 onto line P1P12,
695 : : * \param epsilon the tolerance to use.
696 : : * \return TRUE if such point exists, FALSE - otherwise.
697 : : */
698 : : static bool skewLinesProjection( const QgsVector3D &P1, const QgsVector3D &P12,
699 : : const QgsVector3D &P2, const QgsVector3D &P22,
700 : : QgsVector3D &X1 SIP_OUT,
701 : : double epsilon = 0.0001 ) SIP_HOLDGIL;
702 : :
703 : : /**
704 : : * An algorithm to calculate an (approximate) intersection of two lines in 3D.
705 : : * \param La1 is the first point on the first line,
706 : : * \param La2 is the second point on the first line,
707 : : * \param Lb1 is the first point on the second line,
708 : : * \param Lb2 is the second point on the second line,
709 : : * \param intersection is the result intersection, of it can be found.
710 : : * \return TRUE if the intersection can be found, FALSE - otherwise.
711 : : *
712 : : * ### Example
713 : : *
714 : : * \code{.py}
715 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(2,1,0), QgsVector3D(2,3,0))
716 : : * # (True, PyQt5.QtGui.QgsVector3D(2.0, 0.0, 0.0))
717 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(2,1,0), QgsVector3D(2,0,0))
718 : : * # (True, PyQt5.QtGui.QgsVector3D(2.0, 0.0, 0.0))
719 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(0,1,0), QgsVector3D(0,3,0))
720 : : * # (True, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0))
721 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(0,1,0), QgsVector3D(0,0,0))
722 : : * # (True, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0))
723 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(5,1,0), QgsVector3D(5,3,0))
724 : : * # (False, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0))
725 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(0,0,0), QgsVector3D(5,0,0), QgsVector3D(5,1,0), QgsVector3D(5,0,0))
726 : : * # (False, PyQt5.QtGui.QgsVector3D(0.0, 0.0, 0.0))
727 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(1,1,0), QgsVector3D(2,2,0), QgsVector3D(3,1,0), QgsVector3D(3,2,0))
728 : : * # (True, PyQt5.QtGui.QgsVector3D(3.0, 3.0, 0.0))
729 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(1,1,0), QgsVector3D(2,2,0), QgsVector3D(3,2,0), QgsVector3D(3,1,0))
730 : : * # (True, PyQt5.QtGui.QgsVector3D(3.0, 3.0, 0.0))
731 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(5,5,5), QgsVector3D(0,0,0), QgsVector3D(0,5,5), QgsVector3D(5,0,0))
732 : : * # (True, PyQt5.QtGui.QgsVector3D(2.5, 2.5, 2.5))
733 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(2.5,2.5,2.5), QgsVector3D(0,5,0), QgsVector3D(2.5,2.5,2.5), QgsVector3D(5,0,0))
734 : : * # (True, PyQt5.QtGui.QgsVector3D(2.5, 2.5, 2.5))
735 : : * QgsGeometryUtils.linesIntersection3D(QgsVector3D(2.5,2.5,2.5), QgsVector3D(5,0,0), QgsVector3D(0,5,5), QgsVector3D(5,5,5))
736 : : * # (True, PyQt5.QtGui.QgsVector3D(0.0, 5.0, 5.0))
737 : : * \endcode
738 : : */
739 : : static bool linesIntersection3D( const QgsVector3D &La1, const QgsVector3D &La2,
740 : : const QgsVector3D &Lb1, const QgsVector3D &Lb2,
741 : : QgsVector3D &intersection SIP_OUT ) SIP_HOLDGIL;
742 : :
743 : : /**
744 : : * Returns the area of the triangle denoted by the points (\a aX, \a aY), (\a bX, \a bY) and
745 : : * (\a cX, \a cY).
746 : : *
747 : : * \since QGIS 3.10
748 : : */
749 : : static double triangleArea( double aX, double aY, double bX, double bY, double cX, double cY ) SIP_HOLDGIL;
750 : :
751 : : /**
752 : : * Returns a weighted point inside the triangle denoted by the points (\a aX, \a aY), (\a bX, \a bY) and
753 : : * (\a cX, \a cY).
754 : : *
755 : : * \param aX x-coordinate of first vertex in triangle
756 : : * \param aY y-coordinate of first vertex in triangle
757 : : * \param bX x-coordinate of second vertex in triangle
758 : : * \param bY y-coordinate of second vertex in triangle
759 : : * \param cX x-coordinate of third vertex in triangle
760 : : * \param cY y-coordinate of third vertex in triangle
761 : : * \param weightB weighting factor along axis A-B (between 0 and 1)
762 : : * \param weightC weighting factor along axis A-C (between 0 and 1)
763 : : * \param pointX x-coordinate of generated point
764 : : * \param pointY y-coordinate of generated point
765 : : *
766 : : * \since QGIS 3.10
767 : : */
768 : : static void weightedPointInTriangle( double aX, double aY, double bX, double bY, double cX, double cY,
769 : : double weightB, double weightC, double &pointX SIP_OUT, double &pointY SIP_OUT ) SIP_HOLDGIL;
770 : :
771 : : /**
772 : : * A Z dimension is added to \a point if one of the point in the list
773 : : * \a points is in 3D. Moreover, the Z value of \a point is updated with.
774 : : *
775 : : * \param points List of points in which a 3D point is searched.
776 : : * \param point The point to update with Z dimension and value.
777 : : * \returns TRUE if the point is updated, FALSE otherwise
778 : : *
779 : : * \since QGIS 3.0
780 : : */
781 : : static bool setZValueFromPoints( const QgsPointSequence &points, QgsPoint &point );
782 : :
783 : : /**
784 : : * Returns the point (\a pointX, \a pointY) forming the bisector from segment (\a aX \a aY) (\a bX \a bY)
785 : : * and segment (\a bX, \a bY) (\a dX, \a dY).
786 : : * The bisector segment of AB-CD is (point, projection of point by \a angle)
787 : : *
788 : : * \param aX x-coordinate of first vertex of the segment ab
789 : : * \param aY y-coordinate of first vertex of the segment ab
790 : : * \param bX x-coordinate of second vertex of the segment ab
791 : : * \param bY y-coordinate of second vertex of the segment ab
792 : : * \param cX x-coordinate of first vertex of the segment cd
793 : : * \param cY y-coordinate of first vertex of the segment cd
794 : : * \param dX x-coordinate of second vertex of the segment cd
795 : : * \param dY y-coordinate of second vertex of the segment cd
796 : : * \param pointX x-coordinate of generated point
797 : : * \param pointY y-coordinate of generated point
798 : : * \param angle angle of the bisector from pointX, pointY origin on [ab-cd]
799 : : * \returns TRUE if the bisector exists (A B and C D are not collinear)
800 : : *
801 : : * \since QGIS 3.18
802 : : */
803 : :
804 : : static bool angleBisector( double aX, double aY, double bX, double bY, double cX, double cY, double dX, double dY,
805 : : double &pointX SIP_OUT, double &pointY SIP_OUT, double &angle SIP_OUT ) SIP_HOLDGIL;
806 : :
807 : : /**
808 : : * Returns the point (\a pointX, \a pointY) forming the bisector from point (\a aX, \a aY) to the segment (\a bX, \a bY) (\a cX, \a cY).
809 : : * The bisector segment of ABC is (A-point)
810 : : *
811 : : * \param aX x-coordinate of first vertex in triangle
812 : : * \param aY y-coordinate of first vertex in triangle
813 : : * \param bX x-coordinate of second vertex in triangle
814 : : * \param bY y-coordinate of second vertex in triangle
815 : : * \param cX x-coordinate of third vertex in triangle
816 : : * \param cY y-coordinate of third vertex in triangle
817 : : * \param pointX x-coordinate of generated point
818 : : * \param pointY y-coordinate of generated point
819 : : * \returns TRUE if the bisector exists (A B and C are not collinear)
820 : : *
821 : : * \since QGIS 3.18
822 : : */
823 : : static bool bisector( double aX, double aY, double bX, double bY, double cX, double cY,
824 : : double &pointX SIP_OUT, double &pointY SIP_OUT ) SIP_HOLDGIL;
825 : :
826 : : //! \note not available in Python bindings
827 : : enum ComponentType SIP_SKIP
828 : : {
829 : : Vertex,
830 : : Ring,
831 : : Part
832 : : };
833 : :
834 : : //! \note not available in Python bindings
835 : 91 : template<class T> static double closestSegmentFromComponents( T &container, ComponentType ctype, const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf, double epsilon ) SIP_SKIP
836 : : {
837 : 91 : double minDist = std::numeric_limits<double>::max();
838 : 91 : double minDistSegmentX = 0.0, minDistSegmentY = 0.0;
839 : 91 : QgsVertexId minDistVertexAfter;
840 : 91 : int minDistLeftOf = 0;
841 : 91 : double sqrDist = 0.0;
842 : 91 : int vertexOffset = 0;
843 : 91 : int ringOffset = 0;
844 : 91 : int partOffset = 0;
845 : :
846 : 224 : for ( int i = 0; i < container.size(); ++i )
847 : : {
848 : 133 : sqrDist = container.at( i )->closestSegment( pt, segmentPt, vertexAfter, leftOf, epsilon );
849 : 133 : if ( sqrDist >= 0 && sqrDist < minDist )
850 : : {
851 : 106 : minDist = sqrDist;
852 : 106 : minDistSegmentX = segmentPt.x();
853 : 106 : minDistSegmentY = segmentPt.y();
854 : 106 : minDistVertexAfter = vertexAfter;
855 : 106 : minDistVertexAfter.vertex = vertexAfter.vertex + vertexOffset;
856 : 106 : minDistVertexAfter.part = vertexAfter.part + partOffset;
857 : 106 : minDistVertexAfter.ring = vertexAfter.ring + ringOffset;
858 : 106 : if ( leftOf )
859 : : {
860 : 106 : minDistLeftOf = *leftOf;
861 : 106 : }
862 : 106 : }
863 : :
864 : 133 : if ( ctype == Vertex )
865 : : {
866 : : //-1 because compoundcurve counts duplicated vertices of neighbour curves as one node
867 : 32 : vertexOffset += container.at( i )->nCoordinates() - 1;
868 : 32 : }
869 : 101 : else if ( ctype == Ring )
870 : : {
871 : 66 : ringOffset += 1;
872 : 66 : }
873 : 35 : else if ( ctype == Part )
874 : : {
875 : 35 : partOffset += 1;
876 : 35 : }
877 : 133 : }
878 : :
879 : 91 : if ( minDist == std::numeric_limits<double>::max() )
880 : 4 : return -1; // error: no segments
881 : :
882 : 87 : segmentPt.setX( minDistSegmentX );
883 : 87 : segmentPt.setY( minDistSegmentY );
884 : 87 : vertexAfter = minDistVertexAfter;
885 : 87 : if ( leftOf )
886 : : {
887 : 87 : *leftOf = minDistLeftOf;
888 : 87 : }
889 : 87 : return minDist;
890 : 91 : }
891 : : };
892 : :
893 : : #endif // QGSGEOMETRYUTILS_H
|