qgsvectorlayerprofilegenerator: Fix intersection for collinear polygons#66432
Open
ptitjano wants to merge 1 commit into
Open
qgsvectorlayerprofilegenerator: Fix intersection for collinear polygons#66432ptitjano wants to merge 1 commit into
ptitjano wants to merge 1 commit into
Conversation
rouault
reviewed
Jun 10, 2026
| vl = QgsVectorLayer("PolygonZ?crs=EPSG:3857", "polygon", "memory") | ||
| self.assertTrue(vl.isValid()) | ||
|
|
||
| polygon_wkt = "Polygon Z ((547405.88 6150237.19 0, 547405.88 6150237.19 5, 547413.39 6150203.24 5, 547413.39 6150203.24 0, 547405.88 6150237.19 0))" |
Contributor
There was a problem hiding this comment.
those "random" looking coordinates are difficult to reason with. If there was a way of coming with simple looking coordinates, that might help (no strong requirement, just asking in case it is not too difficult)
Collaborator
Author
There was a problem hiding this comment.
No strong opinion. I just tried to stay in line with other unit test which use similar "random" coordinates.
troopa81
reviewed
Jun 11, 2026
With tolerance at 0, when a triangle from the tessellated polygon is collinear In the XY plane, the `processTriangleLineIntersect` worflow does not work and a special case is requirede. In that case, the intersection between the profile line and the profile line is computed. For every intersection, the Z value is extracted. For each intersection, a Z value is calculated along the edge. The lowest and highest Z values are then used to build the vertical profile segment represented by the triangle. This changes fixes 2 issues when iterating over the triangle edges: 1. Use the triangle, instead of the input polygon is used to compute intersection 2. Preserve the first valid intersection point when processing collinear triangles. Otherwise, a subsequent failed edge intersection test may overwrite a previously valid intersection point, causing profile segments to be skipped.
225ccec to
8226eca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With tolerance at 0, when a triangle from the tessellated polygon is collinear In the XY plane, the
processTriangleLineIntersectworflow does not work and a special case is requirede.In that case, the intersection between the profile line and the profile line is computed. For every intersection, the Z value is extracted. For each intersection, a Z value is calculated along the edge. The lowest and highest Z values are then used to build the vertical profile segment represented by the triangle.
This changes fixes 2 issues when iterating over the triangle edges:
AI tool usage
No AI Tool used
Example
Bug
Fixed