You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It turns out that our strategy of using three basic predicates with pip, intersection, and point equality does not work with a particular arrangement of Polygon.contains(Linestring)
That arrangement is visualized here:
In this example, a LineString that shares only border vertices with a containing polygon can't be distinguished as to whether or not the interior segment is inside or outside of the polygon. This effect occurs regardless of the length of the LineString, so long as the LineString segments are all on the border of the polygon.
The normal approach works well if any vertex is added to the LineString that is not on the border. We'll have to think of a deeper solution to this particular test case.
The following algorithm describes the approach we defined for correcting Polygon.contains. This whole routine should be written in libcuspatial.
lhs.contains(rhs) where lhs (left-hand side) is a Polygon and rhs (right-hand side) is a Polygon or LineString does not depend on the vertices that define the rhs geometry, but depends on the line segments.
The operation is the same for polygons or linestrings in the rhs. A polygon is simply a closed LineSegment and a LineString is, by definition, unclosed.
The algorithm for computing lhs.contains(rhs) is as follows:
linestring_intersection_for_contains should compute two results for the lhs and rhs, for many lhs and rhs in parallel:
boolean: whether or not a proper intersection in the lhs and rhs exists. A proper intersection between the lhs and rhs is a point of intersection that is not a vertex of the lhs or rhs.
proper intersections on the lhs: vertices that are in the lhs but not in the rhs should be used to divide the rhs segment before calling pip on the segments
intersection segments: a set of vertex pairs defining all of the overlapping segments in the intersection between lhs and rhs.
possibles = ~intersection[0]
possibles is the subset of lhs/rhs pairs for which the rhs may be contained in the lhs, because there is no proper intersection between them.
pairwise_linestring_difference subtracts each segment in the second argument from the linestring in the first argument. Split and difference could be combined.
Version
23.08
On which installation method(s) does this occur?
Rapids-Compose
Describe the issue
It turns out that our strategy of using three basic predicates with pip, intersection, and point equality does not work with a particular arrangement of Polygon.contains(Linestring)
That arrangement is visualized here:
In this example, a LineString that shares only border vertices with a containing polygon can't be distinguished as to whether or not the interior segment is inside or outside of the polygon. This effect occurs regardless of the length of the LineString, so long as the LineString segments are all on the border of the polygon.
The normal approach works well if any vertex is added to the LineString that is not on the border. We'll have to think of a deeper solution to this particular test case.
Minimum reproducible example
Relevant log output
Environment details
No response
Other/Misc.
No response
The text was updated successfully, but these errors were encountered: