Bases: qgis._core.QgsPointXY
Extend QgsPoint with some utility methods.
Get angle for nearest vertex in a geometry.
For the vertex in geom nearest to this point, give the angle between its adjacent vertexs.
geom (QgsGeometry) – Geometry to test.
(float) Angle between the vertex and their adjacents,
Test if nearest vertex in a geometry is a corner.
For the vertex in a geometry nearest to this point, give context to determine if it is a corner (the angle differs by more than straight_thr of 180 and if the distance from the vertex to the segment formed by their adjacents is greater than cath_thr).
geom (QgsGeometry) – Geometry to test.
acute_thr (float) – Acute angle threshold.
straight_thr (float) – Straight angle threshold.
cath_thr (float) – Cathetus threshold.
(float) Angle between the vertex and their adjacents. (bool) True if the angle is too low (< acute_thr). (bool) True for a corner (float) Distance to the nearest segment.
Test if nearest vertex in geometry is spike.
For the vertex in a geometry nearest to this point, give context to determine if its a zig-zag or a spike. It’s a zig-zag if both the angles of this vertex and the closest adjacents are acute. It’s a spike if the angle of this vertex is acute and the angle of the closest vertex is not straight.
geom (QgsGeometry) – Geometry to test.
acute_thr (float) – Acute angle threshold.
straight_thr (float) – Straight angle threshold.
threshold (float) – # Filter for angles.
(float) angle_v = angle between the vertex and their adjacents. (float) angle_a = angle between the closest adjacent and their adjacents. (int) ndx = index of the vertex (int) ndxa = index of the closest adjacent (bool) is_acute = True if the angle is too low (< acute_thr). (bool) is_zigzag = True if both angle_v and angle_a are acute and the distance from va to the segment v-vb is lower than threshold. (bool) is_spike = True if is_acute and angle_a is not straight and the distance from va to the segment v-vb is lower than threshold. (Point) vx = projection of va over the segment v-vb.