# Why does this RegionIntersection return EmptyRegion?

Why does the first one return EmptyRegion while the second one works? I expected the result is Line[{{0, 0}, {1, 1}}] as the second one.

RegionIntersection[
Polygon[{{-1, 1}, {1, 1}, {1, 0}, {-1, 0}, {-1, 1}}],
Line[{{0, 0}, {1, 1}}]] RegionIntersection[Polygon[{{-1, 1}, {1, 1}, {1, 0}, {-1, 0}}],
Line[{{0, 0}, {1, 1}}]] Aslo how does EmptyRegion is defined? I read the docs but still not quite clear. It seems like a point is not empty in R but empty in R2.

How would I define a polygon region like above but without the boundary?

• On V12 I got the output Line[{{0, 0}, {1, 1}}] from the first one; see image
– bmf
Apr 5 at 6:25
• @bmf that is strange. Mine is "12.2.0 for Microsoft Windows (64-bit) (December 12, 2020)"
– hana
Apr 5 at 6:33
• thanks for letting me know. Mine is 12.0.0. Maybe others can check on other versions. If nobody checks, I will run a check on 13.0.0 in the morning
– bmf
Apr 5 at 6:40
• got the same output as OP (EmptyRegion and Line[{{0, 0}, {1, 1}}]]) on v13.0.0.0 Apr 5 at 6:48
• RegionEqual[Polygon[{{-1, 1}, {1, 1}, {1, 0}, {-1, 0}}], Polygon[{{-1, 1}, {1, 1}, {1, 0}, {-1, 0}, {-1, 1}}]] is True indicate that it is a bug. Apr 5 at 9:41

ln1 = Line[{{0, 0}, {1, 1}}];
pts0 = {{-1, 1}, {1, 1}, {1, 0}, {-1, 0}, {-1, 1}}
p0 = Polygon@pts0
p1 = Polygon[{{-1, 1}, {1, 1}, {1, 0}, {-1, 0}}]
p2 = CanonicalizePolygon[p0]


These are regions nevertheless:

RegionQ /@ {p0, p1, p2}


{True, True, True}

but a proper polygon produces the desired results for RegionIntersection. The polygon p1 you defined just happened to be a correct polygon with no repeating points.

RegionIntersection[#, ln1] & /@ {p0, p1, p2}


{EmptyRegion, Line[{{0, 0}, {1, 1}}], Line[{{0, 0}, {1, 1}}]}

• Thanks, actually the first one had problem so I removed the repeating points. I thought the first one should work as well.
– hana
Apr 5 at 7:24
• Frankly your question has not been answered. What I have is a workaround only. If something is recognized as a Region as I showed above, then it must play nice with other regions.
– Syed
Apr 5 at 11:09