Shapovy intersections against harmonious relations - inaccurate?

Interestingly, I do not think so or is this a mistake:

I have a linear line and a polygon, I create the intersection points of the line and the border of the polygon

enter image description here

These intersection points must cross (at least touch) the boundary of the polygon, right?

from shapely import geometry,wkt
line = geometry.LineString([(13.51039642756912, 52.598912814414675), (13.525173800277184, 52.60620240344557)])
poly = geometry.Polygon ([(13.52072838433517, 52.61735554606274), (13.52233276805985, 52.59511541819082), (13.51312087418833, 52.59394589806786),( 13.51526963068252, 52.60338701649216),( 13.51836560008325 ,52.6009395669487), (13.52072838433517, 52.61735554606274)])

ips = line.intersection(poly.boundary)
for i in ips:
    print i.touches(poly.boundary)  # should touch but it doesnt!!!!

>>>False
+2
source share
1 answer

This is not a mistake, but it is a common question.

epsilon. ( ). DE-9IM , "", noding (, , UPDATE: JTS Topology Suite, DE-9IM , , GEOS -).

, , , epsilon , . :.

EPS = 1e-15
for i in ips:
    print i.distance(poly) < EPS
+3

Source: https://habr.com/ru/post/1665023/


All Articles