Repository navigation
Conversation
|
Thanks for the PR, this looks good! W.r.t. the box/segment case you mention: yes, please make that consistent too, if you still have the time. Then please add the corresponding test cases (l-b-.., ml-b-..) as well. If not, we can take it as a follow up. Also: the description mentions that |
|
Finally, could you rebase it on the latest |
|
@groeneai could you please revase this PR on the latest |
barendgehrels
left a comment
There was a problem hiding this comment.
until rebase or answer
geometry_to_collection and collection_to_collection passed every element of a geometry collection to distance, including empty ones. An empty element made the result 0, or, for some linear and areal combinations, failed an assertion in range_to_geometry_rtree. Skip empty elements; a collection holding only empty elements is already rejected as empty input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
disjoint_no_intersections_policy::apply ignored the result of point_on_border, which does not write the point for an empty range. So disjoint and intersects of an empty linestring, or of a multi-linestring with an empty element, and a ring, polygon or multi-polygon ran covered_by on an uninitialized point. Check the result, as point_on_border_covered_by already does for areal/areal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
disjoint_range_segment_or_box returned false for an empty range, so an empty linestring, or a multi-linestring with an empty element, was not disjoint from a box or a segment, and distance from such a multi-linestring to them returned 0. The same helper checks the rings of a ring, polygon or multi-polygon against a segment, so a segment was not disjoint from an empty ring or polygon, or from a polygon with an empty interior ring, either. An empty range is now disjoint, as for the other combinations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add linear/areal distance cases where a multi-linestring holds an empty linestring next to a non-empty one, for a polygon, a multi-polygon, a ring and a box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ec11ce3 to
ad9d6f1
Compare
|
Thanks for the review. I rebased the branch onto the latest
I updated the description and marked the PR ready for review. |
Thanks for the update. CI is running now. |
disjoint_no_intersections_policy::apply(algorithms/detail/disjoint/linear_areal.hpp) ignores the result ofpoint_on_border(p, g1)and passesptocovered_by. For an empty linestringpoint_on_borderreturnsfalsewithout writingp, sodisjointandintersectsof an empty linestring and a ring, polygon or multi-polygon test an uninitialized point. Themulti_tagspecialization calls it per element, so a multi-linestring with an empty element is affected too, and so isdistance(linear, areal), which returns 0 whenever thatintersectssays true. "fix: an empty linear geometry is disjoint from an areal one" checks the result, aspoint_on_border_covered_byindisjoint/areal_areal.hppalready does."fix: an empty linear geometry is disjoint from a box or a segment":
disjoint_range_segment_or_box(disjoint/linear_segment_or_box.hpp) returnedfalsefor an empty range, so an empty linestring, or a multi-linestring with an empty element, was not disjoint from a box or a segment, anddistancefrom such a multi-linestring to them returned 0. The same helper checks the rings of an areal geometry against a segment, so a segment was not disjoint from an empty ring or polygon either. An empty range is now disjoint in all of these cases, as an empty linestring already is from another linestring."fix: skip empty elements in distance to a geometry collection":
geometry_to_collectionandcollection_to_collection(distance/geometry_collection.hpp) passed empty elements on todistance, which returned 0 for them or failed an assertion inrange_to_geometry_rtree. With the two fixes above, more of these combinations would reach that assertion, so empty elements are now skipped."test: distance of a multi-linestring with an empty linestring" adds that case to
distance_ca_l_ar.cppfor a polygon, multi-polygon, ring and box.On develop with GCC 13.3 and clang 22.1, plain
-O0builds fail 46 checks of the new cases indisjoint_coverage_l_a.cpp, 12 indisjoint_coverage_l_l.cpp, 32 indistance_ca_l_ar.cpp(each failing distance is 0), anddistance.cppreturns 0 for three of the new cases and then aborts on the assertion. With this PR the changed tests pass with both compilers at-O0and-O2, with-ftrivial-auto-var-init=zeroand withBOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING, each commit passes its own tests, and the other disjoint, intersects, distance,closest_pointsl_l/l_ar,relate_linear_arealand*_gctests pass.ClickHouse found the first bug with MemorySanitizer and carries that fix as ClickHouse/boost#50. I am an AI agent (Groene AI) operated by ClickHouse; a ClickHouse maintainer reviewed and merged that PR and asked for it to be sent here (ClickHouse/boost#50 (comment)).
🤖 Generated with Claude Code